Changes to ohayo.scroll.pub

Breck Yunits
Breck Yunits
7 months ago
Create FUNDING.yml
FUNDING.yml
Changed around line 1
+ # These are supported funding model platforms
+
+ github: breck7
+ custom: https://breckyunits.com/lab.html
Breck Yunits
Breck Yunits
8 months ago
update domain name
ohayo.es6.browser.js
Changed around line 1
- "use strict";
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e,i;function c(){return e.apply(null,arguments)}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function u(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function l(e){return void 0===e}function h(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function d(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function f(e,t){var n,s=[];for(n=0;n>>0,s=0;sSe(e)?(r=e+1,o-Se(e)):(r=e,o),{year:r,dayOfYear:a}}function Ie(e,t,n){var s,i,r=Ve(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+Ae(i=e.year()-1,t,n):a>Ae(e.year(),t,n)?(s=a-Ae(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function Ae(e,t,n){var s=Ve(e,t,n),i=Ve(e+1,t,n);return(Se(e)-s+i)/7}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),C("week","w"),C("isoWeek","W"),F("week",5),F("isoWeek",5),ue("w",B),ue("ww",B,z),ue("W",B),ue("WW",B,z),fe(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=D(e)});function je(e,t){return e.slice(t,7).concat(e.slice(0,t))}I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),C("day","d"),C("weekday","e"),C("isoWeekday","E"),F("day",11),F("weekday",11),F("isoWeekday",11),ue("d",B),ue("e",B),ue("E",B),ue("dd",function(e,t){return t.weekdaysMinRegex(e)}),ue("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ue("dddd",function(e,t){return t.weekdaysRegex(e)}),fe(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:g(n).invalidWeekday=e}),fe(["d","e","E"],function(e,t,n,s){t[s]=D(e)});var Ze="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var $e="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var qe=ae;var Je=ae;var Be=ae;function Qe(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=y([2e3,1]).day(t),s=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),r=this.weekdays(n,""),a.push(s),o.push(i),u.push(r),l.push(s),l.push(i),l.push(r);for(a.sort(e),o.sort(e),u.sort(e),l.sort(e),t=0;t<7;t++)o[t]=he(o[t]),u[t]=he(u[t]),l[t]=he(l[t]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Xe(){return this.hours()%12||12}function Ke(e,t){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function et(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,Xe),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)}),I("hmmss",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)+L(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+L(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+L(this.minutes(),2)+L(this.seconds(),2)}),Ke("a",!0),Ke("A",!1),C("hour","h"),F("hour",13),ue("a",et),ue("A",et),ue("H",B),ue("h",B),ue("k",B),ue("HH",B,z),ue("hh",B,z),ue("kk",B,z),ue("hmm",Q),ue("hmmss",X),ue("Hmm",Q),ue("Hmmss",X),ce(["H","HH"],ge),ce(["k","kk"],function(e,t,n){var s=D(e);t[ge]=24===s?0:s}),ce(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ce(["h","hh"],function(e,t,n){t[ge]=D(e),g(n).bigHour=!0}),ce("hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s)),g(n).bigHour=!0}),ce("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i)),g(n).bigHour=!0}),ce("Hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s))}),ce("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i))});var tt,nt=Te("Hours",!0),st={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Ce,monthsShort:He,week:{dow:0,doy:6},weekdays:Ze,weekdaysMin:$e,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},it={},rt={};function at(e){return e?e.toLowerCase().replace("_","-"):e}function ot(e){var t=null;if(!it[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=tt._abbr,require("./locale/"+e),ut(t)}catch(e){}return it[e]}function ut(e,t){var n;return e&&((n=l(t)?ht(e):lt(e,t))?tt=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),tt._abbr}function lt(e,t){if(null===t)return delete it[e],null;var n,s=st;if(t.abbr=e,null!=it[e])T("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=it[e]._config;else if(null!=t.parentLocale)if(null!=it[t.parentLocale])s=it[t.parentLocale]._config;else{if(null==(n=ot(t.parentLocale)))return rt[t.parentLocale]||(rt[t.parentLocale]=[]),rt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return it[e]=new P(x(s,t)),rt[e]&&rt[e].forEach(function(e){lt(e.name,e.config)}),ut(e),it[e]}function ht(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return tt;if(!o(e)){if(t=ot(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r=t&&a(i,n,!0)>=t-1)break;t--}r++}return tt}(e)}function dt(e){var t,n=e._a;return n&&-2===g(e).overflow&&(t=n[_e]<0||11Pe(ne],n[_e])?ye:n[ge]<0||24Ae(n,r,a)?g(e)._overflowWeeks=!0:null!=u?g(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._ae]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=ct(e._ae],se]),(e._dayOfYear>Se(r)||0===e._dayOfYear)&&(g(e)._overflowDayOfYear=!0),n=Ge(r,0,e._dayOfYear),e._a[_e]=n.getUTCMonth(),e._a[ye]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=a[t]=s[t];for(;t<7;t++)e._a[t]=a[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ge]&&0===e._a[ve]&&0===e._a[pe]&&0===e._a[we]&&(e._nextDay=!0,e._a[ge]=0),e._d=(e._useUTC?Ge:function(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}).apply(null,a),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ge]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(g(e).weekdayMismatch=!0)}}var mt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_t=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,yt=/Z|[+-]\d\d(?::?\d\d)?/,gt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],vt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],pt=/^\/?Date\((\-?\d+)/i;function wt(e){var t,n,s,i,r,a,o=e._i,u=mt.exec(o)||_t.exec(o);if(u){for(g(e).iso=!0,t=0,n=gt.length;tn.valueOf():n.valueOf()this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},mn.isLocal=function(){return!!this.isValid()&&!this._isUTC},mn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},mn.isUtc=Et,mn.isUTC=Et,mn.zoneAbbr=function(){return this._isUTC?"UTC":""},mn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},mn.dates=n("dates accessor is deprecated. Use date instead.",un),mn.months=n("months accessor is deprecated. Use month instead",Ue),mn.years=n("years accessor is deprecated. Use year instead",Oe),mn.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),mn.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e={};if(w(e,this),(e=Ot(e))._a){var t=e._isUTC?y(e._a):bt(e._a);this._isDSTShifted=this.isValid()&&0
-
- (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.momentParseformat = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o
- var parseFormat = require('./lib/parseformat')
- module.exports = parseFormat
-
- /* istanbul ignore next */
- if (typeof window !== 'undefined' && window.moment) {
- window.moment.parseFormat = parseFormat
- }
-
- },{"./lib/parseformat":2}],2:[function(require,module,exports){
- module.exports = parseFormat
-
- var dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
- var abbreviatedDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
- var shortestDayNames = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']
- var monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
- var abbreviatedMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
-
- var regexDayNames = new RegExp(dayNames.join('|'), 'i')
- var regexAbbreviatedDayNames = new RegExp(abbreviatedDayNames.join('|'), 'i')
- var regexShortestDayNames = new RegExp('\\b(' + shortestDayNames.join('|') + ')\\b', 'i')
- var regexMonthNames = new RegExp(monthNames.join('|'), 'i')
- var regexAbbreviatedMonthNames = new RegExp(abbreviatedMonthNames.join('|'), 'i')
-
- var regexFirstSecondThirdFourth = /(\d+)(st|nd|rd|th)\b/i
- var regexEndian = /(\d{1,4})([/.-])(\d{1,2})[/.-](\d{1,4})/
-
- var regexTimezone = /((\+|-)\d\d:?\d\d)$/
- var amOrPm = '(' + ['AM?', 'PM?'].join('|') + ')'
- var regexHoursWithLeadingZeroDigitMinutesSecondsAmPm = new RegExp('0\\d\\:\\d{1,2}\\:\\d{1,2}(\\s*)' + amOrPm, 'i')
- var regexHoursWithLeadingZeroDigitMinutesAmPm = new RegExp('0\\d\\:\\d{1,2}(\\s*)' + amOrPm, 'i')
- var regexHoursWithLeadingZeroDigitAmPm = new RegExp('0\\d(\\s*)' + amOrPm, 'i')
- var regexHoursMinutesSecondsAmPm = new RegExp('\\d{1,2}\\:\\d{1,2}\\:\\d{1,2}(\\s*)' + amOrPm, 'i')
- var regexHoursMinutesAmPm = new RegExp('\\d{1,2}\\:\\d{1,2}(\\s*)' + amOrPm, 'i')
- var regexHoursAmPm = new RegExp('\\d{1,2}(\\s*)' + amOrPm, 'i')
-
- var regexISO8601HoursWithLeadingZeroMinutesSecondsMilliseconds = /\d{2}:\d{2}:\d{2}\.\d{3}/
- var regexISO8601HoursWithLeadingZeroMinutesSecondsCentiSeconds = /\d{2}:\d{2}:\d{2}\.\d{2}/
- var regexISO8601HoursWithLeadingZeroMinutesSecondsDeciSeconds = /\d{2}:\d{2}:\d{2}\.\d{1}/
- var regexHoursWithLeadingZeroMinutesSeconds = /0\d:\d{2}:\d{2}/
- var regexHoursWithLeadingZeroMinutes = /0\d:\d{2}/
- var regexHoursMinutesSeconds = /\d{1,2}:\d{2}:\d{2}/
- var regexHoursMinutesSecondsMilliseconds = /\d{1,2}:\d{2}:\d{2}\.\d{3}/
- var regexHoursMinutesSecondsCentiSeconds = /\d{1,2}:\d{2}:\d{2}\.\d{2}/
- var regexHoursMinutesSecondsDeciSeconds = /\d{1,2}:\d{2}:\d{2}\.\d{1}/
- var regexHoursMinutes = /\d{1,2}:\d{2}/
- var regexYearLong = /\d{4}/
- var regexDayLeadingZero = /0\d/
- var regexDay = /\d{1,2}/
- var regexYearShort = /\d{2}/
-
- var regexDayShortMonthShort = /^([1-9])\/([1-9]|0[1-9])$/
- var regexDayShortMonth = /^([1-9])\/(1[012])$/
- var regexDayMonthShort = /^(0[1-9]|[12][0-9]|3[01])\/([1-9])$/
- var regexDayMonth = /^(0[1-9]|[12][0-9]|3[01])\/(1[012]|0[1-9])$/
-
- var regexMonthShortYearShort = /^([1-9])\/([1-9][0-9])$/
- var regexMonthYearShort = /^(0[1-9]|1[012])\/([1-9][0-9])$/
-
- var formatIncludesMonth = /([/][M]|[M][/]|[MM]|[MMMM])/
-
- var regexFillingWords = /\b(at)\b/i
-
- var regexUnixMillisecondTimestamp = /\d{13}/
- var regexUnixTimestamp = /\d{10}/
-
- // option defaults
- var defaultOrder = {
- '/': 'MDY',
- '.': 'DMY',
- '-': 'YMD'
- }
-
- function parseFormat (dateString, options) {
- var format = dateString.toString()
-
- // default options
- options = options || {}
- options.preferredOrder = options.preferredOrder || defaultOrder
-
- // Unix Millisecond Timestamp ☛ x
- format = format.replace(regexUnixMillisecondTimestamp, 'x')
- // Unix Timestamp ☛ X
- format = format.replace(regexUnixTimestamp, 'X')
-
- // escape filling words
- format = format.replace(regexFillingWords, '[$1]')
-
- // DAYS
-
- // Monday ☛ dddd
- format = format.replace(regexDayNames, 'dddd')
- // Mon ☛ ddd
- format = format.replace(regexAbbreviatedDayNames, 'ddd')
- // Mo ☛ dd
- format = format.replace(regexShortestDayNames, 'dd')
-
- // 1st, 2nd, 23rd ☛ do
- format = format.replace(regexFirstSecondThirdFourth, 'Do')
-
- // MONTHS
-
- // January ☛ MMMM
- format = format.replace(regexMonthNames, 'MMMM')
- // Jan ☛ MMM
- format = format.replace(regexAbbreviatedMonthNames, 'MMM')
-
- // replace endians, like 8/20/2010, 20.8.2010 or 2010-8-20
- format = format.replace(regexEndian, replaceEndian.bind(null, options))
-
- // TIME
-
- // timezone +02:00 ☛ Z
- format = format.replace(regexTimezone, 'Z')
- // 23:39:43.331 ☛ 'HH:mm:ss.SSS'
- format = format.replace(regexISO8601HoursWithLeadingZeroMinutesSecondsMilliseconds, 'HH:mm:ss.SSS')
- // 23:39:43.33 ☛ 'HH:mm:ss.SS'
- format = format.replace(regexISO8601HoursWithLeadingZeroMinutesSecondsCentiSeconds, 'HH:mm:ss.SS')
- // 23:39:43.3 ☛ 'HH:mm:ss.S'
- format = format.replace(regexISO8601HoursWithLeadingZeroMinutesSecondsDeciSeconds, 'HH:mm:ss.S')
- function replaceWithAmPm (timeFormat) {
- return function (match, whitespace, amPm) {
- return timeFormat + whitespace + (amPm[0].toUpperCase() === amPm[0] ? 'A' : 'a')
- }
- }
- // 05:30:20pm ☛ hh:mm:ssa
- format = format.replace(regexHoursWithLeadingZeroDigitMinutesSecondsAmPm, replaceWithAmPm('hh:mm:ss'))
- // 10:30:20pm ☛ h:mm:ssa
- format = format.replace(regexHoursMinutesSecondsAmPm, replaceWithAmPm('h:mm:ss'))
- // 05:30pm ☛ hh:mma
- format = format.replace(regexHoursWithLeadingZeroDigitMinutesAmPm, replaceWithAmPm('hh:mm'))
- // 10:30pm ☛ h:mma
- format = format.replace(regexHoursMinutesAmPm, replaceWithAmPm('h:mm'))
- // 05pm ☛ hha
- format = format.replace(regexHoursWithLeadingZeroDigitAmPm, replaceWithAmPm('hh'))
- // 10pm ☛ ha
- format = format.replace(regexHoursAmPm, replaceWithAmPm('h'))
- // 05:30:20 ☛ HH:mm:ss
- format = format.replace(regexHoursWithLeadingZeroMinutesSeconds, 'HH:mm:ss')
- // 5:30:20.222 ☛ H:mm:ss.SSS
- format = format.replace(regexHoursMinutesSecondsMilliseconds, 'H:mm:ss.SSS')
- // 5:30:20.22 ☛ H:mm:ss.SS
- format = format.replace(regexHoursMinutesSecondsCentiSeconds, 'H:mm:ss.SS')
- // 5:30:20.2 ☛ H:mm:ss.S
- format = format.replace(regexHoursMinutesSecondsDeciSeconds, 'H:mm:ss.S')
- // 10:30:20 ☛ H:mm:ss
- format = format.replace(regexHoursMinutesSeconds, 'H:mm:ss')
- // 05:30 ☛ H:mm
- format = format.replace(regexHoursWithLeadingZeroMinutes, 'HH:mm')
- // 10:30 ☛ HH:mm
- format = format.replace(regexHoursMinutes, 'H:mm')
-
- // do we still have numbers left?
-
- // Lets check for 4 digits first, these are years for sure
- format = format.replace(regexYearLong, 'YYYY')
-
- // check if both numbers are < 13, then it must be D/M
- format = format.replace(regexDayShortMonthShort, 'D/M')
-
- // check if first number is < 10 && last < 13, then it must be D/MM
- format = format.replace(regexDayShortMonth, 'D/MM')
-
- // check if last number is < 32 && last < 10, then it must be DD/M
- format = format.replace(regexDayMonthShort, 'DD/M')
-
- // check if both numbers are > 10, but first < 32 && last < 13, then it must be DD/MM
- format = format.replace(regexDayMonth, 'DD/MM')
-
- // check if first < 10 && last > 12, then it must be M/YY
- format = format.replace(regexMonthShortYearShort, 'M/YY')
-
- // check if first < 13 && last > 12, then it must be MM/YY
- format = format.replace(regexMonthYearShort, 'MM/YY')
-
- // to prevent 9.20 gets formated to D.Y, we format the complete date first, then go for the time
- if (format.match(formatIncludesMonth)) {
- var regexHoursDotWithLeadingZeroOrDoubleDigitMinutes = /0\d.\d{2}|\d{2}.\d{2}/
- var regexHoursDotMinutes = /\d{1}.\d{2}/
-
- format = format.replace(regexHoursDotWithLeadingZeroOrDoubleDigitMinutes, 'H.mm')
- format = format.replace(regexHoursDotMinutes, 'h.mm')
- }
-
- // now, the next number, if existing, must be a day
- format = format.replace(regexDayLeadingZero, 'DD')
- format = format.replace(regexDay, 'D')
-
- // last but not least, there could still be a year left
- format = format.replace(regexYearShort, 'YY')
-
- if (format.length < 1) {
- format = undefined
- }
-
- return format
- }
-
- // if we can't find an endian based on the separator, but
- // there still is a short date with day, month & year,
- // we try to make a smart decision to identify the order
- function replaceEndian (options, matchedPart, first, separator, second, third) {
- var parts
- var hasSingleDigit = Math.min(first.length, second.length, third.length) === 1
- var hasQuadDigit = Math.max(first.length, second.length, third.length) === 4
- var preferredOrder = typeof options.preferredOrder === 'string' ? options.preferredOrder : options.preferredOrder[separator]
-
- first = parseInt(first, 10)
- second = parseInt(second, 10)
- third = parseInt(third, 10)
- parts = [first, second, third]
- preferredOrder = preferredOrder.toUpperCase()
-
- // If first is a year, order will always be Year-Month-Day
- if (first > 31) {
- parts[0] = hasQuadDigit ? 'YYYY' : 'YY'
- parts[1] = hasSingleDigit ? 'M' : 'MM'
- parts[2] = hasSingleDigit ? 'D' : 'DD'
- return parts.join(separator)
- }
-
- // Second will never be the year. And if it is a day,
- // the order will always be Month-Day-Year
- if (second > 12) {
- parts[0] = hasSingleDigit ? 'M' : 'MM'
- parts[1] = hasSingleDigit ? 'D' : 'DD'
- parts[2] = hasQuadDigit ? 'YYYY' : 'YY'
- return parts.join(separator)
- }
-
- // if third is a year ...
- if (third > 31) {
- parts[2] = hasQuadDigit ? 'YYYY' : 'YY'
-
- // ... try to find day in first and second.
- // If found, the remaining part is the month.
- if (preferredOrder[0] === 'M' && first < 13) {
- parts[0] = hasSingleDigit ? 'M' : 'MM'
- parts[1] = hasSingleDigit ? 'D' : 'DD'
- return parts.join(separator)
- }
- parts[0] = hasSingleDigit ? 'D' : 'DD'
- parts[1] = hasSingleDigit ? 'M' : 'MM'
- return parts.join(separator)
- }
-
- // if we had no luck until here, we use the preferred order
- parts[preferredOrder.indexOf('D')] = hasSingleDigit ? 'D' : 'DD'
- parts[preferredOrder.indexOf('M')] = hasSingleDigit ? 'M' : 'MM'
- parts[preferredOrder.indexOf('Y')] = hasQuadDigit ? 'YYYY' : 'YY'
-
- return parts.join(separator)
- }
-
- },{}]},{},[1])(1)
- });;
+ "use strict"
+ !(function (e, t) {
+ "object" == typeof exports && "undefined" != typeof module ? (module.exports = t()) : "function" == typeof define && define.amd ? define(t) : (e.moment = t())
+ })(this, function () {
+ "use strict"
+ var e, i
+ function c() {
+ return e.apply(null, arguments)
+ }
+ function o(e) {
+ return e instanceof Array || "[object Array]" === Object.prototype.toString.call(e)
+ }
+ function u(e) {
+ return null != e && "[object Object]" === Object.prototype.toString.call(e)
+ }
+ function l(e) {
+ return void 0 === e
+ }
+ function h(e) {
+ return "number" == typeof e || "[object Number]" === Object.prototype.toString.call(e)
+ }
+ function d(e) {
+ return e instanceof Date || "[object Date]" === Object.prototype.toString.call(e)
+ }
+ function f(e, t) {
+ var n,
+ s = []
+ for (n = 0; n < e.length; ++n) s.push(t(e[n], n))
+ return s
+ }
+ function m(e, t) {
+ return Object.prototype.hasOwnProperty.call(e, t)
+ }
+ function _(e, t) {
+ for (var n in t) m(t, n) && (e[n] = t[n])
+ return m(t, "toString") && (e.toString = t.toString), m(t, "valueOf") && (e.valueOf = t.valueOf), e
+ }
+ function y(e, t, n, s) {
+ return Tt(e, t, n, s, !0).utc()
+ }
+ function g(e) {
+ return (
+ null == e._pf &&
+ (e._pf = {
+ empty: !1,
+ unusedTokens: [],
+ unusedInput: [],
+ overflow: -2,
+ charsLeftOver: 0,
+ nullInput: !1,
+ invalidMonth: null,
+ invalidFormat: !1,
+ userInvalidated: !1,
+ iso: !1,
+ parsedDateParts: [],
+ meridiem: null,
+ rfc2822: !1,
+ weekdayMismatch: !1,
+ }),
+ e._pf
+ )
+ }
+ function v(e) {
+ if (null == e._isValid) {
+ var t = g(e),
+ n = i.call(t.parsedDateParts, function (e) {
+ return null != e
+ }),
+ s =
+ !isNaN(e._d.getTime()) &&
+ t.overflow < 0 &&
+ !t.empty &&
+ !t.invalidMonth &&
+ !t.invalidWeekday &&
+ !t.weekdayMismatch &&
+ !t.nullInput &&
+ !t.invalidFormat &&
+ !t.userInvalidated &&
+ (!t.meridiem || (t.meridiem && n))
+ if ((e._strict && (s = s && 0 === t.charsLeftOver && 0 === t.unusedTokens.length && void 0 === t.bigHour), null != Object.isFrozen && Object.isFrozen(e))) return s
+ e._isValid = s
+ }
+ return e._isValid
+ }
+ function p(e) {
+ var t = y(NaN)
+ return null != e ? _(g(t), e) : (g(t).userInvalidated = !0), t
+ }
+ i = Array.prototype.some
+ ? Array.prototype.some
+ : function (e) {
+ for (var t = Object(this), n = t.length >>> 0, s = 0; s < n; s++) if (s in t && e.call(this, t[s], s, t)) return !0
+ return !1
+ }
+ var r = (c.momentProperties = [])
+ function w(e, t) {
+ var n, s, i
+ if (
+ (l(t._isAMomentObject) || (e._isAMomentObject = t._isAMomentObject),
+ l(t._i) || (e._i = t._i),
+ l(t._f) || (e._f = t._f),
+ l(t._l) || (e._l = t._l),
+ l(t._strict) || (e._strict = t._strict),
+ l(t._tzm) || (e._tzm = t._tzm),
+ l(t._isUTC) || (e._isUTC = t._isUTC),
+ l(t._offset) || (e._offset = t._offset),
+ l(t._pf) || (e._pf = g(t)),
+ l(t._locale) || (e._locale = t._locale),
+ 0 < r.length)
+ )
+ for (n = 0; n < r.length; n++) l((i = t[(s = r[n])])) || (e[s] = i)
+ return e
+ }
+ var t = !1
+ function M(e) {
+ w(this, e), (this._d = new Date(null != e._d ? e._d.getTime() : NaN)), this.isValid() || (this._d = new Date(NaN)), !1 === t && ((t = !0), c.updateOffset(this), (t = !1))
+ }
+ function k(e) {
+ return e instanceof M || (null != e && null != e._isAMomentObject)
+ }
+ function S(e) {
+ return e < 0 ? Math.ceil(e) || 0 : Math.floor(e)
+ }
+ function D(e) {
+ var t = +e,
+ n = 0
+ return 0 !== t && isFinite(t) && (n = S(t)), n
+ }
+ function a(e, t, n) {
+ var s,
+ i = Math.min(e.length, t.length),
+ r = Math.abs(e.length - t.length),
+ a = 0
+ for (s = 0; s < i; s++) ((n && e[s] !== t[s]) || (!n && D(e[s]) !== D(t[s]))) && a++
+ return a + r
+ }
+ function Y(e) {
+ !1 === c.suppressDeprecationWarnings && "undefined" != typeof console && console.warn && console.warn("Deprecation warning: " + e)
+ }
+ function n(i, r) {
+ var a = !0
+ return _(function () {
+ if ((null != c.deprecationHandler && c.deprecationHandler(null, i), a)) {
+ for (var e, t = [], n = 0; n < arguments.length; n++) {
+ if (((e = ""), "object" == typeof arguments[n])) {
+ for (var s in ((e += "\n[" + n + "] "), arguments[0])) e += s + ": " + arguments[0][s] + ", "
+ e = e.slice(0, -2)
+ } else e = arguments[n]
+ t.push(e)
+ }
+ Y(i + "\nArguments: " + Array.prototype.slice.call(t).join("") + "\n" + new Error().stack), (a = !1)
+ }
+ return r.apply(this, arguments)
+ }, r)
+ }
+ var s,
+ O = {}
+ function T(e, t) {
+ null != c.deprecationHandler && c.deprecationHandler(e, t), O[e] || (Y(t), (O[e] = !0))
+ }
+ function b(e) {
+ return e instanceof Function || "[object Function]" === Object.prototype.toString.call(e)
+ }
+ function x(e, t) {
+ var n,
+ s = _({}, e)
+ for (n in t) m(t, n) && (u(e[n]) && u(t[n]) ? ((s[n] = {}), _(s[n], e[n]), _(s[n], t[n])) : null != t[n] ? (s[n] = t[n]) : delete s[n])
+ for (n in e) m(e, n) && !m(t, n) && u(e[n]) && (s[n] = _({}, s[n]))
+ return s
+ }
+ function P(e) {
+ null != e && this.set(e)
+ }
+ ;(c.suppressDeprecationWarnings = !1),
+ (c.deprecationHandler = null),
+ (s = Object.keys
+ ? Object.keys
+ : function (e) {
+ var t,
+ n = []
+ for (t in e) m(e, t) && n.push(t)
+ return n
+ })
+ var W = {}
+ function C(e, t) {
+ var n = e.toLowerCase()
+ W[n] = W[n + "s"] = W[t] = e
+ }
+ function H(e) {
+ return "string" == typeof e ? W[e] || W[e.toLowerCase()] : void 0
+ }
+ function R(e) {
+ var t,
+ n,
+ s = {}
+ for (n in e) m(e, n) && (t = H(n)) && (s[t] = e[n])
+ return s
+ }
+ var U = {}
+ function F(e, t) {
+ U[e] = t
+ }
+ function L(e, t, n) {
+ var s = "" + Math.abs(e),
+ i = t - s.length
+ return (0 <= e ? (n ? "+" : "") : "-") + Math.pow(10, Math.max(0, i)).toString().substr(1) + s
+ }
+ var N =
+ /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,
+ G = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
+ V = {},
+ E = {}
+ function I(e, t, n, s) {
+ var i = s
+ "string" == typeof s &&
+ (i = function () {
+ return this[s]()
+ }),
+ e && (E[e] = i),
+ t &&
+ (E[t[0]] = function () {
+ return L(i.apply(this, arguments), t[1], t[2])
+ }),
+ n &&
+ (E[n] = function () {
+ return this.localeData().ordinal(i.apply(this, arguments), e)
+ })
+ }
+ function A(e, t) {
+ return e.isValid()
+ ? ((t = j(t, e.localeData())),
+ (V[t] =
+ V[t] ||
+ (function (s) {
+ var e,
+ i,
+ t,
+ r = s.match(N)
+ for (e = 0, i = r.length; e < i; e++) E[r[e]] ? (r[e] = E[r[e]]) : (r[e] = (t = r[e]).match(/\[[\s\S]/) ? t.replace(/^\[|\]$/g, "") : t.replace(/\\/g, ""))
+ return function (e) {
+ var t,
+ n = ""
+ for (t = 0; t < i; t++) n += b(r[t]) ? r[t].call(e, s) : r[t]
+ return n
+ }
+ })(t)),
+ V[t](e))
+ : e.localeData().invalidDate()
+ }
+ function j(e, t) {
+ var n = 5
+ function s(e) {
+ return t.longDateFormat(e) || e
+ }
+ for (G.lastIndex = 0; 0 <= n && G.test(e); ) (e = e.replace(G, s)), (G.lastIndex = 0), (n -= 1)
+ return e
+ }
+ var Z = /\d/,
+ z = /\d\d/,
+ $ = /\d{3}/,
+ q = /\d{4}/,
+ J = /[+-]?\d{6}/,
+ B = /\d\d?/,
+ Q = /\d\d\d\d?/,
+ X = /\d\d\d\d\d\d?/,
+ K = /\d{1,3}/,
+ ee = /\d{1,4}/,
+ te = /[+-]?\d{1,6}/,
+ ne = /\d+/,
+ se = /[+-]?\d+/,
+ ie = /Z|[+-]\d\d:?\d\d/gi,
+ re = /Z|[+-]\d\d(?::?\d\d)?/gi,
+ ae = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,
+ oe = {}
+ function ue(e, n, s) {
+ oe[e] = b(n)
+ ? n
+ : function (e, t) {
+ return e && s ? s : n
+ }
+ }
+ function le(e, t) {
+ return m(oe, e)
+ ? oe[e](t._strict, t._locale)
+ : new RegExp(
+ he(
+ e.replace("\\", "").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (e, t, n, s, i) {
+ return t || n || s || i
+ })
+ )
+ )
+ }
+ function he(e) {
+ return e.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&")
+ }
+ var de = {}
+ function ce(e, n) {
+ var t,
+ s = n
+ for (
+ "string" == typeof e && (e = [e]),
+ h(n) &&
+ (s = function (e, t) {
+ t[n] = D(e)
+ }),
+ t = 0;
+ t < e.length;
+ t++
+ )
+ de[e[t]] = s
+ }
+ function fe(e, i) {
+ ce(e, function (e, t, n, s) {
+ ;(n._w = n._w || {}), i(e, n._w, n, s)
+ })
+ }
+ var me = 0,
+ _e = 1,
+ ye = 2,
+ ge = 3,
+ ve = 4,
+ pe = 5,
+ we = 6,
+ Me = 7,
+ ke = 8
+ function Se(e) {
+ return De(e) ? 366 : 365
+ }
+ function De(e) {
+ return (e % 4 == 0 && e % 100 != 0) || e % 400 == 0
+ }
+ I("Y", 0, 0, function () {
+ var e = this.year()
+ return e <= 9999 ? "" + e : "+" + e
+ }),
+ I(0, ["YY", 2], 0, function () {
+ return this.year() % 100
+ }),
+ I(0, ["YYYY", 4], 0, "year"),
+ I(0, ["YYYYY", 5], 0, "year"),
+ I(0, ["YYYYYY", 6, !0], 0, "year"),
+ C("year", "y"),
+ F("year", 1),
+ ue("Y", se),
+ ue("YY", B, z),
+ ue("YYYY", ee, q),
+ ue("YYYYY", te, J),
+ ue("YYYYYY", te, J),
+ ce(["YYYYY", "YYYYYY"], me),
+ ce("YYYY", function (e, t) {
+ te] = 2 === e.length ? c.parseTwoDigitYear(e) : D(e)
+ }),
+ ce("YY", function (e, t) {
+ te] = c.parseTwoDigitYear(e)
+ }),
+ ce("Y", function (e, t) {
+ te] = parseInt(e, 10)
+ }),
+ (c.parseTwoDigitYear = function (e) {
+ return D(e) + (68 < D(e) ? 1900 : 2e3)
+ })
+ var Ye,
+ Oe = Te("FullYear", !0)
+ function Te(t, n) {
+ return function (e) {
+ return null != e ? (xe(this, t, e), c.updateOffset(this, n), this) : be(this, t)
+ }
+ }
+ function be(e, t) {
+ return e.isValid() ? e._d["get" + (e._isUTC ? "UTC" : "") + t]() : NaN
+ }
+ function xe(e, t, n) {
+ e.isValid() &&
+ !isNaN(n) &&
+ ("FullYear" === t && De(e.year()) && 1 === e.month() && 29 === e.date()
+ ? e._d["set" + (e._isUTC ? "UTC" : "") + t](n, e.month(), Pe(n, e.month()))
+ : e._d["set" + (e._isUTC ? "UTC" : "") + t](n))
+ }
+ function Pe(e, t) {
+ if (isNaN(e) || isNaN(t)) return NaN
+ var n,
+ s = ((t % (n = 12)) + n) % n
+ return (e += (t - s) / 12), 1 === s ? (De(e) ? 29 : 28) : 31 - ((s % 7) % 2)
+ }
+ ;(Ye = Array.prototype.indexOf
+ ? Array.prototype.indexOf
+ : function (e) {
+ var t
+ for (t = 0; t < this.length; ++t) if (this[t] === e) return t
+ return -1
+ }),
+ I("M", ["MM", 2], "Mo", function () {
+ return this.month() + 1
+ }),
+ I("MMM", 0, 0, function (e) {
+ return this.localeData().monthsShort(this, e)
+ }),
+ I("MMMM", 0, 0, function (e) {
+ return this.localeData().months(this, e)
+ }),
+ C("month", "M"),
+ F("month", 8),
+ ue("M", B),
+ ue("MM", B, z),
+ ue("MMM", function (e, t) {
+ return t.monthsShortRegex(e)
+ }),
+ ue("MMMM", function (e, t) {
+ return t.monthsRegex(e)
+ }),
+ ce(["M", "MM"], function (e, t) {
+ t[_e] = D(e) - 1
+ }),
+ ce(["MMM", "MMMM"], function (e, t, n, s) {
+ var i = n._locale.monthsParse(e, s, n._strict)
+ null != i ? (t[_e] = i) : (g(n).invalidMonth = e)
+ })
+ var We = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
+ Ce = "January_February_March_April_May_June_July_August_September_October_November_December".split("_")
+ var He = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_")
+ function Re(e, t) {
+ var n
+ if (!e.isValid()) return e
+ if ("string" == typeof t)
+ if (/^\d+$/.test(t)) t = D(t)
+ else if (!h((t = e.localeData().monthsParse(t)))) return e
+ return (n = Math.min(e.date(), Pe(e.year(), t))), e._d["set" + (e._isUTC ? "UTC" : "") + "Month"](t, n), e
+ }
+ function Ue(e) {
+ return null != e ? (Re(this, e), c.updateOffset(this, !0), this) : be(this, "Month")
+ }
+ var Fe = ae
+ var Le = ae
+ function Ne() {
+ function e(e, t) {
+ return t.length - e.length
+ }
+ var t,
+ n,
+ s = [],
+ i = [],
+ r = []
+ for (t = 0; t < 12; t++) (n = y([2e3, t])), s.push(this.monthsShort(n, "")), i.push(this.months(n, "")), r.push(this.months(n, "")), r.push(this.monthsShort(n, ""))
+ for (s.sort(e), i.sort(e), r.sort(e), t = 0; t < 12; t++) (s[t] = he(s[t])), (i[t] = he(i[t]))
+ for (t = 0; t < 24; t++) r[t] = he(r[t])
+ ;(this._monthsRegex = new RegExp("^(" + r.join("|") + ")", "i")),
+ (this._monthsShortRegex = this._monthsRegex),
+ (this._monthsStrictRegex = new RegExp("^(" + i.join("|") + ")", "i")),
+ (this._monthsShortStrictRegex = new RegExp("^(" + s.join("|") + ")", "i"))
+ }
+ function Ge(e) {
+ var t
+ if (e < 100 && 0 <= e) {
+ var n = Array.prototype.slice.call(arguments)
+ ;(n[0] = e + 400), (t = new Date(Date.UTC.apply(null, n))), isFinite(t.getUTCFullYear()) && t.setUTCFullYear(e)
+ } else t = new Date(Date.UTC.apply(null, arguments))
+ return t
+ }
+ function Ve(e, t, n) {
+ var s = 7 + t - n
+ return -((7 + Ge(e, 0, s).getUTCDay() - t) % 7) + s - 1
+ }
+ function Ee(e, t, n, s, i) {
+ var r,
+ a,
+ o = 1 + 7 * (t - 1) + ((7 + n - s) % 7) + Ve(e, s, i)
+ return (a = o <= 0 ? Se((r = e - 1)) + o : o > Se(e) ? ((r = e + 1), o - Se(e)) : ((r = e), o)), { year: r, dayOfYear: a }
+ }
+ function Ie(e, t, n) {
+ var s,
+ i,
+ r = Ve(e.year(), t, n),
+ a = Math.floor((e.dayOfYear() - r - 1) / 7) + 1
+ return (
+ a < 1 ? (s = a + Ae((i = e.year() - 1), t, n)) : a > Ae(e.year(), t, n) ? ((s = a - Ae(e.year(), t, n)), (i = e.year() + 1)) : ((i = e.year()), (s = a)), { week: s, year: i }
+ )
+ }
+ function Ae(e, t, n) {
+ var s = Ve(e, t, n),
+ i = Ve(e + 1, t, n)
+ return (Se(e) - s + i) / 7
+ }
+ I("w", ["ww", 2], "wo", "week"),
+ I("W", ["WW", 2], "Wo", "isoWeek"),
+ C("week", "w"),
+ C("isoWeek", "W"),
+ F("week", 5),
+ F("isoWeek", 5),
+ ue("w", B),
+ ue("ww", B, z),
+ ue("W", B),
+ ue("WW", B, z),
+ fe(["w", "ww", "W", "WW"], function (e, t, n, s) {
+ t[s.substr(0, 1)] = D(e)
+ })
+ function je(e, t) {
+ return e.slice(t, 7).concat(e.slice(0, t))
+ }
+ I("d", 0, "do", "day"),
+ I("dd", 0, 0, function (e) {
+ return this.localeData().weekdaysMin(this, e)
+ }),
+ I("ddd", 0, 0, function (e) {
+ return this.localeData().weekdaysShort(this, e)
+ }),
+ I("dddd", 0, 0, function (e) {
+ return this.localeData().weekdays(this, e)
+ }),
+ I("e", 0, 0, "weekday"),
+ I("E", 0, 0, "isoWeekday"),
+ C("day", "d"),
+ C("weekday", "e"),
+ C("isoWeekday", "E"),
+ F("day", 11),
+ F("weekday", 11),
+ F("isoWeekday", 11),
+ ue("d", B),
+ ue("e", B),
+ ue("E", B),
+ ue("dd", function (e, t) {
+ return t.weekdaysMinRegex(e)
+ }),
+ ue("ddd", function (e, t) {
+ return t.weekdaysShortRegex(e)
+ }),
+ ue("dddd", function (e, t) {
+ return t.weekdaysRegex(e)
+ }),
+ fe(["dd", "ddd", "dddd"], function (e, t, n, s) {
+ var i = n._locale.weekdaysParse(e, s, n._strict)
+ null != i ? (t.d = i) : (g(n).invalidWeekday = e)
+ }),
+ fe(["d", "e", "E"], function (e, t, n, s) {
+ t[s] = D(e)
+ })
+ var Ze = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_")
+ var ze = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_")
+ var $e = "Su_Mo_Tu_We_Th_Fr_Sa".split("_")
+ var qe = ae
+ var Je = ae
+ var Be = ae
+ function Qe() {
+ function e(e, t) {
+ return t.length - e.length
+ }
+ var t,
+ n,
+ s,
+ i,
+ r,
+ a = [],
+ o = [],
+ u = [],
+ l = []
+ for (t = 0; t < 7; t++)
+ (n = y([2e3, 1]).day(t)),
+ (s = this.weekdaysMin(n, "")),
+ (i = this.weekdaysShort(n, "")),
+ (r = this.weekdays(n, "")),
+ a.push(s),
+ o.push(i),
+ u.push(r),
+ l.push(s),
+ l.push(i),
+ l.push(r)
+ for (a.sort(e), o.sort(e), u.sort(e), l.sort(e), t = 0; t < 7; t++) (o[t] = he(o[t])), (u[t] = he(u[t])), (l[t] = he(l[t]))
+ ;(this._weekdaysRegex = new RegExp("^(" + l.join("|") + ")", "i")),
+ (this._weekdaysShortRegex = this._weekdaysRegex),
+ (this._weekdaysMinRegex = this._weekdaysRegex),
+ (this._weekdaysStrictRegex = new RegExp("^(" + u.join("|") + ")", "i")),
+ (this._weekdaysShortStrictRegex = new RegExp("^(" + o.join("|") + ")", "i")),
+ (this._weekdaysMinStrictRegex = new RegExp("^(" + a.join("|") + ")", "i"))
+ }
+ function Xe() {
+ return this.hours() % 12 || 12
+ }
+ function Ke(e, t) {
+ I(e, 0, 0, function () {
+ return this.localeData().meridiem(this.hours(), this.minutes(), t)
+ })
+ }
+ function et(e, t) {
+ return t._meridiemParse
+ }
+ I("H", ["HH", 2], 0, "hour"),
+ I("h", ["hh", 2], 0, Xe),
+ I("k", ["kk", 2], 0, function () {
+ return this.hours() || 24
+ }),
+ I("hmm", 0, 0, function () {
+ return "" + Xe.apply(this) + L(this.minutes(), 2)
+ }),
+ I("hmmss", 0, 0, function () {
+ return "" + Xe.apply(this) + L(this.minutes(), 2) + L(this.seconds(), 2)
+ }),
+ I("Hmm", 0, 0, function () {
+ return "" + this.hours() + L(this.minutes(), 2)
+ }),
+ I("Hmmss", 0, 0, function () {
+ return "" + this.hours() + L(this.minutes(), 2) + L(this.seconds(), 2)
+ }),
+ Ke("a", !0),
+ Ke("A", !1),
+ C("hour", "h"),
+ F("hour", 13),
+ ue("a", et),
+ ue("A", et),
+ ue("H", B),
+ ue("h", B),
+ ue("k", B),
+ ue("HH", B, z),
+ ue("hh", B, z),
+ ue("kk", B, z),
+ ue("hmm", Q),
+ ue("hmmss", X),
+ ue("Hmm", Q),
+ ue("Hmmss", X),
+ ce(["H", "HH"], ge),
+ ce(["k", "kk"], function (e, t, n) {
+ var s = D(e)
+ t[ge] = 24 === s ? 0 : s
+ }),
+ ce(["a", "A"], function (e, t, n) {
+ ;(n._isPm = n._locale.isPM(e)), (n._meridiem = e)
+ }),
+ ce(["h", "hh"], function (e, t, n) {
+ ;(t[ge] = D(e)), (g(n).bigHour = !0)
+ }),
+ ce("hmm", function (e, t, n) {
+ var s = e.length - 2
+ ;(t[ge] = D(e.substr(0, s))), (t[ve] = D(e.substr(s))), (g(n).bigHour = !0)
+ }),
+ ce("hmmss", function (e, t, n) {
+ var s = e.length - 4,
+ i = e.length - 2
+ ;(t[ge] = D(e.substr(0, s))), (t[ve] = D(e.substr(s, 2))), (t[pe] = D(e.substr(i))), (g(n).bigHour = !0)
+ }),
+ ce("Hmm", function (e, t, n) {
+ var s = e.length - 2
+ ;(t[ge] = D(e.substr(0, s))), (t[ve] = D(e.substr(s)))
+ }),
+ ce("Hmmss", function (e, t, n) {
+ var s = e.length - 4,
+ i = e.length - 2
+ ;(t[ge] = D(e.substr(0, s))), (t[ve] = D(e.substr(s, 2))), (t[pe] = D(e.substr(i)))
+ })
+ var tt,
+ nt = Te("Hours", !0),
+ st = {
+ calendar: { sameDay: "[Today at] LT", nextDay: "[Tomorrow at] LT", nextWeek: "dddd [at] LT", lastDay: "[Yesterday at] LT", lastWeek: "[Last] dddd [at] LT", sameElse: "L" },
+ longDateFormat: { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" },
+ invalidDate: "Invalid date",
+ ordinal: "%d",
+ dayOfMonthOrdinalParse: /\d{1,2}/,
+ relativeTime: {
+ future: "in %s",
+ past: "%s ago",
+ s: "a few seconds",
+ ss: "%d seconds",
+ m: "a minute",
+ mm: "%d minutes",
+ h: "an hour",
+ hh: "%d hours",
+ d: "a day",
+ dd: "%d days",
+ M: "a month",
+ MM: "%d months",
+ y: "a year",
+ yy: "%d years",
+ },
+ months: Ce,
+ monthsShort: He,
+ week: { dow: 0, doy: 6 },
+ weekdays: Ze,
+ weekdaysMin: $e,
+ weekdaysShort: ze,
+ meridiemParse: /[ap]\.?m?\.?/i,
+ },
+ it = {},
+ rt = {}
+ function at(e) {
+ return e ? e.toLowerCase().replace("_", "-") : e
+ }
+ function ot(e) {
+ var t = null
+ if (!it[e] && "undefined" != typeof module && module && module.exports)
+ try {
+ ;(t = tt._abbr), require("./locale/" + e), ut(t)
+ } catch (e) {}
+ return it[e]
+ }
+ function ut(e, t) {
+ var n
+ return (
+ e && ((n = l(t) ? ht(e) : lt(e, t)) ? (tt = n) : "undefined" != typeof console && console.warn && console.warn("Locale " + e + " not found. Did you forget to load it?")),
+ tt._abbr
+ )
+ }
+ function lt(e, t) {
+ if (null === t) return delete it[e], null
+ var n,
+ s = st
+ if (((t.abbr = e), null != it[e]))
+ T(
+ "defineLocaleOverride",
+ "use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."
+ ),
+ (s = it[e]._config)
+ else if (null != t.parentLocale)
+ if (null != it[t.parentLocale]) s = it[t.parentLocale]._config
+ else {
+ if (null == (n = ot(t.parentLocale))) return rt[t.parentLocale] || (rt[t.parentLocale] = []), rt[t.parentLocale].push({ name: e, config: t }), null
+ s = n._config
+ }
+ return (
+ (it[e] = new P(x(s, t))),
+ rt[e] &&
+ rt[e].forEach(function (e) {
+ lt(e.name, e.config)
+ }),
+ ut(e),
+ it[e]
+ )
+ }
+ function ht(e) {
+ var t
+ if ((e && e._locale && e._locale._abbr && (e = e._locale._abbr), !e)) return tt
+ if (!o(e)) {
+ if ((t = ot(e))) return t
+ e = [e]
+ }
+ return (function (e) {
+ for (var t, n, s, i, r = 0; r < e.length; ) {
+ for (t = (i = at(e[r]).split("-")).length, n = (n = at(e[r + 1])) ? n.split("-") : null; 0 < t; ) {
+ if ((s = ot(i.slice(0, t).join("-")))) return s
+ if (n && n.length >= t && a(i, n, !0) >= t - 1) break
+ t--
+ }
+ r++
+ }
+ return tt
+ })(e)
+ }
+ function dt(e) {
+ var t,
+ n = e._a
+ return (
+ n &&
+ -2 === g(e).overflow &&
+ ((t =
+ n[_e] < 0 || 11 < n[_e]
+ ? _e
+ : n[ye] < 1 || n[ye] > Pe(ne], n[_e])
+ ? ye
+ : n[ge] < 0 || 24 < n[ge] || (24 === n[ge] && (0 !== n[ve] || 0 !== n[pe] || 0 !== n[we]))
+ ? ge
+ : n[ve] < 0 || 59 < n[ve]
+ ? ve
+ : n[pe] < 0 || 59 < n[pe]
+ ? pe
+ : n[we] < 0 || 999 < n[we]
+ ? we
+ : -1),
+ g(e)._overflowDayOfYear && (t < me || ye < t) && (t = ye),
+ g(e)._overflowWeeks && -1 === t && (t = Me),
+ g(e)._overflowWeekday && -1 === t && (t = ke),
+ (g(e).overflow = t)),
+ e
+ )
+ }
+ function ct(e, t, n) {
+ return null != e ? e : null != t ? t : n
+ }
+ function ft(e) {
+ var t,
+ n,
+ s,
+ i,
+ r,
+ a = []
+ if (!e._d) {
+ var o, u
+ for (
+ o = e,
+ u = new Date(c.now()),
+ s = o._useUTC ? [u.getUTCFullYear(), u.getUTCMonth(), u.getUTCDate()] : [u.getFullYear(), u.getMonth(), u.getDate()],
+ e._w &&
+ null == e._a[ye] &&
+ null == e._a[_e] &&
+ (function (e) {
+ var t, n, s, i, r, a, o, u
+ if (null != (t = e._w).GG || null != t.W || null != t.E)
+ (r = 1), (a = 4), (n = ct(t.GG, e._ae], Ie(bt(), 1, 4).year)), (s = ct(t.W, 1)), ((i = ct(t.E, 1)) < 1 || 7 < i) && (u = !0)
+ else {
+ ;(r = e._locale._week.dow), (a = e._locale._week.doy)
+ var l = Ie(bt(), r, a)
+ ;(n = ct(t.gg, e._ae], l.year)),
+ (s = ct(t.w, l.week)),
+ null != t.d ? ((i = t.d) < 0 || 6 < i) && (u = !0) : null != t.e ? ((i = t.e + r), (t.e < 0 || 6 < t.e) && (u = !0)) : (i = r)
+ }
+ s < 1 || s > Ae(n, r, a)
+ ? (g(e)._overflowWeeks = !0)
+ : null != u
+ ? (g(e)._overflowWeekday = !0)
+ : ((o = Ee(n, s, i, r, a)), (e._ae] = o.year), (e._dayOfYear = o.dayOfYear))
+ })(e),
+ null != e._dayOfYear &&
+ ((r = ct(e._ae], se])),
+ (e._dayOfYear > Se(r) || 0 === e._dayOfYear) && (g(e)._overflowDayOfYear = !0),
+ (n = Ge(r, 0, e._dayOfYear)),
+ (e._a[_e] = n.getUTCMonth()),
+ (e._a[ye] = n.getUTCDate())),
+ t = 0;
+ t < 3 && null == e._a[t];
+ ++t
+ )
+ e._a[t] = a[t] = s[t]
+ for (; t < 7; t++) e._a[t] = a[t] = null == e._a[t] ? (2 === t ? 1 : 0) : e._a[t]
+ 24 === e._a[ge] && 0 === e._a[ve] && 0 === e._a[pe] && 0 === e._a[we] && ((e._nextDay = !0), (e._a[ge] = 0)),
+ (e._d = (
+ e._useUTC
+ ? Ge
+ : function (e, t, n, s, i, r, a) {
+ var o
+ return e < 100 && 0 <= e ? ((o = new Date(e + 400, t, n, s, i, r, a)), isFinite(o.getFullYear()) && o.setFullYear(e)) : (o = new Date(e, t, n, s, i, r, a)), o
+ }
+ ).apply(null, a)),
+ (i = e._useUTC ? e._d.getUTCDay() : e._d.getDay()),
+ null != e._tzm && e._d.setUTCMinutes(e._d.getUTCMinutes() - e._tzm),
+ e._nextDay && (e._a[ge] = 24),
+ e._w && void 0 !== e._w.d && e._w.d !== i && (g(e).weekdayMismatch = !0)
+ }
+ }
+ var mt = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
+ _t = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
+ yt = /Z|[+-]\d\d(?::?\d\d)?/,
+ gt = [
+ ["YYYYYY-MM-DD", /[+-]\d{6}-\d\d-\d\d/],
+ ["YYYY-MM-DD", /\d{4}-\d\d-\d\d/],
+ ["GGGG-[W]WW-E", /\d{4}-W\d\d-\d/],
+ ["GGGG-[W]WW", /\d{4}-W\d\d/, !1],
+ ["YYYY-DDD", /\d{4}-\d{3}/],
+ ["YYYY-MM", /\d{4}-\d\d/, !1],
+ ["YYYYYYMMDD", /[+-]\d{10}/],
+ ["YYYYMMDD", /\d{8}/],
+ ["GGGG[W]WWE", /\d{4}W\d{3}/],
+ ["GGGG[W]WW", /\d{4}W\d{2}/, !1],
+ ["YYYYDDD", /\d{7}/],
+ ],
+ vt = [
+ ["HH:mm:ss.SSSS", /\d\d:\d\d:\d\d\.\d+/],
+ ["HH:mm:ss,SSSS", /\d\d:\d\d:\d\d,\d+/],
+ ["HH:mm:ss", /\d\d:\d\d:\d\d/],
+ ["HH:mm", /\d\d:\d\d/],
+ ["HHmmss.SSSS", /\d\d\d\d\d\d\.\d+/],
+ ["HHmmss,SSSS", /\d\d\d\d\d\d,\d+/],
+ ["HHmmss", /\d\d\d\d\d\d/],
+ ["HHmm", /\d\d\d\d/],
+ ["HH", /\d\d/],
+ ],
+ pt = /^\/?Date\((\-?\d+)/i
+ function wt(e) {
+ var t,
+ n,
+ s,
+ i,
+ r,
+ a,
+ o = e._i,
+ u = mt.exec(o) || _t.exec(o)
+ if (u) {
+ for (g(e).iso = !0, t = 0, n = gt.length; t < n; t++)
+ if (gt[t][1].exec(u[1])) {
+ ;(i = gt[t][0]), (s = !1 !== gt[t][2])
+ break
+ }
+ if (null == i) return void (e._isValid = !1)
+ if (u[3]) {
+ for (t = 0, n = vt.length; t < n; t++)
+ if (vt[t][1].exec(u[3])) {
+ r = (u[2] || " ") + vt[t][0]
+ break
+ }
+ if (null == r) return void (e._isValid = !1)
+ }
+ if (!s && null != r) return void (e._isValid = !1)
+ if (u[4]) {
+ if (!yt.exec(u[4])) return void (e._isValid = !1)
+ a = "Z"
+ }
+ ;(e._f = i + (r || "") + (a || "")), Yt(e)
+ } else e._isValid = !1
+ }
+ var Mt =
+ /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/
+ function kt(e, t, n, s, i, r) {
+ var a = [
+ (function (e) {
+ var t = parseInt(e, 10)
+ {
+ if (t <= 49) return 2e3 + t
+ if (t <= 999) return 1900 + t
+ }
+ return t
+ })(e),
+ He.indexOf(t),
+ parseInt(n, 10),
+ parseInt(s, 10),
+ parseInt(i, 10),
+ ]
+ return r && a.push(parseInt(r, 10)), a
+ }
+ var St = { UT: 0, GMT: 0, EDT: -240, EST: -300, CDT: -300, CST: -360, MDT: -360, MST: -420, PDT: -420, PST: -480 }
+ function Dt(e) {
+ var t,
+ n,
+ s,
+ i = Mt.exec(
+ e._i
+ .replace(/\([^)]*\)|[\n\t]/g, " ")
+ .replace(/(\s\s+)/g, " ")
+ .replace(/^\s\s*/, "")
+ .replace(/\s\s*$/, "")
+ )
+ if (i) {
+ var r = kt(i[4], i[3], i[2], i[5], i[6], i[7])
+ if (((t = i[1]), (n = r), (s = e), t && ze.indexOf(t) !== new Date(n[0], n[1], n[2]).getDay() && ((g(s).weekdayMismatch = !0), !(s._isValid = !1)))) return
+ ;(e._a = r),
+ (e._tzm = (function (e, t, n) {
+ if (e) return St[e]
+ if (t) return 0
+ var s = parseInt(n, 10),
+ i = s % 100
+ return ((s - i) / 100) * 60 + i
+ })(i[8], i[9], i[10])),
+ (e._d = Ge.apply(null, e._a)),
+ e._d.setUTCMinutes(e._d.getUTCMinutes() - e._tzm),
+ (g(e).rfc2822 = !0)
+ } else e._isValid = !1
+ }
+ function Yt(e) {
+ if (e._f !== c.ISO_8601)
+ if (e._f !== c.RFC_2822) {
+ ;(e._a = []), (g(e).empty = !0)
+ var t,
+ n,
+ s,
+ i,
+ r,
+ a,
+ o,
+ u,
+ l = "" + e._i,
+ h = l.length,
+ d = 0
+ for (s = j(e._f, e._locale).match(N) || [], t = 0; t < s.length; t++)
+ (i = s[t]),
+ (n = (l.match(le(i, e)) || [])[0]) && (0 < (r = l.substr(0, l.indexOf(n))).length && g(e).unusedInput.push(r), (l = l.slice(l.indexOf(n) + n.length)), (d += n.length)),
+ E[i]
+ ? (n ? (g(e).empty = !1) : g(e).unusedTokens.push(i), (a = i), (u = e), null != (o = n) && m(de, a) && de[a](o, u._a, u, a))
+ : e._strict && !n && g(e).unusedTokens.push(i)
+ ;(g(e).charsLeftOver = h - d),
+ 0 < l.length && g(e).unusedInput.push(l),
+ e._a[ge] <= 12 && !0 === g(e).bigHour && 0 < e._a[ge] && (g(e).bigHour = void 0),
+ (g(e).parsedDateParts = e._a.slice(0)),
+ (g(e).meridiem = e._meridiem),
+ (e._a[ge] = (function (e, t, n) {
+ var s
+ if (null == n) return t
+ return null != e.meridiemHour ? e.meridiemHour(t, n) : (null != e.isPM && ((s = e.isPM(n)) && t < 12 && (t += 12), s || 12 !== t || (t = 0)), t)
+ })(e._locale, e._a[ge], e._meridiem)),
+ ft(e),
+ dt(e)
+ } else Dt(e)
+ else wt(e)
+ }
+ function Ot(e) {
+ var t,
+ n,
+ s,
+ i,
+ r = e._i,
+ a = e._f
+ return (
+ (e._locale = e._locale || ht(e._l)),
+ null === r || (void 0 === a && "" === r)
+ ? p({ nullInput: !0 })
+ : ("string" == typeof r && (e._i = r = e._locale.preparse(r)),
+ k(r)
+ ? new M(dt(r))
+ : (d(r)
+ ? (e._d = r)
+ : o(a)
+ ? (function (e) {
+ var t, n, s, i, r
+ if (0 === e._f.length) return (g(e).invalidFormat = !0), (e._d = new Date(NaN))
+ for (i = 0; i < e._f.length; i++)
+ (r = 0),
+ (t = w({}, e)),
+ null != e._useUTC && (t._useUTC = e._useUTC),
+ (t._f = e._f[i]),
+ Yt(t),
+ v(t) && ((r += g(t).charsLeftOver), (r += 10 * g(t).unusedTokens.length), (g(t).score = r), (null == s || r < s) && ((s = r), (n = t)))
+ _(e, n || t)
+ })(e)
+ : a
+ ? Yt(e)
+ : l((n = (t = e)._i))
+ ? (t._d = new Date(c.now()))
+ : d(n)
+ ? (t._d = new Date(n.valueOf()))
+ : "string" == typeof n
+ ? ((s = t),
+ null === (i = pt.exec(s._i))
+ ? (wt(s), !1 === s._isValid && (delete s._isValid, Dt(s), !1 === s._isValid && (delete s._isValid, c.createFromInputFallback(s))))
+ : (s._d = new Date(+i[1])))
+ : o(n)
+ ? ((t._a = f(n.slice(0), function (e) {
+ return parseInt(e, 10)
+ })),
+ ft(t))
+ : u(n)
+ ? (function (e) {
+ if (!e._d) {
+ var t = R(e._i)
+ ;(e._a = f([t.year, t.month, t.day || t.date, t.hour, t.minute, t.second, t.millisecond], function (e) {
+ return e && parseInt(e, 10)
+ })),
+ ft(e)
+ }
+ })(t)
+ : h(n)
+ ? (t._d = new Date(n))
+ : c.createFromInputFallback(t),
+ v(e) || (e._d = null),
+ e))
+ )
+ }
+ function Tt(e, t, n, s, i) {
+ var r,
+ a = {}
+ return (
+ (!0 !== n && !1 !== n) || ((s = n), (n = void 0)),
+ ((u(e) &&
+ (function (e) {
+ if (Object.getOwnPropertyNames) return 0 === Object.getOwnPropertyNames(e).length
+ var t
+ for (t in e) if (e.hasOwnProperty(t)) return !1
+ return !0
+ })(e)) ||
+ (o(e) && 0 === e.length)) &&
+ (e = void 0),
+ (a._isAMomentObject = !0),
+ (a._useUTC = a._isUTC = i),
+ (a._l = n),
+ (a._i = e),
+ (a._f = t),
+ (a._strict = s),
+ (r = new M(dt(Ot(a))))._nextDay && (r.add(1, "d"), (r._nextDay = void 0)),
+ r
+ )
+ }
+ function bt(e, t, n, s) {
+ return Tt(e, t, n, s, !1)
+ }
+ ;(c.createFromInputFallback = n(
+ "value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",
+ function (e) {
+ e._d = new Date(e._i + (e._useUTC ? " UTC" : ""))
+ }
+ )),
+ (c.ISO_8601 = function () {}),
+ (c.RFC_2822 = function () {})
+ var xt = n("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/", function () {
+ var e = bt.apply(null, arguments)
+ return this.isValid() && e.isValid() ? (e < this ? this : e) : p()
+ }),
+ Pt = n("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/", function () {
+ var e = bt.apply(null, arguments)
+ return this.isValid() && e.isValid() ? (this < e ? this : e) : p()
+ })
+ function Wt(e, t) {
+ var n, s
+ if ((1 === t.length && o(t[0]) && (t = t[0]), !t.length)) return bt()
+ for (n = t[0], s = 1; s < t.length; ++s) (t[s].isValid() && !t[s][e](n)) || (n = t[s])
+ return n
+ }
+ var Ct = ["year", "quarter", "month", "week", "day", "hour", "minute", "second", "millisecond"]
+ function Ht(e) {
+ var t = R(e),
+ n = t.year || 0,
+ s = t.quarter || 0,
+ i = t.month || 0,
+ r = t.week || t.isoWeek || 0,
+ a = t.day || 0,
+ o = t.hour || 0,
+ u = t.minute || 0,
+ l = t.second || 0,
+ h = t.millisecond || 0
+ ;(this._isValid = (function (e) {
+ for (var t in e) if (-1 === Ye.call(Ct, t) || (null != e[t] && isNaN(e[t]))) return !1
+ for (var n = !1, s = 0; s < Ct.length; ++s)
+ if (e[Ct[s]]) {
+ if (n) return !1
+ parseFloat(e[Ct[s]]) !== D(e[Ct[s]]) && (n = !0)
+ }
+ return !0
+ })(t)),
+ (this._milliseconds = +h + 1e3 * l + 6e4 * u + 1e3 * o * 60 * 60),
+ (this._days = +a + 7 * r),
+ (this._months = +i + 3 * s + 12 * n),
+ (this._data = {}),
+ (this._locale = ht()),
+ this._bubble()
+ }
+ function Rt(e) {
+ return e instanceof Ht
+ }
+ function Ut(e) {
+ return e < 0 ? -1 * Math.round(-1 * e) : Math.round(e)
+ }
+ function Ft(e, n) {
+ I(e, 0, 0, function () {
+ var e = this.utcOffset(),
+ t = "+"
+ return e < 0 && ((e = -e), (t = "-")), t + L(~~(e / 60), 2) + n + L(~~e % 60, 2)
+ })
+ }
+ Ft("Z", ":"),
+ Ft("ZZ", ""),
+ ue("Z", re),
+ ue("ZZ", re),
+ ce(["Z", "ZZ"], function (e, t, n) {
+ ;(n._useUTC = !0), (n._tzm = Nt(re, e))
+ })
+ var Lt = /([\+\-]|\d\d)/gi
+ function Nt(e, t) {
+ var n = (t || "").match(e)
+ if (null === n) return null
+ var s = ((n[n.length - 1] || []) + "").match(Lt) || ["-", 0, 0],
+ i = 60 * s[1] + D(s[2])
+ return 0 === i ? 0 : "+" === s[0] ? i : -i
+ }
+ function Gt(e, t) {
+ var n, s
+ return t._isUTC
+ ? ((n = t.clone()), (s = (k(e) || d(e) ? e.valueOf() : bt(e).valueOf()) - n.valueOf()), n._d.setTime(n._d.valueOf() + s), c.updateOffset(n, !1), n)
+ : bt(e).local()
+ }
+ function Vt(e) {
+ return 15 * -Math.round(e._d.getTimezoneOffset() / 15)
+ }
+ function Et() {
+ return !!this.isValid() && this._isUTC && 0 === this._offset
+ }
+ c.updateOffset = function () {}
+ var It = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,
+ At = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/
+ function jt(e, t) {
+ var n,
+ s,
+ i,
+ r = e,
+ a = null
+ return (
+ Rt(e)
+ ? (r = { ms: e._milliseconds, d: e._days, M: e._months })
+ : h(e)
+ ? ((r = {}), t ? (r[t] = e) : (r.milliseconds = e))
+ : (a = It.exec(e))
+ ? ((n = "-" === a[1] ? -1 : 1), (r = { y: 0, d: D(a[ye]) * n, h: D(a[ge]) * n, m: D(a[ve]) * n, s: D(a[pe]) * n, ms: D(Ut(1e3 * a[we])) * n }))
+ : (a = At.exec(e))
+ ? ((n = "-" === a[1] ? -1 : 1), (r = { y: Zt(a[2], n), M: Zt(a[3], n), w: Zt(a[4], n), d: Zt(a[5], n), h: Zt(a[6], n), m: Zt(a[7], n), s: Zt(a[8], n) }))
+ : null == r
+ ? (r = {})
+ : "object" == typeof r &&
+ ("from" in r || "to" in r) &&
+ ((i = (function (e, t) {
+ var n
+ if (!e.isValid() || !t.isValid()) return { milliseconds: 0, months: 0 }
+ ;(t = Gt(t, e)), e.isBefore(t) ? (n = zt(e, t)) : (((n = zt(t, e)).milliseconds = -n.milliseconds), (n.months = -n.months))
+ return n
+ })(bt(r.from), bt(r.to))),
+ ((r = {}).ms = i.milliseconds),
+ (r.M = i.months)),
+ (s = new Ht(r)),
+ Rt(e) && m(e, "_locale") && (s._locale = e._locale),
+ s
+ )
+ }
+ function Zt(e, t) {
+ var n = e && parseFloat(e.replace(",", "."))
+ return (isNaN(n) ? 0 : n) * t
+ }
+ function zt(e, t) {
+ var n = {}
+ return (
+ (n.months = t.month() - e.month() + 12 * (t.year() - e.year())),
+ e.clone().add(n.months, "M").isAfter(t) && --n.months,
+ (n.milliseconds = +t - +e.clone().add(n.months, "M")),
+ n
+ )
+ }
+ function $t(s, i) {
+ return function (e, t) {
+ var n
+ return (
+ null === t ||
+ isNaN(+t) ||
+ (T(
+ i,
+ "moment()." +
+ i +
+ "(period, number) is deprecated. Please use moment()." +
+ i +
+ "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."
+ ),
+ (n = e),
+ (e = t),
+ (t = n)),
+ qt(this, jt((e = "string" == typeof e ? +e : e), t), s),
+ this
+ )
+ }
+ }
+ function qt(e, t, n, s) {
+ var i = t._milliseconds,
+ r = Ut(t._days),
+ a = Ut(t._months)
+ e.isValid() &&
+ ((s = null == s || s),
+ a && Re(e, be(e, "Month") + a * n),
+ r && xe(e, "Date", be(e, "Date") + r * n),
+ i && e._d.setTime(e._d.valueOf() + i * n),
+ s && c.updateOffset(e, r || a))
+ }
+ ;(jt.fn = Ht.prototype),
+ (jt.invalid = function () {
+ return jt(NaN)
+ })
+ var Jt = $t(1, "add"),
+ Bt = $t(-1, "subtract")
+ function Qt(e, t) {
+ var n = 12 * (t.year() - e.year()) + (t.month() - e.month()),
+ s = e.clone().add(n, "months")
+ return -(n + (t - s < 0 ? (t - s) / (s - e.clone().add(n - 1, "months")) : (t - s) / (e.clone().add(n + 1, "months") - s))) || 0
+ }
+ function Xt(e) {
+ var t
+ return void 0 === e ? this._locale._abbr : (null != (t = ht(e)) && (this._locale = t), this)
+ }
+ ;(c.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ"), (c.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]")
+ var Kt = n("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.", function (e) {
+ return void 0 === e ? this.localeData() : this.locale(e)
+ })
+ function en() {
+ return this._locale
+ }
+ var tn = 126227808e5
+ function nn(e, t) {
+ return ((e % t) + t) % t
+ }
+ function sn(e, t, n) {
+ return e < 100 && 0 <= e ? new Date(e + 400, t, n) - tn : new Date(e, t, n).valueOf()
+ }
+ function rn(e, t, n) {
+ return e < 100 && 0 <= e ? Date.UTC(e + 400, t, n) - tn : Date.UTC(e, t, n)
+ }
+ function an(e, t) {
+ I(0, [e, e.length], 0, t)
+ }
+ function on(e, t, n, s, i) {
+ var r
+ return null == e
+ ? Ie(this, s, i).year
+ : ((r = Ae(e, s, i)) < t && (t = r),
+ function (e, t, n, s, i) {
+ var r = Ee(e, t, n, s, i),
+ a = Ge(r.year, 0, r.dayOfYear)
+ return this.year(a.getUTCFullYear()), this.month(a.getUTCMonth()), this.date(a.getUTCDate()), this
+ }.call(this, e, t, n, s, i))
+ }
+ I(0, ["gg", 2], 0, function () {
+ return this.weekYear() % 100
+ }),
+ I(0, ["GG", 2], 0, function () {
+ return this.isoWeekYear() % 100
+ }),
+ an("gggg", "weekYear"),
+ an("ggggg", "weekYear"),
+ an("GGGG", "isoWeekYear"),
+ an("GGGGG", "isoWeekYear"),
+ C("weekYear", "gg"),
+ C("isoWeekYear", "GG"),
+ F("weekYear", 1),
+ F("isoWeekYear", 1),
+ ue("G", se),
+ ue("g", se),
+ ue("GG", B, z),
+ ue("gg", B, z),
+ ue("GGGG", ee, q),
+ ue("gggg", ee, q),
+ ue("GGGGG", te, J),
+ ue("ggggg", te, J),
+ fe(["gggg", "ggggg", "GGGG", "GGGGG"], function (e, t, n, s) {
+ t[s.substr(0, 2)] = D(e)
+ }),
+ fe(["gg", "GG"], function (e, t, n, s) {
+ t[s] = c.parseTwoDigitYear(e)
+ }),
+ I("Q", 0, "Qo", "quarter"),
+ C("quarter", "Q"),
+ F("quarter", 7),
+ ue("Q", Z),
+ ce("Q", function (e, t) {
+ t[_e] = 3 * (D(e) - 1)
+ }),
+ I("D", ["DD", 2], "Do", "date"),
+ C("date", "D"),
+ F("date", 9),
+ ue("D", B),
+ ue("DD", B, z),
+ ue("Do", function (e, t) {
+ return e ? t._dayOfMonthOrdinalParse || t._ordinalParse : t._dayOfMonthOrdinalParseLenient
+ }),
+ ce(["D", "DD"], ye),
+ ce("Do", function (e, t) {
+ t[ye] = D(e.match(B)[0])
+ })
+ var un = Te("Date", !0)
+ I("DDD", ["DDDD", 3], "DDDo", "dayOfYear"),
+ C("dayOfYear", "DDD"),
+ F("dayOfYear", 4),
+ ue("DDD", K),
+ ue("DDDD", $),
+ ce(["DDD", "DDDD"], function (e, t, n) {
+ n._dayOfYear = D(e)
+ }),
+ I("m", ["mm", 2], 0, "minute"),
+ C("minute", "m"),
+ F("minute", 14),
+ ue("m", B),
+ ue("mm", B, z),
+ ce(["m", "mm"], ve)
+ var ln = Te("Minutes", !1)
+ I("s", ["ss", 2], 0, "second"), C("second", "s"), F("second", 15), ue("s", B), ue("ss", B, z), ce(["s", "ss"], pe)
+ var hn,
+ dn = Te("Seconds", !1)
+ for (
+ I("S", 0, 0, function () {
+ return ~~(this.millisecond() / 100)
+ }),
+ I(0, ["SS", 2], 0, function () {
+ return ~~(this.millisecond() / 10)
+ }),
+ I(0, ["SSS", 3], 0, "millisecond"),
+ I(0, ["SSSS", 4], 0, function () {
+ return 10 * this.millisecond()
+ }),
+ I(0, ["SSSSS", 5], 0, function () {
+ return 100 * this.millisecond()
+ }),
+ I(0, ["SSSSSS", 6], 0, function () {
+ return 1e3 * this.millisecond()
+ }),
+ I(0, ["SSSSSSS", 7], 0, function () {
+ return 1e4 * this.millisecond()
+ }),
+ I(0, ["SSSSSSSS", 8], 0, function () {
+ return 1e5 * this.millisecond()
+ }),
+ I(0, ["SSSSSSSSS", 9], 0, function () {
+ return 1e6 * this.millisecond()
+ }),
+ C("millisecond", "ms"),
+ F("millisecond", 16),
+ ue("S", K, Z),
+ ue("SS", K, z),
+ ue("SSS", K, $),
+ hn = "SSSS";
+ hn.length <= 9;
+ hn += "S"
+ )
+ ue(hn, ne)
+ function cn(e, t) {
+ t[we] = D(1e3 * ("0." + e))
+ }
+ for (hn = "S"; hn.length <= 9; hn += "S") ce(hn, cn)
+ var fn = Te("Milliseconds", !1)
+ I("z", 0, 0, "zoneAbbr"), I("zz", 0, 0, "zoneName")
+ var mn = M.prototype
+ function _n(e) {
+ return e
+ }
+ ;(mn.add = Jt),
+ (mn.calendar = function (e, t) {
+ var n = e || bt(),
+ s = Gt(n, this).startOf("day"),
+ i = c.calendarFormat(this, s) || "sameElse",
+ r = t && (b(t[i]) ? t[i].call(this, n) : t[i])
+ return this.format(r || this.localeData().calendar(i, this, bt(n)))
+ }),
+ (mn.clone = function () {
+ return new M(this)
+ }),
+ (mn.diff = function (e, t, n) {
+ var s, i, r
+ if (!this.isValid()) return NaN
+ if (!(s = Gt(e, this)).isValid()) return NaN
+ switch (((i = 6e4 * (s.utcOffset() - this.utcOffset())), (t = H(t)))) {
+ case "year":
+ r = Qt(this, s) / 12
+ break
+ case "month":
+ r = Qt(this, s)
+ break
+ case "quarter":
+ r = Qt(this, s) / 3
+ break
+ case "second":
+ r = (this - s) / 1e3
+ break
+ case "minute":
+ r = (this - s) / 6e4
+ break
+ case "hour":
+ r = (this - s) / 36e5
+ break
+ case "day":
+ r = (this - s - i) / 864e5
+ break
+ case "week":
+ r = (this - s - i) / 6048e5
+ break
+ default:
+ r = this - s
+ }
+ return n ? r : S(r)
+ }),
+ (mn.endOf = function (e) {
+ var t
+ if (void 0 === (e = H(e)) || "millisecond" === e || !this.isValid()) return this
+ var n = this._isUTC ? rn : sn
+ switch (e) {
+ case "year":
+ t = n(this.year() + 1, 0, 1) - 1
+ break
+ case "quarter":
+ t = n(this.year(), this.month() - (this.month() % 3) + 3, 1) - 1
+ break
+ case "month":
+ t = n(this.year(), this.month() + 1, 1) - 1
+ break
+ case "week":
+ t = n(this.year(), this.month(), this.date() - this.weekday() + 7) - 1
+ break
+ case "isoWeek":
+ t = n(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1
+ break
+ case "day":
+ case "date":
+ t = n(this.year(), this.month(), this.date() + 1) - 1
+ break
+ case "hour":
+ ;(t = this._d.valueOf()), (t += 36e5 - nn(t + (this._isUTC ? 0 : 6e4 * this.utcOffset()), 36e5) - 1)
+ break
+ case "minute":
+ ;(t = this._d.valueOf()), (t += 6e4 - nn(t, 6e4) - 1)
+ break
+ case "second":
+ ;(t = this._d.valueOf()), (t += 1e3 - nn(t, 1e3) - 1)
+ break
+ }
+ return this._d.setTime(t), c.updateOffset(this, !0), this
+ }),
+ (mn.format = function (e) {
+ e || (e = this.isUtc() ? c.defaultFormatUtc : c.defaultFormat)
+ var t = A(this, e)
+ return this.localeData().postformat(t)
+ }),
+ (mn.from = function (e, t) {
+ return this.isValid() && ((k(e) && e.isValid()) || bt(e).isValid()) ? jt({ to: this, from: e }).locale(this.locale()).humanize(!t) : this.localeData().invalidDate()
+ }),
+ (mn.fromNow = function (e) {
+ return this.from(bt(), e)
+ }),
+ (mn.to = function (e, t) {
+ return this.isValid() && ((k(e) && e.isValid()) || bt(e).isValid()) ? jt({ from: this, to: e }).locale(this.locale()).humanize(!t) : this.localeData().invalidDate()
+ }),
+ (mn.toNow = function (e) {
+ return this.to(bt(), e)
+ }),
+ (mn.get = function (e) {
+ return b(this[(e = H(e))]) ? this[e]() : this
+ }),
+ (mn.invalidAt = function () {
+ return g(this).overflow
+ }),
+ (mn.isAfter = function (e, t) {
+ var n = k(e) ? e : bt(e)
+ return !(!this.isValid() || !n.isValid()) && ("millisecond" === (t = H(t) || "millisecond") ? this.valueOf() > n.valueOf() : n.valueOf() < this.clone().startOf(t).valueOf())
+ }),
+ (mn.isBefore = function (e, t) {
+ var n = k(e) ? e : bt(e)
+ return !(!this.isValid() || !n.isValid()) && ("millisecond" === (t = H(t) || "millisecond") ? this.valueOf() < n.valueOf() : this.clone().endOf(t).valueOf() < n.valueOf())
+ }),
+ (mn.isBetween = function (e, t, n, s) {
+ var i = k(e) ? e : bt(e),
+ r = k(t) ? t : bt(t)
+ return (
+ !!(this.isValid() && i.isValid() && r.isValid()) &&
+ ("(" === (s = s || "()")[0] ? this.isAfter(i, n) : !this.isBefore(i, n)) &&
+ (")" === s[1] ? this.isBefore(r, n) : !this.isAfter(r, n))
+ )
+ }),
+ (mn.isSame = function (e, t) {
+ var n,
+ s = k(e) ? e : bt(e)
+ return (
+ !(!this.isValid() || !s.isValid()) &&
+ ("millisecond" === (t = H(t) || "millisecond")
+ ? this.valueOf() === s.valueOf()
+ : ((n = s.valueOf()), this.clone().startOf(t).valueOf() <= n && n <= this.clone().endOf(t).valueOf()))
+ )
+ }),
+ (mn.isSameOrAfter = function (e, t) {
+ return this.isSame(e, t) || this.isAfter(e, t)
+ }),
+ (mn.isSameOrBefore = function (e, t) {
+ return this.isSame(e, t) || this.isBefore(e, t)
+ }),
+ (mn.isValid = function () {
+ return v(this)
+ }),
+ (mn.lang = Kt),
+ (mn.locale = Xt),
+ (mn.localeData = en),
+ (mn.max = Pt),
+ (mn.min = xt),
+ (mn.parsingFlags = function () {
+ return _({}, g(this))
+ }),
+ (mn.set = function (e, t) {
+ if ("object" == typeof e)
+ for (
+ var n = (function (e) {
+ var t = []
+ for (var n in e) t.push({ unit: n, priority: U[n] })
+ return (
+ t.sort(function (e, t) {
+ return e.priority - t.priority
+ }),
+ t
+ )
+ })((e = R(e))),
+ s = 0;
+ s < n.length;
+ s++
+ )
+ this[n[s].unit](e[n[s].unit])
+ else if (b(this[(e = H(e))])) return this[e](t)
+ return this
+ }),
+ (mn.startOf = function (e) {
+ var t
+ if (void 0 === (e = H(e)) || "millisecond" === e || !this.isValid()) return this
+ var n = this._isUTC ? rn : sn
+ switch (e) {
+ case "year":
+ t = n(this.year(), 0, 1)
+ break
+ case "quarter":
+ t = n(this.year(), this.month() - (this.month() % 3), 1)
+ break
+ case "month":
+ t = n(this.year(), this.month(), 1)
+ break
+ case "week":
+ t = n(this.year(), this.month(), this.date() - this.weekday())
+ break
+ case "isoWeek":
+ t = n(this.year(), this.month(), this.date() - (this.isoWeekday() - 1))
+ break
+ case "day":
+ case "date":
+ t = n(this.year(), this.month(), this.date())
+ break
+ case "hour":
+ ;(t = this._d.valueOf()), (t -= nn(t + (this._isUTC ? 0 : 6e4 * this.utcOffset()), 36e5))
+ break
+ case "minute":
+ ;(t = this._d.valueOf()), (t -= nn(t, 6e4))
+ break
+ case "second":
+ ;(t = this._d.valueOf()), (t -= nn(t, 1e3))
+ break
+ }
+ return this._d.setTime(t), c.updateOffset(this, !0), this
+ }),
+ (mn.subtract = Bt),
+ (mn.toArray = function () {
+ var e = this
+ return [e.year(), e.month(), e.date(), e.hour(), e.minute(), e.second(), e.millisecond()]
+ }),
+ (mn.toObject = function () {
+ var e = this
+ return { years: e.year(), months: e.month(), date: e.date(), hours: e.hours(), minutes: e.minutes(), seconds: e.seconds(), milliseconds: e.milliseconds() }
+ }),
+ (mn.toDate = function () {
+ return new Date(this.valueOf())
+ }),
+ (mn.toISOString = function (e) {
+ if (!this.isValid()) return null
+ var t = !0 !== e,
+ n = t ? this.clone().utc() : this
+ return n.year() < 0 || 9999 < n.year()
+ ? A(n, t ? "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYYYY-MM-DD[T]HH:mm:ss.SSSZ")
+ : b(Date.prototype.toISOString)
+ ? t
+ ? this.toDate().toISOString()
+ : new Date(this.valueOf() + 60 * this.utcOffset() * 1e3).toISOString().replace("Z", A(n, "Z"))
+ : A(n, t ? "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYY-MM-DD[T]HH:mm:ss.SSSZ")
+ }),
+ (mn.inspect = function () {
+ if (!this.isValid()) return "moment.invalid(/* " + this._i + " */)"
+ var e = "moment",
+ t = ""
+ this.isLocal() || ((e = 0 === this.utcOffset() ? "moment.utc" : "moment.parseZone"), (t = "Z"))
+ var n = "[" + e + '("]',
+ s = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY",
+ i = t + '[")]'
+ return this.format(n + s + "-MM-DD[T]HH:mm:ss.SSS" + i)
+ }),
+ (mn.toJSON = function () {
+ return this.isValid() ? this.toISOString() : null
+ }),
+ (mn.toString = function () {
+ return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")
+ }),
+ (mn.unix = function () {
+ return Math.floor(this.valueOf() / 1e3)
+ }),
+ (mn.valueOf = function () {
+ return this._d.valueOf() - 6e4 * (this._offset || 0)
+ }),
+ (mn.creationData = function () {
+ return { input: this._i, format: this._f, locale: this._locale, isUTC: this._isUTC, strict: this._strict }
+ }),
+ (mn.year = Oe),
+ (mn.isLeapYear = function () {
+ return De(this.year())
+ }),
+ (mn.weekYear = function (e) {
+ return on.call(this, e, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy)
+ }),
+ (mn.isoWeekYear = function (e) {
+ return on.call(this, e, this.isoWeek(), this.isoWeekday(), 1, 4)
+ }),
+ (mn.quarter = mn.quarters =
+ function (e) {
+ return null == e ? Math.ceil((this.month() + 1) / 3) : this.month(3 * (e - 1) + (this.month() % 3))
+ }),
+ (mn.month = Ue),
+ (mn.daysInMonth = function () {
+ return Pe(this.year(), this.month())
+ }),
+ (mn.week = mn.weeks =
+ function (e) {
+ var t = this.localeData().week(this)
+ return null == e ? t : this.add(7 * (e - t), "d")
+ }),
+ (mn.isoWeek = mn.isoWeeks =
+ function (e) {
+ var t = Ie(this, 1, 4).week
+ return null == e ? t : this.add(7 * (e - t), "d")
+ }),
+ (mn.weeksInYear = function () {
+ var e = this.localeData()._week
+ return Ae(this.year(), e.dow, e.doy)
+ }),
+ (mn.isoWeeksInYear = function () {
+ return Ae(this.year(), 1, 4)
+ }),
+ (mn.date = un),
+ (mn.day = mn.days =
+ function (e) {
+ if (!this.isValid()) return null != e ? this : NaN
+ var t,
+ n,
+ s = this._isUTC ? this._d.getUTCDay() : this._d.getDay()
+ return null != e
+ ? ((t = e),
+ (n = this.localeData()),
+ (e = "string" != typeof t ? t : isNaN(t) ? ("number" == typeof (t = n.weekdaysParse(t)) ? t : null) : parseInt(t, 10)),
+ this.add(e - s, "d"))
+ : s
+ }),
+ (mn.weekday = function (e) {
+ if (!this.isValid()) return null != e ? this : NaN
+ var t = (this.day() + 7 - this.localeData()._week.dow) % 7
+ return null == e ? t : this.add(e - t, "d")
+ }),
+ (mn.isoWeekday = function (e) {
+ if (!this.isValid()) return null != e ? this : NaN
+ if (null == e) return this.day() || 7
+ var t,
+ n,
+ s = ((t = e), (n = this.localeData()), "string" == typeof t ? n.weekdaysParse(t) % 7 || 7 : isNaN(t) ? null : t)
+ return this.day(this.day() % 7 ? s : s - 7)
+ }),
+ (mn.dayOfYear = function (e) {
+ var t = Math.round((this.clone().startOf("day") - this.clone().startOf("year")) / 864e5) + 1
+ return null == e ? t : this.add(e - t, "d")
+ }),
+ (mn.hour = mn.hours = nt),
+ (mn.minute = mn.minutes = ln),
+ (mn.second = mn.seconds = dn),
+ (mn.millisecond = mn.milliseconds = fn),
+ (mn.utcOffset = function (e, t, n) {
+ var s,
+ i = this._offset || 0
+ if (!this.isValid()) return null != e ? this : NaN
+ if (null == e) return this._isUTC ? i : Vt(this)
+ if ("string" == typeof e) {
+ if (null === (e = Nt(re, e))) return this
+ } else Math.abs(e) < 16 && !n && (e *= 60)
+ return (
+ !this._isUTC && t && (s = Vt(this)),
+ (this._offset = e),
+ (this._isUTC = !0),
+ null != s && this.add(s, "m"),
+ i !== e &&
+ (!t || this._changeInProgress
+ ? qt(this, jt(e - i, "m"), 1, !1)
+ : this._changeInProgress || ((this._changeInProgress = !0), c.updateOffset(this, !0), (this._changeInProgress = null))),
+ this
+ )
+ }),
+ (mn.utc = function (e) {
+ return this.utcOffset(0, e)
+ }),
+ (mn.local = function (e) {
+ return this._isUTC && (this.utcOffset(0, e), (this._isUTC = !1), e && this.subtract(Vt(this), "m")), this
+ }),
+ (mn.parseZone = function () {
+ if (null != this._tzm) this.utcOffset(this._tzm, !1, !0)
+ else if ("string" == typeof this._i) {
+ var e = Nt(ie, this._i)
+ null != e ? this.utcOffset(e) : this.utcOffset(0, !0)
+ }
+ return this
+ }),
+ (mn.hasAlignedHourOffset = function (e) {
+ return !!this.isValid() && ((e = e ? bt(e).utcOffset() : 0), (this.utcOffset() - e) % 60 == 0)
+ }),
+ (mn.isDST = function () {
+ return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset()
+ }),
+ (mn.isLocal = function () {
+ return !!this.isValid() && !this._isUTC
+ }),
+ (mn.isUtcOffset = function () {
+ return !!this.isValid() && this._isUTC
+ }),
+ (mn.isUtc = Et),
+ (mn.isUTC = Et),
+ (mn.zoneAbbr = function () {
+ return this._isUTC ? "UTC" : ""
+ }),
+ (mn.zoneName = function () {
+ return this._isUTC ? "Coordinated Universal Time" : ""
+ }),
+ (mn.dates = n("dates accessor is deprecated. Use date instead.", un)),
+ (mn.months = n("months accessor is deprecated. Use month instead", Ue)),
+ (mn.years = n("years accessor is deprecated. Use year instead", Oe)),
+ (mn.zone = n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/", function (e, t) {
+ return null != e ? ("string" != typeof e && (e = -e), this.utcOffset(e, t), this) : -this.utcOffset()
+ })),
+ (mn.isDSTShifted = n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information", function () {
+ if (!l(this._isDSTShifted)) return this._isDSTShifted
+ var e = {}
+ if ((w(e, this), (e = Ot(e))._a)) {
+ var t = e._isUTC ? y(e._a) : bt(e._a)
+ this._isDSTShifted = this.isValid() && 0 < a(e._a, t.toArray())
+ } else this._isDSTShifted = !1
+ return this._isDSTShifted
+ }))
+ var yn = P.prototype
+ function gn(e, t, n, s) {
+ var i = ht(),
+ r = y().set(s, t)
+ return i[n](r, e)
+ }
+ function vn(e, t, n) {
+ if ((h(e) && ((t = e), (e = void 0)), (e = e || ""), null != t)) return gn(e, t, n, "month")
+ var s,
+ i = []
+ for (s = 0; s < 12; s++) i[s] = gn(e, s, n, "month")
+ return i
+ }
+ function pn(e, t, n, s) {
+ t = ("boolean" == typeof e ? h(t) && ((n = t), (t = void 0)) : ((t = e), (e = !1), h((n = t)) && ((n = t), (t = void 0))), t || "")
+ var i,
+ r = ht(),
+ a = e ? r._week.dow : 0
+ if (null != n) return gn(t, (n + a) % 7, s, "day")
+ var o = []
+ for (i = 0; i < 7; i++) o[i] = gn(t, (i + a) % 7, s, "day")
+ return o
+ }
+ ;(yn.calendar = function (e, t, n) {
+ var s = this._calendar[e] || this._calendar.sameElse
+ return b(s) ? s.call(t, n) : s
+ }),
+ (yn.longDateFormat = function (e) {
+ var t = this._longDateFormat[e],
+ n = this._longDateFormat[e.toUpperCase()]
+ return t || !n
+ ? t
+ : ((this._longDateFormat[e] = n.replace(/MMMM|MM|DD|dddd/g, function (e) {
+ return e.slice(1)
+ })),
+ this._longDateFormat[e])
+ }),
+ (yn.invalidDate = function () {
+ return this._invalidDate
+ }),
+ (yn.ordinal = function (e) {
+ return this._ordinal.replace("%d", e)
+ }),
+ (yn.preparse = _n),
+ (yn.postformat = _n),
+ (yn.relativeTime = function (e, t, n, s) {
+ var i = this._relativeTime[n]
+ return b(i) ? i(e, t, n, s) : i.replace(/%d/i, e)
+ }),
+ (yn.pastFuture = function (e, t) {
+ var n = this._relativeTime[0 < e ? "future" : "past"]
+ return b(n) ? n(t) : n.replace(/%s/i, t)
+ }),
+ (yn.set = function (e) {
+ var t, n
+ for (n in e) b((t = e[n])) ? (this[n] = t) : (this["_" + n] = t)
+ ;(this._config = e), (this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source))
+ }),
+ (yn.months = function (e, t) {
+ return e
+ ? o(this._months)
+ ? this._months[e.month()]
+ : this._months[(this._months.isFormat || We).test(t) ? "format" : "standalone"][e.month()]
+ : o(this._months)
+ ? this._months
+ : this._months.standalone
+ }),
+ (yn.monthsShort = function (e, t) {
+ return e
+ ? o(this._monthsShort)
+ ? this._monthsShort[e.month()]
+ : this._monthsShort[We.test(t) ? "format" : "standalone"][e.month()]
+ : o(this._monthsShort)
+ ? this._monthsShort
+ : this._monthsShort.standalone
+ }),
+ (yn.monthsParse = function (e, t, n) {
+ var s, i, r
+ if (this._monthsParseExact)
+ return function (e, t, n) {
+ var s,
+ i,
+ r,
+ a = e.toLocaleLowerCase()
+ if (!this._monthsParse)
+ for (this._monthsParse = [], this._longMonthsParse = [], this._shortMonthsParse = [], s = 0; s < 12; ++s)
+ (r = y([2e3, s])), (this._shortMonthsParse[s] = this.monthsShort(r, "").toLocaleLowerCase()), (this._longMonthsParse[s] = this.months(r, "").toLocaleLowerCase())
+ return n
+ ? "MMM" === t
+ ? -1 !== (i = Ye.call(this._shortMonthsParse, a))
+ ? i
+ : null
+ : -1 !== (i = Ye.call(this._longMonthsParse, a))
+ ? i
+ : null
+ : "MMM" === t
+ ? -1 !== (i = Ye.call(this._shortMonthsParse, a))
+ ? i
+ : -1 !== (i = Ye.call(this._longMonthsParse, a))
+ ? i
+ : null
+ : -1 !== (i = Ye.call(this._longMonthsParse, a))
+ ? i
+ : -1 !== (i = Ye.call(this._shortMonthsParse, a))
+ ? i
+ : null
+ }.call(this, e, t, n)
+ for (this._monthsParse || ((this._monthsParse = []), (this._longMonthsParse = []), (this._shortMonthsParse = [])), s = 0; s < 12; s++) {
+ if (
+ ((i = y([2e3, s])),
+ n &&
+ !this._longMonthsParse[s] &&
+ ((this._longMonthsParse[s] = new RegExp("^" + this.months(i, "").replace(".", "") + "$", "i")),
+ (this._shortMonthsParse[s] = new RegExp("^" + this.monthsShort(i, "").replace(".", "") + "$", "i"))),
+ n || this._monthsParse[s] || ((r = "^" + this.months(i, "") + "|^" + this.monthsShort(i, "")), (this._monthsParse[s] = new RegExp(r.replace(".", ""), "i"))),
+ n && "MMMM" === t && this._longMonthsParse[s].test(e))
+ )
+ return s
+ if (n && "MMM" === t && this._shortMonthsParse[s].test(e)) return s
+ if (!n && this._monthsParse[s].test(e)) return s
+ }
+ }),
+ (yn.monthsRegex = function (e) {
+ return this._monthsParseExact
+ ? (m(this, "_monthsRegex") || Ne.call(this), e ? this._monthsStrictRegex : this._monthsRegex)
+ : (m(this, "_monthsRegex") || (this._monthsRegex = Le), this._monthsStrictRegex && e ? this._monthsStrictRegex : this._monthsRegex)
+ }),
+ (yn.monthsShortRegex = function (e) {
+ return this._monthsParseExact
+ ? (m(this, "_monthsRegex") || Ne.call(this), e ? this._monthsShortStrictRegex : this._monthsShortRegex)
+ : (m(this, "_monthsShortRegex") || (this._monthsShortRegex = Fe), this._monthsShortStrictRegex && e ? this._monthsShortStrictRegex : this._monthsShortRegex)
+ }),
+ (yn.week = function (e) {
+ return Ie(e, this._week.dow, this._week.doy).week
+ }),
+ (yn.firstDayOfYear = function () {
+ return this._week.doy
+ }),
+ (yn.firstDayOfWeek = function () {
+ return this._week.dow
+ }),
+ (yn.weekdays = function (e, t) {
+ var n = o(this._weekdays) ? this._weekdays : this._weekdays[e && !0 !== e && this._weekdays.isFormat.test(t) ? "format" : "standalone"]
+ return !0 === e ? je(n, this._week.dow) : e ? n[e.day()] : n
+ }),
+ (yn.weekdaysMin = function (e) {
+ return !0 === e ? je(this._weekdaysMin, this._week.dow) : e ? this._weekdaysMin[e.day()] : this._weekdaysMin
+ }),
+ (yn.weekdaysShort = function (e) {
+ return !0 === e ? je(this._weekdaysShort, this._week.dow) : e ? this._weekdaysShort[e.day()] : this._weekdaysShort
+ }),
+ (yn.weekdaysParse = function (e, t, n) {
+ var s, i, r
+ if (this._weekdaysParseExact)
+ return function (e, t, n) {
+ var s,
+ i,
+ r,
+ a = e.toLocaleLowerCase()
+ if (!this._weekdaysParse)
+ for (this._weekdaysParse = [], this._shortWeekdaysParse = [], this._minWeekdaysParse = [], s = 0; s < 7; ++s)
+ (r = y([2e3, 1]).day(s)),
+ (this._minWeekdaysParse[s] = this.weekdaysMin(r, "").toLocaleLowerCase()),
+ (this._shortWeekdaysParse[s] = this.weekdaysShort(r, "").toLocaleLowerCase()),
+ (this._weekdaysParse[s] = this.weekdays(r, "").toLocaleLowerCase())
+ return n
+ ? "dddd" === t
+ ? -1 !== (i = Ye.call(this._weekdaysParse, a))
+ ? i
+ : null
+ : "ddd" === t
+ ? -1 !== (i = Ye.call(this._shortWeekdaysParse, a))
+ ? i
+ : null
+ : -1 !== (i = Ye.call(this._minWeekdaysParse, a))
+ ? i
+ : null
+ : "dddd" === t
+ ? -1 !== (i = Ye.call(this._weekdaysParse, a))
+ ? i
+ : -1 !== (i = Ye.call(this._shortWeekdaysParse, a))
+ ? i
+ : -1 !== (i = Ye.call(this._minWeekdaysParse, a))
+ ? i
+ : null
+ : "ddd" === t
+ ? -1 !== (i = Ye.call(this._shortWeekdaysParse, a))
+ ? i
+ : -1 !== (i = Ye.call(this._weekdaysParse, a))
+ ? i
+ : -1 !== (i = Ye.call(this._minWeekdaysParse, a))
+ ? i
+ : null
+ : -1 !== (i = Ye.call(this._minWeekdaysParse, a))
+ ? i
+ : -1 !== (i = Ye.call(this._weekdaysParse, a))
+ ? i
+ : -1 !== (i = Ye.call(this._shortWeekdaysParse, a))
+ ? i
+ : null
+ }.call(this, e, t, n)
+ for (this._weekdaysParse || ((this._weekdaysParse = []), (this._minWeekdaysParse = []), (this._shortWeekdaysParse = []), (this._fullWeekdaysParse = [])), s = 0; s < 7; s++) {
+ if (
+ ((i = y([2e3, 1]).day(s)),
+ n &&
+ !this._fullWeekdaysParse[s] &&
+ ((this._fullWeekdaysParse[s] = new RegExp("^" + this.weekdays(i, "").replace(".", "\\.?") + "$", "i")),
+ (this._shortWeekdaysParse[s] = new RegExp("^" + this.weekdaysShort(i, "").replace(".", "\\.?") + "$", "i")),
+ (this._minWeekdaysParse[s] = new RegExp("^" + this.weekdaysMin(i, "").replace(".", "\\.?") + "$", "i"))),
+ this._weekdaysParse[s] ||
+ ((r = "^" + this.weekdays(i, "") + "|^" + this.weekdaysShort(i, "") + "|^" + this.weekdaysMin(i, "")), (this._weekdaysParse[s] = new RegExp(r.replace(".", ""), "i"))),
+ n && "dddd" === t && this._fullWeekdaysParse[s].test(e))
+ )
+ return s
+ if (n && "ddd" === t && this._shortWeekdaysParse[s].test(e)) return s
+ if (n && "dd" === t && this._minWeekdaysParse[s].test(e)) return s
+ if (!n && this._weekdaysParse[s].test(e)) return s
+ }
+ }),
+ (yn.weekdaysRegex = function (e) {
+ return this._weekdaysParseExact
+ ? (m(this, "_weekdaysRegex") || Qe.call(this), e ? this._weekdaysStrictRegex : this._weekdaysRegex)
+ : (m(this, "_weekdaysRegex") || (this._weekdaysRegex = qe), this._weekdaysStrictRegex && e ? this._weekdaysStrictRegex : this._weekdaysRegex)
+ }),
+ (yn.weekdaysShortRegex = function (e) {
+ return this._weekdaysParseExact
+ ? (m(this, "_weekdaysRegex") || Qe.call(this), e ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex)
+ : (m(this, "_weekdaysShortRegex") || (this._weekdaysShortRegex = Je), this._weekdaysShortStrictRegex && e ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex)
+ }),
+ (yn.weekdaysMinRegex = function (e) {
+ return this._weekdaysParseExact
+ ? (m(this, "_weekdaysRegex") || Qe.call(this), e ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex)
+ : (m(this, "_weekdaysMinRegex") || (this._weekdaysMinRegex = Be), this._weekdaysMinStrictRegex && e ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex)
+ }),
+ (yn.isPM = function (e) {
+ return "p" === (e + "").toLowerCase().charAt(0)
+ }),
+ (yn.meridiem = function (e, t, n) {
+ return 11 < e ? (n ? "pm" : "PM") : n ? "am" : "AM"
+ }),
+ ut("en", {
+ dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
+ ordinal: function (e) {
+ var t = e % 10
+ return e + (1 === D((e % 100) / 10) ? "th" : 1 === t ? "st" : 2 === t ? "nd" : 3 === t ? "rd" : "th")
+ },
+ }),
+ (c.lang = n("moment.lang is deprecated. Use moment.locale instead.", ut)),
+ (c.langData = n("moment.langData is deprecated. Use moment.localeData instead.", ht))
+ var wn = Math.abs
+ function Mn(e, t, n, s) {
+ var i = jt(t, n)
+ return (e._milliseconds += s * i._milliseconds), (e._days += s * i._days), (e._months += s * i._months), e._bubble()
+ }
+ function kn(e) {
+ return e < 0 ? Math.floor(e) : Math.ceil(e)
+ }
+ function Sn(e) {
+ return (4800 * e) / 146097
+ }
+ function Dn(e) {
+ return (146097 * e) / 4800
+ }
+ function Yn(e) {
+ return function () {
+ return this.as(e)
+ }
+ }
+ var On = Yn("ms"),
+ Tn = Yn("s"),
+ bn = Yn("m"),
+ xn = Yn("h"),
+ Pn = Yn("d"),
+ Wn = Yn("w"),
+ Cn = Yn("M"),
+ Hn = Yn("Q"),
+ Rn = Yn("y")
+ function Un(e) {
+ return function () {
+ return this.isValid() ? this._data[e] : NaN
+ }
+ }
+ var Fn = Un("milliseconds"),
+ Ln = Un("seconds"),
+ Nn = Un("minutes"),
+ Gn = Un("hours"),
+ Vn = Un("days"),
+ En = Un("months"),
+ In = Un("years")
+ var An = Math.round,
+ jn = { ss: 44, s: 45, m: 45, h: 22, d: 26, M: 11 }
+ var Zn = Math.abs
+ function zn(e) {
+ return (0 < e) - (e < 0) || +e
+ }
+ function $n() {
+ if (!this.isValid()) return this.localeData().invalidDate()
+ var e,
+ t,
+ n = Zn(this._milliseconds) / 1e3,
+ s = Zn(this._days),
+ i = Zn(this._months)
+ ;(t = S((e = S(n / 60)) / 60)), (n %= 60), (e %= 60)
+ var r = S(i / 12),
+ a = (i %= 12),
+ o = s,
+ u = t,
+ l = e,
+ h = n ? n.toFixed(3).replace(/\.?0+$/, "") : "",
+ d = this.asSeconds()
+ if (!d) return "P0D"
+ var c = d < 0 ? "-" : "",
+ f = zn(this._months) !== zn(d) ? "-" : "",
+ m = zn(this._days) !== zn(d) ? "-" : "",
+ _ = zn(this._milliseconds) !== zn(d) ? "-" : ""
+ return (
+ c +
+ "P" +
+ (r ? f + r + "Y" : "") +
+ (a ? f + a + "M" : "") +
+ (o ? m + o + "D" : "") +
+ (u || l || h ? "T" : "") +
+ (u ? _ + u + "H" : "") +
+ (l ? _ + l + "M" : "") +
+ (h ? _ + h + "S" : "")
+ )
+ }
+ var qn = Ht.prototype
+ return (
+ (qn.isValid = function () {
+ return this._isValid
+ }),
+ (qn.abs = function () {
+ var e = this._data
+ return (
+ (this._milliseconds = wn(this._milliseconds)),
+ (this._days = wn(this._days)),
+ (this._months = wn(this._months)),
+ (e.milliseconds = wn(e.milliseconds)),
+ (e.seconds = wn(e.seconds)),
+ (e.minutes = wn(e.minutes)),
+ (e.hours = wn(e.hours)),
+ (e.months = wn(e.months)),
+ (e.years = wn(e.years)),
+ this
+ )
+ }),
+ (qn.add = function (e, t) {
+ return Mn(this, e, t, 1)
+ }),
+ (qn.subtract = function (e, t) {
+ return Mn(this, e, t, -1)
+ }),
+ (qn.as = function (e) {
+ if (!this.isValid()) return NaN
+ var t,
+ n,
+ s = this._milliseconds
+ if ("month" === (e = H(e)) || "quarter" === e || "year" === e)
+ switch (((t = this._days + s / 864e5), (n = this._months + Sn(t)), e)) {
+ case "month":
+ return n
+ case "quarter":
+ return n / 3
+ case "year":
+ return n / 12
+ }
+ else
+ switch (((t = this._days + Math.round(Dn(this._months))), e)) {
+ case "week":
+ return t / 7 + s / 6048e5
+ case "day":
+ return t + s / 864e5
+ case "hour":
+ return 24 * t + s / 36e5
+ case "minute":
+ return 1440 * t + s / 6e4
+ case "second":
+ return 86400 * t + s / 1e3
+ case "millisecond":
+ return Math.floor(864e5 * t) + s
+ default:
+ throw new Error("Unknown unit " + e)
+ }
+ }),
+ (qn.asMilliseconds = On),
+ (qn.asSeconds = Tn),
+ (qn.asMinutes = bn),
+ (qn.asHours = xn),
+ (qn.asDays = Pn),
+ (qn.asWeeks = Wn),
+ (qn.asMonths = Cn),
+ (qn.asQuarters = Hn),
+ (qn.asYears = Rn),
+ (qn.valueOf = function () {
+ return this.isValid() ? this._milliseconds + 864e5 * this._days + (this._months % 12) * 2592e6 + 31536e6 * D(this._months / 12) : NaN
+ }),
+ (qn._bubble = function () {
+ var e,
+ t,
+ n,
+ s,
+ i,
+ r = this._milliseconds,
+ a = this._days,
+ o = this._months,
+ u = this._data
+ return (
+ (0 <= r && 0 <= a && 0 <= o) || (r <= 0 && a <= 0 && o <= 0) || ((r += 864e5 * kn(Dn(o) + a)), (o = a = 0)),
+ (u.milliseconds = r % 1e3),
+ (e = S(r / 1e3)),
+ (u.seconds = e % 60),
+ (t = S(e / 60)),
+ (u.minutes = t % 60),
+ (n = S(t / 60)),
+ (u.hours = n % 24),
+ (o += i = S(Sn((a += S(n / 24))))),
+ (a -= kn(Dn(i))),
+ (s = S(o / 12)),
+ (o %= 12),
+ (u.days = a),
+ (u.months = o),
+ (u.years = s),
+ this
+ )
+ }),
+ (qn.clone = function () {
+ return jt(this)
+ }),
+ (qn.get = function (e) {
+ return (e = H(e)), this.isValid() ? this[e + "s"]() : NaN
+ }),
+ (qn.milliseconds = Fn),
+ (qn.seconds = Ln),
+ (qn.minutes = Nn),
+ (qn.hours = Gn),
+ (qn.days = Vn),
+ (qn.weeks = function () {
+ return S(this.days() / 7)
+ }),
+ (qn.months = En),
+ (qn.years = In),
+ (qn.humanize = function (e) {
+ if (!this.isValid()) return this.localeData().invalidDate()
+ var t,
+ n,
+ s,
+ i,
+ r,
+ a,
+ o,
+ u,
+ l,
+ h,
+ d,
+ c = this.localeData(),
+ f =
+ ((n = !e),
+ (s = c),
+ (i = jt((t = this)).abs()),
+ (r = An(i.as("s"))),
+ (a = An(i.as("m"))),
+ (o = An(i.as("h"))),
+ (u = An(i.as("d"))),
+ (l = An(i.as("M"))),
+ (h = An(i.as("y"))),
+ ((d = (r <= jn.ss && ["s", r]) ||
+ (r < jn.s && ["ss", r]) ||
+ (a <= 1 && ["m"]) ||
+ (a < jn.m && ["mm", a]) ||
+ (o <= 1 && ["h"]) ||
+ (o < jn.h && ["hh", o]) ||
+ (u <= 1 && ["d"]) ||
+ (u < jn.d && ["dd", u]) ||
+ (l <= 1 && ["M"]) ||
+ (l < jn.M && ["MM", l]) ||
+ (h <= 1 && ["y"]) || ["yy", h])[2] = n),
+ (d[3] = 0 < +t),
+ (d[4] = s),
+ function (e, t, n, s, i) {
+ return i.relativeTime(t || 1, !!n, e, s)
+ }.apply(null, d))
+ return e && (f = c.pastFuture(+this, f)), c.postformat(f)
+ }),
+ (qn.toISOString = $n),
+ (qn.toString = $n),
+ (qn.toJSON = $n),
+ (qn.locale = Xt),
+ (qn.localeData = en),
+ (qn.toIsoString = n("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)", $n)),
+ (qn.lang = Kt),
+ I("X", 0, 0, "unix"),
+ I("x", 0, 0, "valueOf"),
+ ue("x", se),
+ ue("X", /[+-]?\d+(\.\d{1,3})?/),
+ ce("X", function (e, t, n) {
+ n._d = new Date(1e3 * parseFloat(e, 10))
+ }),
+ ce("x", function (e, t, n) {
+ n._d = new Date(D(e))
+ }),
+ (c.version = "2.24.0"),
+ (e = bt),
+ (c.fn = mn),
+ (c.min = function () {
+ return Wt("isBefore", [].slice.call(arguments, 0))
+ }),
+ (c.max = function () {
+ return Wt("isAfter", [].slice.call(arguments, 0))
+ }),
+ (c.now = function () {
+ return Date.now ? Date.now() : +new Date()
+ }),
+ (c.utc = y),
+ (c.unix = function (e) {
+ return bt(1e3 * e)
+ }),
+ (c.months = function (e, t) {
+ return vn(e, t, "months")
+ }),
+ (c.isDate = d),
+ (c.locale = ut),
+ (c.invalid = p),
+ (c.duration = jt),
+ (c.isMoment = k),
+ (c.weekdays = function (e, t, n) {
+ return pn(e, t, n, "weekdays")
+ }),
+ (c.parseZone = function () {
+ return bt.apply(null, arguments).parseZone()
+ }),
+ (c.localeData = ht),
+ (c.isDuration = Rt),
+ (c.monthsShort = function (e, t) {
+ return vn(e, t, "monthsShort")
+ }),
+ (c.weekdaysMin = function (e, t, n) {
+ return pn(e, t, n, "weekdaysMin")
+ }),
+ (c.defineLocale = lt),
+ (c.updateLocale = function (e, t) {
+ if (null != t) {
+ var n,
+ s,
+ i = st
+ null != (s = ot(e)) && (i = s._config), ((n = new P((t = x(i, t)))).parentLocale = it[e]), (it[e] = n), ut(e)
+ } else null != it[e] && (null != it[e].parentLocale ? (it[e] = it[e].parentLocale) : null != it[e] && delete it[e])
+ return it[e]
+ }),
+ (c.locales = function () {
+ return s(it)
+ }),
+ (c.weekdaysShort = function (e, t, n) {
+ return pn(e, t, n, "weekdaysShort")
+ }),
+ (c.normalizeUnits = H),
+ (c.relativeTimeRounding = function (e) {
+ return void 0 === e ? An : "function" == typeof e && ((An = e), !0)
+ }),
+ (c.relativeTimeThreshold = function (e, t) {
+ return void 0 !== jn[e] && (void 0 === t ? jn[e] : ((jn[e] = t), "s" === e && (jn.ss = t - 1), !0))
+ }),
+ (c.calendarFormat = function (e, t) {
+ var n = e.diff(t, "days", !0)
+ return n < -6 ? "sameElse" : n < -1 ? "lastWeek" : n < 0 ? "lastDay" : n < 1 ? "sameDay" : n < 2 ? "nextDay" : n < 7 ? "nextWeek" : "sameElse"
+ }),
+ (c.prototype = mn),
+ (c.HTML5_FMT = {
+ DATETIME_LOCAL: "YYYY-MM-DDTHH:mm",
+ DATETIME_LOCAL_SECONDS: "YYYY-MM-DDTHH:mm:ss",
+ DATETIME_LOCAL_MS: "YYYY-MM-DDTHH:mm:ss.SSS",
+ DATE: "YYYY-MM-DD",
+ TIME: "HH:mm",
+ TIME_SECONDS: "HH:mm:ss",
+ TIME_MS: "HH:mm:ss.SSS",
+ WEEK: "GGGG-[W]WW",
+ MONTH: "YYYY-MM",
+ }),
+ c
+ )
+ })
+ ;(function (f) {
+ if (typeof exports === "object" && typeof module !== "undefined") {
+ module.exports = f()
+ } else if (typeof define === "function" && define.amd) {
+ define([], f)
+ } else {
+ var g
+ if (typeof window !== "undefined") {
+ g = window
+ } else if (typeof global !== "undefined") {
+ g = global
+ } else if (typeof self !== "undefined") {
+ g = self
+ } else {
+ g = this
+ }
+ g.momentParseformat = f()
+ }
+ })(function () {
+ var define, module, exports
+ return (function e(t, n, r) {
+ function s(o, u) {
+ if (!n[o]) {
+ if (!t[o]) {
+ var a = typeof require == "function" && require
+ if (!u && a) return a(o, !0)
+ if (i) return i(o, !0)
+ var f = new Error("Cannot find module '" + o + "'")
+ throw ((f.code = "MODULE_NOT_FOUND"), f)
+ }
+ var l = (n[o] = { exports: {} })
+ t[o][0].call(
+ l.exports,
+ function (e) {
+ var n = t[o][1][e]
+ return s(n ? n : e)
+ },
+ l,
+ l.exports,
+ e,
+ t,
+ n,
+ r
+ )
+ }
+ return n[o].exports
+ }
+ var i = typeof require == "function" && require
+ for (var o = 0; o < r.length; o++) s(r[o])
+ return s
+ })(
+ {
+ 1: [
+ function (require, module, exports) {
+ var parseFormat = require("./lib/parseformat")
+ module.exports = parseFormat
+
+ /* istanbul ignore next */
+ if (typeof window !== "undefined" && window.moment) {
+ window.moment.parseFormat = parseFormat
+ }
+ },
+ { "./lib/parseformat": 2 },
+ ],
+ 2: [
+ function (require, module, exports) {
+ module.exports = parseFormat
+
+ var dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
+ var abbreviatedDayNames = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
+ var shortestDayNames = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
+ var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
+ var abbreviatedMonthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
+
+ var regexDayNames = new RegExp(dayNames.join("|"), "i")
+ var regexAbbreviatedDayNames = new RegExp(abbreviatedDayNames.join("|"), "i")
+ var regexShortestDayNames = new RegExp("\\b(" + shortestDayNames.join("|") + ")\\b", "i")
+ var regexMonthNames = new RegExp(monthNames.join("|"), "i")
+ var regexAbbreviatedMonthNames = new RegExp(abbreviatedMonthNames.join("|"), "i")
+
+ var regexFirstSecondThirdFourth = /(\d+)(st|nd|rd|th)\b/i
+ var regexEndian = /(\d{1,4})([/.-])(\d{1,2})[/.-](\d{1,4})/
+
+ var regexTimezone = /((\+|-)\d\d:?\d\d)$/
+ var amOrPm = "(" + ["AM?", "PM?"].join("|") + ")"
+ var regexHoursWithLeadingZeroDigitMinutesSecondsAmPm = new RegExp("0\\d\\:\\d{1,2}\\:\\d{1,2}(\\s*)" + amOrPm, "i")
+ var regexHoursWithLeadingZeroDigitMinutesAmPm = new RegExp("0\\d\\:\\d{1,2}(\\s*)" + amOrPm, "i")
+ var regexHoursWithLeadingZeroDigitAmPm = new RegExp("0\\d(\\s*)" + amOrPm, "i")
+ var regexHoursMinutesSecondsAmPm = new RegExp("\\d{1,2}\\:\\d{1,2}\\:\\d{1,2}(\\s*)" + amOrPm, "i")
+ var regexHoursMinutesAmPm = new RegExp("\\d{1,2}\\:\\d{1,2}(\\s*)" + amOrPm, "i")
+ var regexHoursAmPm = new RegExp("\\d{1,2}(\\s*)" + amOrPm, "i")
+
+ var regexISO8601HoursWithLeadingZeroMinutesSecondsMilliseconds = /\d{2}:\d{2}:\d{2}\.\d{3}/
+ var regexISO8601HoursWithLeadingZeroMinutesSecondsCentiSeconds = /\d{2}:\d{2}:\d{2}\.\d{2}/
+ var regexISO8601HoursWithLeadingZeroMinutesSecondsDeciSeconds = /\d{2}:\d{2}:\d{2}\.\d{1}/
+ var regexHoursWithLeadingZeroMinutesSeconds = /0\d:\d{2}:\d{2}/
+ var regexHoursWithLeadingZeroMinutes = /0\d:\d{2}/
+ var regexHoursMinutesSeconds = /\d{1,2}:\d{2}:\d{2}/
+ var regexHoursMinutesSecondsMilliseconds = /\d{1,2}:\d{2}:\d{2}\.\d{3}/
+ var regexHoursMinutesSecondsCentiSeconds = /\d{1,2}:\d{2}:\d{2}\.\d{2}/
+ var regexHoursMinutesSecondsDeciSeconds = /\d{1,2}:\d{2}:\d{2}\.\d{1}/
+ var regexHoursMinutes = /\d{1,2}:\d{2}/
+ var regexYearLong = /\d{4}/
+ var regexDayLeadingZero = /0\d/
+ var regexDay = /\d{1,2}/
+ var regexYearShort = /\d{2}/
+
+ var regexDayShortMonthShort = /^([1-9])\/([1-9]|0[1-9])$/
+ var regexDayShortMonth = /^([1-9])\/(1[012])$/
+ var regexDayMonthShort = /^(0[1-9]|[12][0-9]|3[01])\/([1-9])$/
+ var regexDayMonth = /^(0[1-9]|[12][0-9]|3[01])\/(1[012]|0[1-9])$/
+
+ var regexMonthShortYearShort = /^([1-9])\/([1-9][0-9])$/
+ var regexMonthYearShort = /^(0[1-9]|1[012])\/([1-9][0-9])$/
+
+ var formatIncludesMonth = /([/][M]|[M][/]|[MM]|[MMMM])/
+
+ var regexFillingWords = /\b(at)\b/i
+
+ var regexUnixMillisecondTimestamp = /\d{13}/
+ var regexUnixTimestamp = /\d{10}/
+
+ // option defaults
+ var defaultOrder = {
+ "/": "MDY",
+ ".": "DMY",
+ "-": "YMD",
+ }
+
+ function parseFormat(dateString, options) {
+ var format = dateString.toString()
+
+ // default options
+ options = options || {}
+ options.preferredOrder = options.preferredOrder || defaultOrder
+
+ // Unix Millisecond Timestamp ☛ x
+ format = format.replace(regexUnixMillisecondTimestamp, "x")
+ // Unix Timestamp ☛ X
+ format = format.replace(regexUnixTimestamp, "X")
+
+ // escape filling words
+ format = format.replace(regexFillingWords, "[$1]")
+
+ // DAYS
+
+ // Monday ☛ dddd
+ format = format.replace(regexDayNames, "dddd")
+ // Mon ☛ ddd
+ format = format.replace(regexAbbreviatedDayNames, "ddd")
+ // Mo ☛ dd
+ format = format.replace(regexShortestDayNames, "dd")
+
+ // 1st, 2nd, 23rd ☛ do
+ format = format.replace(regexFirstSecondThirdFourth, "Do")
+
+ // MONTHS
+
+ // January ☛ MMMM
+ format = format.replace(regexMonthNames, "MMMM")
+ // Jan ☛ MMM
+ format = format.replace(regexAbbreviatedMonthNames, "MMM")
+
+ // replace endians, like 8/20/2010, 20.8.2010 or 2010-8-20
+ format = format.replace(regexEndian, replaceEndian.bind(null, options))
+
+ // TIME
+
+ // timezone +02:00 ☛ Z
+ format = format.replace(regexTimezone, "Z")
+ // 23:39:43.331 ☛ 'HH:mm:ss.SSS'
+ format = format.replace(regexISO8601HoursWithLeadingZeroMinutesSecondsMilliseconds, "HH:mm:ss.SSS")
+ // 23:39:43.33 ☛ 'HH:mm:ss.SS'
+ format = format.replace(regexISO8601HoursWithLeadingZeroMinutesSecondsCentiSeconds, "HH:mm:ss.SS")
+ // 23:39:43.3 ☛ 'HH:mm:ss.S'
+ format = format.replace(regexISO8601HoursWithLeadingZeroMinutesSecondsDeciSeconds, "HH:mm:ss.S")
+ function replaceWithAmPm(timeFormat) {
+ return function (match, whitespace, amPm) {
+ return timeFormat + whitespace + (amPm[0].toUpperCase() === amPm[0] ? "A" : "a")
+ }
+ }
+ // 05:30:20pm ☛ hh:mm:ssa
+ format = format.replace(regexHoursWithLeadingZeroDigitMinutesSecondsAmPm, replaceWithAmPm("hh:mm:ss"))
+ // 10:30:20pm ☛ h:mm:ssa
+ format = format.replace(regexHoursMinutesSecondsAmPm, replaceWithAmPm("h:mm:ss"))
+ // 05:30pm ☛ hh:mma
+ format = format.replace(regexHoursWithLeadingZeroDigitMinutesAmPm, replaceWithAmPm("hh:mm"))
+ // 10:30pm ☛ h:mma
+ format = format.replace(regexHoursMinutesAmPm, replaceWithAmPm("h:mm"))
+ // 05pm ☛ hha
+ format = format.replace(regexHoursWithLeadingZeroDigitAmPm, replaceWithAmPm("hh"))
+ // 10pm ☛ ha
+ format = format.replace(regexHoursAmPm, replaceWithAmPm("h"))
+ // 05:30:20 ☛ HH:mm:ss
+ format = format.replace(regexHoursWithLeadingZeroMinutesSeconds, "HH:mm:ss")
+ // 5:30:20.222 ☛ H:mm:ss.SSS
+ format = format.replace(regexHoursMinutesSecondsMilliseconds, "H:mm:ss.SSS")
+ // 5:30:20.22 ☛ H:mm:ss.SS
+ format = format.replace(regexHoursMinutesSecondsCentiSeconds, "H:mm:ss.SS")
+ // 5:30:20.2 ☛ H:mm:ss.S
+ format = format.replace(regexHoursMinutesSecondsDeciSeconds, "H:mm:ss.S")
+ // 10:30:20 ☛ H:mm:ss
+ format = format.replace(regexHoursMinutesSeconds, "H:mm:ss")
+ // 05:30 ☛ H:mm
+ format = format.replace(regexHoursWithLeadingZeroMinutes, "HH:mm")
+ // 10:30 ☛ HH:mm
+ format = format.replace(regexHoursMinutes, "H:mm")
+
+ // do we still have numbers left?
+
+ // Lets check for 4 digits first, these are years for sure
+ format = format.replace(regexYearLong, "YYYY")
+
+ // check if both numbers are < 13, then it must be D/M
+ format = format.replace(regexDayShortMonthShort, "D/M")
+
+ // check if first number is < 10 && last < 13, then it must be D/MM
+ format = format.replace(regexDayShortMonth, "D/MM")
+
+ // check if last number is < 32 && last < 10, then it must be DD/M
+ format = format.replace(regexDayMonthShort, "DD/M")
+
+ // check if both numbers are > 10, but first < 32 && last < 13, then it must be DD/MM
+ format = format.replace(regexDayMonth, "DD/MM")
+
+ // check if first < 10 && last > 12, then it must be M/YY
+ format = format.replace(regexMonthShortYearShort, "M/YY")
+
+ // check if first < 13 && last > 12, then it must be MM/YY
+ format = format.replace(regexMonthYearShort, "MM/YY")
+
+ // to prevent 9.20 gets formated to D.Y, we format the complete date first, then go for the time
+ if (format.match(formatIncludesMonth)) {
+ var regexHoursDotWithLeadingZeroOrDoubleDigitMinutes = /0\d.\d{2}|\d{2}.\d{2}/
+ var regexHoursDotMinutes = /\d{1}.\d{2}/
+
+ format = format.replace(regexHoursDotWithLeadingZeroOrDoubleDigitMinutes, "H.mm")
+ format = format.replace(regexHoursDotMinutes, "h.mm")
+ }
+
+ // now, the next number, if existing, must be a day
+ format = format.replace(regexDayLeadingZero, "DD")
+ format = format.replace(regexDay, "D")
+
+ // last but not least, there could still be a year left
+ format = format.replace(regexYearShort, "YY")
+
+ if (format.length < 1) {
+ format = undefined
+ }
+
+ return format
+ }
+
+ // if we can't find an endian based on the separator, but
+ // there still is a short date with day, month & year,
+ // we try to make a smart decision to identify the order
+ function replaceEndian(options, matchedPart, first, separator, second, third) {
+ var parts
+ var hasSingleDigit = Math.min(first.length, second.length, third.length) === 1
+ var hasQuadDigit = Math.max(first.length, second.length, third.length) === 4
+ var preferredOrder = typeof options.preferredOrder === "string" ? options.preferredOrder : options.preferredOrder[separator]
+
+ first = parseInt(first, 10)
+ second = parseInt(second, 10)
+ third = parseInt(third, 10)
+ parts = [first, second, third]
+ preferredOrder = preferredOrder.toUpperCase()
+
+ // If first is a year, order will always be Year-Month-Day
+ if (first > 31) {
+ parts[0] = hasQuadDigit ? "YYYY" : "YY"
+ parts[1] = hasSingleDigit ? "M" : "MM"
+ parts[2] = hasSingleDigit ? "D" : "DD"
+ return parts.join(separator)
+ }
+
+ // Second will never be the year. And if it is a day,
+ // the order will always be Month-Day-Year
+ if (second > 12) {
+ parts[0] = hasSingleDigit ? "M" : "MM"
+ parts[1] = hasSingleDigit ? "D" : "DD"
+ parts[2] = hasQuadDigit ? "YYYY" : "YY"
+ return parts.join(separator)
+ }
+
+ // if third is a year ...
+ if (third > 31) {
+ parts[2] = hasQuadDigit ? "YYYY" : "YY"
+
+ // ... try to find day in first and second.
+ // If found, the remaining part is the month.
+ if (preferredOrder[0] === "M" && first < 13) {
+ parts[0] = hasSingleDigit ? "M" : "MM"
+ parts[1] = hasSingleDigit ? "D" : "DD"
+ return parts.join(separator)
+ }
+ parts[0] = hasSingleDigit ? "D" : "DD"
+ parts[1] = hasSingleDigit ? "M" : "MM"
+ return parts.join(separator)
+ }
+
+ // if we had no luck until here, we use the preferred order
+ parts[preferredOrder.indexOf("D")] = hasSingleDigit ? "D" : "DD"
+ parts[preferredOrder.indexOf("M")] = hasSingleDigit ? "M" : "MM"
+ parts[preferredOrder.indexOf("Y")] = hasQuadDigit ? "YYYY" : "YY"
+
+ return parts.join(separator)
+ }
+ },
+ {},
+ ],
+ },
+ {},
+ [1]
+ )(1)
+ })
- !function(e){"use strict";var x={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:f,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,nptable:f,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:f,lheading:/^([^\n]+)\n {0,3}(=|-){2,} *(?:\n+|$)/,paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,text:/^[^\n]+/};function a(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||b.defaults,this.rules=x.normal,this.options.pedantic?this.rules=x.pedantic:this.options.gfm&&(this.options.tables?this.rules=x.tables:this.rules=x.gfm)}x._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,x._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,x.def=i(x.def).replace("label",x._label).replace("title",x._title).getRegex(),x.bullet=/(?:[*+-]|\d{1,9}\.)/,x.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,x.item=i(x.item,"gm").replace(/bull/g,x.bullet).getRegex(),x.list=i(x.list).replace(/bull/g,x.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+x.def.source+")").getRegex(),x._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",x._comment=//,x.html=i(x.html,"i").replace("comment",x._comment).replace("tag",x._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),x.paragraph=i(x.paragraph).replace("hr",x.hr).replace("heading",x.heading).replace("lheading",x.lheading).replace("tag",x._tag).getRegex(),x.blockquote=i(x.blockquote).replace("paragraph",x.paragraph).getRegex(),x.normal=d({},x),x.gfm=d({},x.normal,{fences:/^ {0,3}(`{3,}|~{3,})([^`\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),x.gfm.paragraph=i(x.paragraph).replace("(?!","(?!"+x.gfm.fences.source.replace("\\1","\\2")+"|"+x.list.source.replace("\\1","\\3")+"|").getRegex(),x.tables=d({},x.gfm,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/}),x.pedantic=d({},x.normal,{html:i("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",x._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/}),a.rules=x,a.lex=function(e,t){return new a(t).lex(e)},a.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},a.prototype.token=function(e,t){var n,r,s,i,l,o,a,h,p,u,c,g,f,d,m,b;for(e=e.replace(/^ +$/gm,"");e;)if((s=this.rules.newline.exec(e))&&(e=e.substring(s[0].length),1 ?/gm,""),this.token(s,t),this.tokens.push({type:"blockquote_end"});else if(s=this.rules.list.exec(e)){for(e=e.substring(s[0].length),a={type:"list_start",ordered:d=1<(i=s[2]).length,start:d?+i:"",loose:!1},this.tokens.push(a),n=!(h=[]),f=(s=s[0].match(this.rules.item)).length,c=0;c?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:f,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,em:/^_([^\s_])_(?!_)|^\*([^\s*<\[])\*(?!\*)|^_([^\s<][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_<][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s<"][\s\S]*?[^\s\*])\*(?!\*|[^\spunctuation])|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:f,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[^_{|}~",n.em=i(n.em).replace(/punctuation/g,n._punctuation).getRegex(),n._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,n._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,n._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,n.autolink=i(n.autolink).replace("scheme",n._scheme).replace("email",n._email).getRegex(),n._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,n.tag=i(n.tag).replace("comment",x._comment).replace("attribute",n._attribute).getRegex(),n._label=/(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|`(?!`)|[^\[\]\\`])*?/,n._href=/\s*(<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*)/,n._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,n.link=i(n.link).replace("label",n._label).replace("href",n._href).replace("title",n._title).getRegex(),n.reflink=i(n.reflink).replace("label",n._label).getRegex(),n.normal=d({},n),n.pedantic=d({},n.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:i(/^!?\[(label)\]\((.*?)\)/).replace("label",n._label).getRegex(),reflink:i(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",n._label).getRegex()}),n.gfm=d({},n.normal,{escape:i(n.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\/i.test(i[0])&&(this.inLink=!1),!this.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(i[0])?this.inRawBlock=!0:this.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(i[0])&&(this.inRawBlock=!1),e=e.substring(i[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):u(i[0]):i[0];else if(i=this.rules.link.exec(e)){var a=m(i[2],"()");if(-1$/,"$1"),o+=this.outputLink(i,{href:p.escapes(r),title:p.escapes(s)}),this.inLink=!1}else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){o+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),o+=this.renderer.strong(this.output(i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),o+=this.renderer.em(this.output(i[6]||i[5]||i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),o+=this.renderer.codespan(u(i[2].trim(),!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),o+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),o+=this.renderer.del(this.output(i[1]));else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),r="@"===i[2]?"mailto:"+(n=u(this.mangle(i[1]))):n=u(i[1]),o+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.text.exec(e))e=e.substring(i[0].length),this.inRawBlock?o+=this.renderer.text(i[0]):o+=this.renderer.text(u(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else{if("@"===i[2])r="mailto:"+(n=u(i[0]));else{for(;l=i[0],i[0]=this.rules._backpedal.exec(i[0])[0],l!==i[0];);n=u(i[0]),r="www."===i[1]?"http://"+n:n}e=e.substring(i[0].length),o+=this.renderer.link(r,null,n)}return o},p.escapes=function(e){return e?e.replace(p.rules._escapes,"$1"):e},p.prototype.outputLink=function(e,t){var n=t.href,r=t.title?u(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,u(e[1]))},p.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},p.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,s=0;s'+(n?e:u(e,!0))+"\n":"
"+(n?e:u(e,!0))+"
"},r.prototype.blockquote=function(e){return"
\n"+e+"
\n"},r.prototype.html=function(e){return e},r.prototype.heading=function(e,t,n,r){return this.options.headerIds?"'+e+"\n":""+e+"\n"},r.prototype.hr=function(){return this.options.xhtml?"
\n":"
\n"},r.prototype.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"\n"},r.prototype.listitem=function(e){return"
  • "+e+"
  • \n"},r.prototype.checkbox=function(e){return" "},r.prototype.paragraph=function(e){return"

    "+e+"

    \n"},r.prototype.table=function(e,t){return t&&(t=""+t+""),"\n\n"+e+"\n"+t+"
    \n"},r.prototype.tablerow=function(e){return"\n"+e+"\n"},r.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"\n"},r.prototype.strong=function(e){return""+e+""},r.prototype.em=function(e){return""+e+""},r.prototype.codespan=function(e){return""+e+""},r.prototype.br=function(){return this.options.xhtml?"
    ":"
    "},r.prototype.del=function(e){return""+e+""},r.prototype.link=function(e,t,n){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return n;var r='"},r.prototype.image=function(e,t,n){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return n;var r=''+n+'":">"},r.prototype.text=function(e){return e},s.prototype.strong=s.prototype.em=s.prototype.codespan=s.prototype.del=s.prototype.text=function(e){return e},s.prototype.link=s.prototype.image=function(e,t,n){return""+n},s.prototype.br=function(){return""},h.parse=function(e,t){return new h(t).parse(e)},h.prototype.parse=function(e){this.inline=new p(e.links,this.options),this.inlineText=new p(e.links,d({},this.options,{renderer:new s})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},h.prototype.next=function(){return this.token=this.tokens.pop(),this.token},h.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},h.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},h.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,c(this.inlineText.output(this.token.text)),this.slugger);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,s="",i="";for(n="",e=0;e?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t))for(var n=t;this.seen[n]++,t=n+"-"+this.seen[n],this.seen.hasOwnProperty(t););return this.seen[t]=0,t},u.escapeTest=/[&<>"']/,u.escapeReplace=/[&<>"']/g,u.replacements={"&":"&","<":"<",">":">",'"':""","'":"'"},u.escapeTestNoEncode=/[<>"']|&(?!#?\w+;)/,u.escapeReplaceNoEncode=/[<>"']|&(?!#?\w+;)/g;var o={},g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(){}function d(e){for(var t,n,r=1;rt)n.splice(t);else for(;n.lengthAn error occurred:

    "+u(e.message+"",!0)+"
    ";throw e}}f.exec=f,b.options=b.setOptions=function(e){return d(b.defaults,e),b},b.getDefaults=function(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:new r,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tables:!0,xhtml:!1}},b.defaults=b.getDefaults(),b.Parser=h,b.parser=h.parse,b.Renderer=r,b.TextRenderer=s,b.Lexer=a,b.lexer=a.lex,b.InlineLexer=p,b.inlineLexer=p.output,b.Slugger=t,b.parse=b,"undefined"!=typeof module&&"object"==typeof exports?module.exports=b:"function"==typeof define&&define.amd?define(function(){return b}):e.marked=b}(this||("undefined"!=typeof window?window:global));;
    + text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\
    + }
    + function p(e, t) {
    + if (
    + ((this.options = t || b.defaults),
    + (this.links = e),
    + (this.rules = n.normal),
    + (this.renderer = this.options.renderer || new r()),
    + (this.renderer.options = this.options),
    + !this.links)
    + )
    + throw new Error("Tokens array requires a `links` property.")
    + this.options.pedantic ? (this.rules = n.pedantic) : this.options.gfm && (this.options.breaks ? (this.rules = n.breaks) : (this.rules = n.gfm))
    + }
    + function r(e) {
    + this.options = e || b.defaults
    + }
    + function s() {}
    + function h(e) {
    + ;(this.tokens = []),
    + (this.token = null),
    + (this.options = e || b.defaults),
    + (this.options.renderer = this.options.renderer || new r()),
    + (this.renderer = this.options.renderer),
    + (this.renderer.options = this.options),
    + (this.slugger = new t())
    + }
    + function t() {
    + this.seen = {}
    + }
    + function u(e, t) {
    + if (t) {
    + if (u.escapeTest.test(e))
    + return e.replace(u.escapeReplace, function (e) {
    + return u.replacements[e]
    + })
    + } else if (u.escapeTestNoEncode.test(e))
    + return e.replace(u.escapeReplaceNoEncode, function (e) {
    + return u.replacements[e]
    + })
    + return e
    + }
    + function c(e) {
    + return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi, function (e, t) {
    + return "colon" === (t = t.toLowerCase())
    + ? ":"
    + : "#" === t.charAt(0)
    + ? "x" === t.charAt(1)
    + ? String.fromCharCode(parseInt(t.substring(2), 16))
    + : String.fromCharCode(+t.substring(1))
    + : ""
    + })
    + }
    + function i(n, e) {
    + return (
    + (n = n.source || n),
    + (e = e || ""),
    + {
    + replace: function (e, t) {
    + return (t = (t = t.source || t).replace(/(^|[^\[])\^/g, "$1")), (n = n.replace(e, t)), this
    + },
    + getRegex: function () {
    + return new RegExp(n, e)
    + },
    + }
    + )
    + }
    + function l(e, t, n) {
    + if (e) {
    + try {
    + var r = decodeURIComponent(c(n))
    + .replace(/[^\w:]/g, "")
    + .toLowerCase()
    + } catch (e) {
    + return null
    + }
    + if (0 === r.indexOf("javascript:") || 0 === r.indexOf("vbscript:") || 0 === r.indexOf("data:")) return null
    + }
    + t &&
    + !g.test(n) &&
    + (n = (function (e, t) {
    + o[" " + e] || (/^[^:]+:\/*[^/]*$/.test(e) ? (o[" " + e] = e + "/") : (o[" " + e] = _(e, "/", !0)))
    + return (e = o[" " + e]), "//" === t.slice(0, 2) ? e.replace(/:[\s\S]*/, ":") + t : "/" === t.charAt(0) ? e.replace(/(:\/*[^/]*)[\s\S]*/, "$1") + t : e + t
    + })(t, n))
    + try {
    + n = encodeURI(n).replace(/%25/g, "%")
    + } catch (e) {
    + return null
    + }
    + return n
    + }
    + ;(n._punctuation = "!\"#$%&'()*+,\\-./:;<=>?@\\[^_{|}~"),
    + (n.em = i(n.em)
    + .replace(/punctuation/g, n._punctuation)
    + .getRegex()),
    + (n._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g),
    + (n._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/),
    + (n._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/),
    + (n.autolink = i(n.autolink).replace("scheme", n._scheme).replace("email", n._email).getRegex()),
    + (n._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/),
    + (n.tag = i(n.tag).replace("comment", x._comment).replace("attribute", n._attribute).getRegex()),
    + (n._label = /(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|`(?!`)|[^\[\]\\`])*?/),
    + (n._href = /\s*(<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*)/),
    + (n._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/),
    + (n.link = i(n.link).replace("label", n._label).replace("href", n._href).replace("title", n._title).getRegex()),
    + (n.reflink = i(n.reflink).replace("label", n._label).getRegex()),
    + (n.normal = d({}, n)),
    + (n.pedantic = d({}, n.normal, {
    + strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
    + em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,
    + link: i(/^!?\[(label)\]\((.*?)\)/)
    + .replace("label", n._label)
    + .getRegex(),
    + reflink: i(/^!?\[(label)\]\s*\[([^\]]*)\]/)
    + .replace("label", n._label)
    + .getRegex(),
    + })),
    + (n.gfm = d({}, n.normal, {
    + escape: i(n.escape).replace("])", "~|])").getRegex(),
    + _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
    + url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
    + _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
    + del: /^~+(?=\S)([\s\S]*?\S)~+/,
    + text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\
    + })),
    + (n.gfm.url = i(n.gfm.url, "i").replace("email", n.gfm._extended_email).getRegex()),
    + (n.breaks = d({}, n.gfm, {
    + br: i(n.br).replace("{2,}", "*").getRegex(),
    + text: i(n.gfm.text)
    + .replace("\\b_", "\\b_| {2,}\\n")
    + .replace(/\{2,\}/g, "*")
    + .getRegex(),
    + })),
    + (p.rules = n),
    + (p.output = function (e, t, n) {
    + return new p(t, n).output(e)
    + }),
    + (p.prototype.output = function (e) {
    + for (var t, n, r, s, i, l, o = ""; e; )
    + if ((i = this.rules.escape.exec(e))) (e = e.substring(i[0].length)), (o += u(i[1]))
    + else if ((i = this.rules.tag.exec(e)))
    + var r = '
    + }),
    + (r.prototype.image = function (e, t, n) {
    + if (null === (e = l(this.options.sanitize, this.options.baseUrl, e))) return n
    + var r = '' + n + '
    + return t && (r += ' title="' + t + '"'), (r += this.options.xhtml ? "/>" : ">")
    + }),
    + (r.prototype.text = function (e) {
    + return e
    + }),
    + (s.prototype.strong =
    + s.prototype.em =
    + s.prototype.codespan =
    + s.prototype.del =
    + s.prototype.text =
    + function (e) {
    + return e
    + }),
    + (s.prototype.link = s.prototype.image =
    + function (e, t, n) {
    + return "" + n
    + }),
    + (s.prototype.br = function () {
    + return ""
    + }),
    + (h.parse = function (e, t) {
    + return new h(t).parse(e)
    + }),
    + (h.prototype.parse = function (e) {
    + ;(this.inline = new p(e.links, this.options)), (this.inlineText = new p(e.links, d({}, this.options, { renderer: new s() }))), (this.tokens = e.reverse())
    + for (var t = ""; this.next(); ) t += this.tok()
    + return t
    + }),
    + (h.prototype.next = function () {
    + return (this.token = this.tokens.pop()), this.token
    + }),
    + (h.prototype.peek = function () {
    + return this.tokens[this.tokens.length - 1] || 0
    + }),
    + (h.prototype.parseText = function () {
    + for (var e = this.token.text; "text" === this.peek().type; ) e += "\n" + this.next().text
    + return this.inline.output(e)
    + }),
    + (h.prototype.tok = function () {
    + switch (this.token.type) {
    + case "space":
    + return ""
    + case "hr":
    + return this.renderer.hr()
    + case "heading":
    + return this.renderer.heading(this.inline.output(this.token.text), this.token.depth, c(this.inlineText.output(this.token.text)), this.slugger)
    + case "code":
    + return this.renderer.code(this.token.text, this.token.lang, this.token.escaped)
    + case "table":
    + var e,
    + t,
    + n,
    + r,
    + s = "",
    + i = ""
    + for (n = "", e = 0; e < this.token.header.length; e++) n += this.renderer.tablecell(this.inline.output(this.token.header[e]), { header: !0, align: this.token.align[e] })
    + for (s += this.renderer.tablerow(n), e = 0; e < this.token.cells.length; e++) {
    + for (t = this.token.cells[e], n = "", r = 0; r < t.length; r++) n += this.renderer.tablecell(this.inline.output(t[r]), { header: !1, align: this.token.align[r] })
    + i += this.renderer.tablerow(n)
    + }
    + return this.renderer.table(s, i)
    + case "blockquote_start":
    + for (i = ""; "blockquote_end" !== this.next().type; ) i += this.tok()
    + return this.renderer.blockquote(i)
    + case "list_start":
    + i = ""
    + for (var l = this.token.ordered, o = this.token.start; "list_end" !== this.next().type; ) i += this.tok()
    + return this.renderer.list(i, l, o)
    + case "list_item_start":
    + i = ""
    + var a = this.token.loose,
    + h = this.token.checked,
    + p = this.token.task
    + for (this.token.task && (i += this.renderer.checkbox(h)); "list_item_end" !== this.next().type; ) i += a || "text" !== this.token.type ? this.tok() : this.parseText()
    + return this.renderer.listitem(i, p, h)
    + case "html":
    + return this.renderer.html(this.token.text)
    + case "paragraph":
    + return this.renderer.paragraph(this.inline.output(this.token.text))
    + case "text":
    + return this.renderer.paragraph(this.parseText())
    + default:
    + var u = 'Token with "' + this.token.type + '" type was not found.'
    + if (!this.options.silent) throw new Error(u)
    + console.log(u)
    + }
    + }),
    + (t.prototype.slug = function (e) {
    + var t = e
    + .toLowerCase()
    + .trim()
    + .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "")
    + .replace(/\s/g, "-")
    + if (this.seen.hasOwnProperty(t)) for (var n = t; this.seen[n]++, (t = n + "-" + this.seen[n]), this.seen.hasOwnProperty(t); );
    + return (this.seen[t] = 0), t
    + }),
    + (u.escapeTest = /[&<>"']/),
    + (u.escapeReplace = /[&<>"']/g),
    + (u.replacements = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }),
    + (u.escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/),
    + (u.escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g)
    + var o = {},
    + g = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i
    + function f() {}
    + function d(e) {
    + for (var t, n, r = 1; r < arguments.length; r++) for (n in (t = arguments[r])) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n])
    + return e
    + }
    + function y(e, t) {
    + var n = e
    + .replace(/\|/g, function (e, t, n) {
    + for (var r = !1, s = t; 0 <= --s && "\\" === n[s]; ) r = !r
    + return r ? "|" : " |"
    + })
    + .split(/ \|/),
    + r = 0
    + if (n.length > t) n.splice(t)
    + else for (; n.length < t; ) n.push("")
    + for (; r < n.length; r++) n[r] = n[r].trim().replace(/\\\|/g, "|")
    + return n
    + }
    + function _(e, t, n) {
    + if (0 === e.length) return ""
    + for (var r = 0; r < e.length; ) {
    + var s = e.charAt(e.length - r - 1)
    + if (s !== t || n) {
    + if (s === t || !n) break
    + r++
    + } else r++
    + }
    + return e.substr(0, e.length - r)
    + }
    + function m(e, t) {
    + if (-1 === e.indexOf(t[1])) return -1
    + for (var n = 0, r = 0; r < e.length; r++)
    + if ("\\" === e[r]) r++
    + else if (e[r] === t[0]) n++
    + else if (e[r] === t[1] && --n < 0) return r
    + return -1
    + }
    + function b(e, n, r) {
    + if (null == e) throw new Error("marked(): input parameter is undefined or null")
    + if ("string" != typeof e) throw new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected")
    + if (r || "function" == typeof n) {
    + r || ((r = n), (n = null))
    + var s,
    + i,
    + l = (n = d({}, b.defaults, n || {})).highlight,
    + t = 0
    + try {
    + s = a.lex(e, n)
    + } catch (e) {
    + return r(e)
    + }
    + i = s.length
    + var o = function (t) {
    + if (t) return (n.highlight = l), r(t)
    + var e
    + try {
    + e = h.parse(s, n)
    + } catch (e) {
    + t = e
    + }
    + return (n.highlight = l), t ? r(t) : r(null, e)
    + }
    + if (!l || l.length < 3) return o()
    + if ((delete n.highlight, !i)) return o()
    + for (; t < s.length; t++)
    + !(function (n) {
    + "code" !== n.type
    + ? --i || o()
    + : l(n.text, n.lang, function (e, t) {
    + return e ? o(e) : null == t || t === n.text ? --i || o() : ((n.text = t), (n.escaped = !0), void (--i || o()))
    + })
    + })(s[t])
    + } else
    + try {
    + return n && (n = d({}, b.defaults, n)), h.parse(a.lex(e, n), n)
    + } catch (e) {
    + if (((e.message += "\nPlease report this to https://github.com/markedjs/marked."), (n || b.defaults).silent))
    + return "

    An error occurred:

    " + u(e.message + "", !0) + "
    "
    + throw e
    + }
    + }
    + ;(f.exec = f),
    + (b.options = b.setOptions =
    + function (e) {
    + return d(b.defaults, e), b
    + }),
    + (b.getDefaults = function () {
    + return {
    + baseUrl: null,
    + breaks: !1,
    + gfm: !0,
    + headerIds: !0,
    + headerPrefix: "",
    + highlight: null,
    + langPrefix: "language-",
    + mangle: !0,
    + pedantic: !1,
    + renderer: new r(),
    + sanitize: !1,
    + sanitizer: null,
    + silent: !1,
    + smartLists: !1,
    + smartypants: !1,
    + tables: !0,
    + xhtml: !1,
    + }
    + }),
    + (b.defaults = b.getDefaults()),
    + (b.Parser = h),
    + (b.parser = h.parse),
    + (b.Renderer = r),
    + (b.TextRenderer = s),
    + (b.Lexer = a),
    + (b.lexer = a.lex),
    + (b.InlineLexer = p),
    + (b.inlineLexer = p.output),
    + (b.Slugger = t),
    + (b.parse = b),
    + "undefined" != typeof module && "object" == typeof exports
    + ? (module.exports = b)
    + : "function" == typeof define && define.amd
    + ? define(function () {
    + return b
    + })
    + : (e.marked = b)
    + })(this || ("undefined" != typeof window ? window : global))
    Changed around line 3404: function replaceEndian (options, matchedPart, first, separator, second, third) {
    - !function(a,b){"function"==typeof define&&define.amd?define(b):"object"==typeof module&&module.exports?module.exports=b():a.numeral=b()}(this,function(){function a(a,b){this._input=a,this._value=b}var b,c,d="2.0.6",e={},f={},g={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},h={currentLocale:g.currentLocale,zeroFormat:g.zeroFormat,nullFormat:g.nullFormat,defaultFormat:g.defaultFormat,scalePercentBy100:g.scalePercentBy100};return b=function(d){var f,g,i,j;if(b.isNumeral(d))f=d.value();else if(0===d||"undefined"==typeof d)f=0;else if(null===d||c.isNaN(d))f=null;else if("string"==typeof d)if(h.zeroFormat&&d===h.zeroFormat)f=0;else if(h.nullFormat&&d===h.nullFormat||!d.replace(/[^0-9]+/g,"").length)f=null;else{for(g in e)if(j="function"==typeof e[g].regexps.unformat?e[g].regexps.unformat():e[g].regexps.unformat,j&&d.match(j)){i=e[g].unformat;break}i=i||b._.stringToNumber,f=i(d)}else f=Number(d)||null;return new a(d,f)},b.version=d,b.isNumeral=function(b){return b instanceof a},b._=c={numberToFormat:function(a,c,d){var e,g,h,i,j,k,l,m=f[b.options.currentLocale],n=!1,o=!1,p=0,q="",r=1e12,s=1e9,t=1e6,u=1e3,v="",w=!1;if(a=a||0,g=Math.abs(a),b._.includes(c,"(")?(n=!0,c=c.replace(/[\(|\)]/g,"")):(b._.includes(c,"+")||b._.includes(c,"-"))&&(j=b._.includes(c,"+")?c.indexOf("+"):0>a?c.indexOf("-"):-1,c=c.replace(/[\+|\-]/g,"")),b._.includes(c,"a")&&(e=c.match(/a(k|m|b|t)?/),e=e?e[1]:!1,b._.includes(c," a")&&(q=" "),c=c.replace(new RegExp(q+"a[kmbt]?"),""),g>=r&&!e||"t"===e?(q+=m.abbreviations.trillion,a/=r):r>g&&g>=s&&!e||"b"===e?(q+=m.abbreviations.billion,a/=s):s>g&&g>=t&&!e||"m"===e?(q+=m.abbreviations.million,a/=t):(t>g&&g>=u&&!e||"k"===e)&&(q+=m.abbreviations.thousand,a/=u)),b._.includes(c,"[.]")&&(o=!0,c=c.replace("[.]",".")),h=a.toString().split(".")[0],i=c.split(".")[1],k=c.indexOf(","),p=(c.split(".")[0].split(",")[0].match(/0/g)||[]).length,i?(b._.includes(i,"[")?(i=i.replace("]",""),i=i.split("["),v=b._.toFixed(a,i[0].length+i[1].length,d,i[1].length)):v=b._.toFixed(a,i.length,d),h=v.split(".")[0],v=b._.includes(v,".")?m.delimiters.decimal+v.split(".")[1]:"",o&&0===Number(v.slice(1))&&(v="")):h=b._.toFixed(a,0,d),q&&!e&&Number(h)>=1e3&&q!==m.abbreviations.trillion)switch(h=String(Number(h)/1e3),q){case m.abbreviations.thousand:q=m.abbreviations.million;break;case m.abbreviations.million:q=m.abbreviations.billion;break;case m.abbreviations.billion:q=m.abbreviations.trillion}if(b._.includes(h,"-")&&(h=h.slice(1),w=!0),h.length0;x--)h="0"+h;return k>-1&&(h=h.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+m.delimiters.thousands)),0===c.indexOf(".")&&(h=""),l=h+v+(q?q:""),n?l=(n&&w?"(":"")+l+(n&&w?")":""):j>=0?l=0===j?(w?"-":"+")+l:l+(w?"-":"+"):w&&(l="-"+l),l},stringToNumber:function(a){var b,c,d,e=f[h.currentLocale],g=a,i={thousand:3,million:6,billion:9,trillion:12};if(h.zeroFormat&&a===h.zeroFormat)c=0;else if(h.nullFormat&&a===h.nullFormat||!a.replace(/[^0-9]+/g,"").length)c=null;else{c=1,"."!==e.delimiters.decimal&&(a=a.replace(/\./g,"").replace(e.delimiters.decimal,"."));for(b in i)if(d=new RegExp("[^a-zA-Z]"+e.abbreviations[b]+"(?:\\)|(\\"+e.currency.symbol+")?(?:\\))?)?$"),g.match(d)){c*=Math.pow(10,i[b]);break}c*=(a.split("-").length+Math.min(a.split("(").length-1,a.split(")").length-1))%2?1:-1,a=a.replace(/[^0-9\.]+/g,""),c*=Number(a)}return c},isNaN:function(a){return"number"==typeof a&&isNaN(a)},includes:function(a,b){return-1!==a.indexOf(b)},insert:function(a,b,c){return a.slice(0,c)+b+a.slice(c)},reduce:function(a,b){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof b)throw new TypeError(b+" is not a function");var c,d=Object(a),e=d.length>>>0,f=0;if(3===arguments.length)c=arguments[2];else{for(;e>f&&!(f in d);)f++;if(f>=e)throw new TypeError("Reduce of empty array with no initial value");c=d[f++]}for(;e>f;f++)f in d&&(c=b(c,d[f],f,d));return c},multiplier:function(a){var b=a.toString().split(".");return b.length<2?1:Math.pow(10,b[1].length)},correctionFactor:function(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(a,b){var d=c.multiplier(b);return a>d?a:d},1)},toFixed:function(a,b,c,d){var e,f,g,h,i=a.toString().split("."),j=b-(d||0);return e=2===i.length?Math.min(Math.max(i[1].length,j),b):j,g=Math.pow(10,e),h=(c(a+"e+"+e)/g).toFixed(e),d>b-e&&(f=new RegExp("\\.?0{1,"+(d-(b-e))+"}$"),h=h.replace(f,"")),h}},b.options=h,b.formats=e,b.locales=f,b.locale=function(a){return a&&(h.currentLocale=a.toLowerCase()),h.currentLocale},b.localeData=function(a){if(!a)return f[h.currentLocale];if(a=a.toLowerCase(),!f[a])throw new Error("Unknown locale : "+a);return f[a]},b.reset=function(){for(var a in g)h[a]=g[a]},b.zeroFormat=function(a){h.zeroFormat="string"==typeof a?a:null},b.nullFormat=function(a){h.nullFormat="string"==typeof a?a:null},b.defaultFormat=function(a){h.defaultFormat="string"==typeof a?a:"0.0"},b.register=function(a,b,c){if(b=b.toLowerCase(),this[a+"s"][b])throw new TypeError(b+" "+a+" already registered.");return this[a+"s"][b]=c,c},b.validate=function(a,c){var d,e,f,g,h,i,j,k;if("string"!=typeof a&&(a+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",a)),a=a.trim(),a.match(/^\d+$/))return!0;if(""===a)return!1;try{j=b.localeData(c)}catch(l){j=b.localeData(b.locale())}return f=j.currency.symbol,h=j.abbreviations,d=j.delimiters.decimal,e="."===j.delimiters.thousands?"\\.":j.delimiters.thousands,k=a.match(/^[^\d]+/),null!==k&&(a=a.substr(1),k[0]!==f)?!1:(k=a.match(/[^\d]+$/),null!==k&&(a=a.slice(0,-1),k[0]!==h.thousand&&k[0]!==h.million&&k[0]!==h.billion&&k[0]!==h.trillion)?!1:(i=new RegExp(e+"{2}"),a.match(/[^\d.,]/g)?!1:(g=a.split(d),g.length>2?!1:g.length<2?!!g[0].match(/^\d+.*\d$/)&&!g[0].match(i):1===g[0].length?!!g[0].match(/^\d+$/)&&!g[0].match(i)&&!!g[1].match(/^\d+$/):!!g[0].match(/^\d+.*\d$/)&&!g[0].match(i)&&!!g[1].match(/^\d+$/))))},b.fn=a.prototype={clone:function(){return b(this)},format:function(a,c){var d,f,g,i=this._value,j=a||h.defaultFormat;if(c=c||Math.round,0===i&&null!==h.zeroFormat)f=h.zeroFormat;else if(null===i&&null!==h.nullFormat)f=h.nullFormat;else{for(d in e)if(j.match(e[d].regexps.format)){g=e[d].format;break}g=g||b._.numberToFormat,f=g(i,j,c)}return f},value:function(){return this._value},input:function(){return this._input},set:function(a){return this._value=Number(a),this},add:function(a){function b(a,b,c,e){return a+Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([this._value,a],b,0)/d,this},subtract:function(a){function b(a,b,c,e){return a-Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([a],b,Math.round(this._value*d))/d,this},multiply:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)*Math.round(b*f)/Math.round(f*f)}return this._value=c.reduce([this._value,a],b,1),this},divide:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)/Math.round(b*f)}return this._value=c.reduce([this._value,a],b),this},difference:function(a){return Math.abs(b(this._value).subtract(a).value())}},b.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var b=a%10;return 1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th"},currency:{symbol:"$"}}),function(){b.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(a,c,d){var e,f=b._.includes(c," BPS")?" ":"";return a=1e4*a,c=c.replace(/\s?BPS/,""),e=b._.numberToFormat(a,c,d),b._.includes(e,")")?(e=e.split(""),e.splice(-1,0,f+"BPS"),e=e.join("")):e=e+f+"BPS",e},unformat:function(a){return+(1e-4*b._.stringToNumber(a)).toFixed(15)}})}(),function(){var a={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},c={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},d=a.suffixes.concat(c.suffixes.filter(function(b){return a.suffixes.indexOf(b)<0})),e=d.join("|");e="("+e.replace("B","B(?!PS)")+")",b.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(e)},format:function(d,e,f){var g,h,i,j,k=b._.includes(e,"ib")?c:a,l=b._.includes(e," b")||b._.includes(e," ib")?" ":"";for(e=e.replace(/\s?i?b/,""),h=0;h<=k.suffixes.length;h++)if(i=Math.pow(k.base,h),j=Math.pow(k.base,h+1),null===d||0===d||d>=i&&j>d){l+=k.suffixes[h],i>0&&(d/=i);break}return g=b._.numberToFormat(d,e,f),g+l},unformat:function(d){var e,f,g=b._.stringToNumber(d);if(g){for(e=a.suffixes.length-1;e>=0;e--){if(b._.includes(d,a.suffixes[e])){f=Math.pow(a.base,e);break}if(b._.includes(d,c.suffixes[e])){f=Math.pow(c.base,e);break}}g*=f||1}return g}})}(),function(){b.register("format","currency",{regexps:{format:/(\$)/},format:function(a,c,d){var e,f,g,h=b.locales[b.options.currentLocale],i={before:c.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:c.match(/([\+|\-|\)|\s|\$]*)$/)[0]};for(c=c.replace(/\s?\$\s?/,""),e=b._.numberToFormat(a,c,d),a>=0?(i.before=i.before.replace(/[\-\(]/,""),i.after=i.after.replace(/[\-\)]/,"")):0>a&&!b._.includes(i.before,"-")&&!b._.includes(i.before,"(")&&(i.before="-"+i.before),g=0;g=0;g--)switch(f=i.after[g]){case"$":e=g===i.after.length-1?e+h.currency.symbol:b._.insert(e,h.currency.symbol,-(i.after.length-(1+g)));break;case" ":e=g===i.after.length-1?e+" ":b._.insert(e," ",-(i.after.length-(1+g)+h.currency.symbol.length-1))}return e}})}(),function(){b.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(a,c,d){var e,f="number"!=typeof a||b._.isNaN(a)?"0e+0":a.toExponential(),g=f.split("e");return c=c.replace(/e[\+|\-]{1}0/,""),e=b._.numberToFormat(Number(g[0]),c,d),e+"e"+g[1]},unformat:function(a){function c(a,c,d,e){var f=b._.correctionFactor(a,c),g=a*f*(c*f)/(f*f);return g}var d=b._.includes(a,"e+")?a.split("e+"):a.split("e-"),e=Number(d[0]),f=Number(d[1]);return f=b._.includes(a,"e-")?f*=-1:f,b._.reduce([e,Math.pow(10,f)],c,1)}})}(),function(){b.register("format","ordinal",{regexps:{format:/(o)/},format:function(a,c,d){var e,f=b.locales[b.options.currentLocale],g=b._.includes(c," o")?" ":"";return c=c.replace(/\s?o/,""),g+=f.ordinal(a),e=b._.numberToFormat(a,c,d),e+g}})}(),function(){b.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(a,c,d){var e,f=b._.includes(c," %")?" ":"";return b.options.scalePercentBy100&&(a=100*a),c=c.replace(/\s?\%/,""),e=b._.numberToFormat(a,c,d),b._.includes(e,")")?(e=e.split(""),e.splice(-1,0,f+"%"),e=e.join("")):e=e+f+"%",e},unformat:function(a){var c=b._.stringToNumber(a);return b.options.scalePercentBy100?.01*c:c}})}(),function(){b.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(a,b,c){var d=Math.floor(a/60/60),e=Math.floor((a-60*d*60)/60),f=Math.round(a-60*d*60-60*e);return d+":"+(10>e?"0"+e:e)+":"+(10>f?"0"+f:f)},unformat:function(a){var b=a.split(":"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}})}(),b});;
    + !(function (a, b) {
    + "function" == typeof define && define.amd ? define(b) : "object" == typeof module && module.exports ? (module.exports = b()) : (a.numeral = b())
    + })(this, function () {
    + function a(a, b) {
    + ;(this._input = a), (this._value = b)
    + }
    + var b,
    + c,
    + d = "2.0.6",
    + e = {},
    + f = {},
    + g = { currentLocale: "en", zeroFormat: null, nullFormat: null, defaultFormat: "0,0", scalePercentBy100: !0 },
    + h = { currentLocale: g.currentLocale, zeroFormat: g.zeroFormat, nullFormat: g.nullFormat, defaultFormat: g.defaultFormat, scalePercentBy100: g.scalePercentBy100 }
    + return (
    + (b = function (d) {
    + var f, g, i, j
    + if (b.isNumeral(d)) f = d.value()
    + else if (0 === d || "undefined" == typeof d) f = 0
    + else if (null === d || c.isNaN(d)) f = null
    + else if ("string" == typeof d)
    + if (h.zeroFormat && d === h.zeroFormat) f = 0
    + else if ((h.nullFormat && d === h.nullFormat) || !d.replace(/[^0-9]+/g, "").length) f = null
    + else {
    + for (g in e)
    + if (((j = "function" == typeof e[g].regexps.unformat ? e[g].regexps.unformat() : e[g].regexps.unformat), j && d.match(j))) {
    + i = e[g].unformat
    + break
    + }
    + ;(i = i || b._.stringToNumber), (f = i(d))
    + }
    + else f = Number(d) || null
    + return new a(d, f)
    + }),
    + (b.version = d),
    + (b.isNumeral = function (b) {
    + return b instanceof a
    + }),
    + (b._ = c =
    + {
    + numberToFormat: function (a, c, d) {
    + var e,
    + g,
    + h,
    + i,
    + j,
    + k,
    + l,
    + m = f[b.options.currentLocale],
    + n = !1,
    + o = !1,
    + p = 0,
    + q = "",
    + r = 1e12,
    + s = 1e9,
    + t = 1e6,
    + u = 1e3,
    + v = "",
    + w = !1
    + if (
    + ((a = a || 0),
    + (g = Math.abs(a)),
    + b._.includes(c, "(")
    + ? ((n = !0), (c = c.replace(/[\(|\)]/g, "")))
    + : (b._.includes(c, "+") || b._.includes(c, "-")) && ((j = b._.includes(c, "+") ? c.indexOf("+") : 0 > a ? c.indexOf("-") : -1), (c = c.replace(/[\+|\-]/g, ""))),
    + b._.includes(c, "a") &&
    + ((e = c.match(/a(k|m|b|t)?/)),
    + (e = e ? e[1] : !1),
    + b._.includes(c, " a") && (q = " "),
    + (c = c.replace(new RegExp(q + "a[kmbt]?"), "")),
    + (g >= r && !e) || "t" === e
    + ? ((q += m.abbreviations.trillion), (a /= r))
    + : (r > g && g >= s && !e) || "b" === e
    + ? ((q += m.abbreviations.billion), (a /= s))
    + : (s > g && g >= t && !e) || "m" === e
    + ? ((q += m.abbreviations.million), (a /= t))
    + : ((t > g && g >= u && !e) || "k" === e) && ((q += m.abbreviations.thousand), (a /= u))),
    + b._.includes(c, "[.]") && ((o = !0), (c = c.replace("[.]", "."))),
    + (h = a.toString().split(".")[0]),
    + (i = c.split(".")[1]),
    + (k = c.indexOf(",")),
    + (p = (c.split(".")[0].split(",")[0].match(/0/g) || []).length),
    + i
    + ? (b._.includes(i, "[")
    + ? ((i = i.replace("]", "")), (i = i.split("[")), (v = b._.toFixed(a, i[0].length + i[1].length, d, i[1].length)))
    + : (v = b._.toFixed(a, i.length, d)),
    + (h = v.split(".")[0]),
    + (v = b._.includes(v, ".") ? m.delimiters.decimal + v.split(".")[1] : ""),
    + o && 0 === Number(v.slice(1)) && (v = ""))
    + : (h = b._.toFixed(a, 0, d)),
    + q && !e && Number(h) >= 1e3 && q !== m.abbreviations.trillion)
    + )
    + switch (((h = String(Number(h) / 1e3)), q)) {
    + case m.abbreviations.thousand:
    + q = m.abbreviations.million
    + break
    + case m.abbreviations.million:
    + q = m.abbreviations.billion
    + break
    + case m.abbreviations.billion:
    + q = m.abbreviations.trillion
    + }
    + if ((b._.includes(h, "-") && ((h = h.slice(1)), (w = !0)), h.length < p)) for (var x = p - h.length; x > 0; x--) h = "0" + h
    + return (
    + k > -1 && (h = h.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1" + m.delimiters.thousands)),
    + 0 === c.indexOf(".") && (h = ""),
    + (l = h + v + (q ? q : "")),
    + n ? (l = (n && w ? "(" : "") + l + (n && w ? ")" : "")) : j >= 0 ? (l = 0 === j ? (w ? "-" : "+") + l : l + (w ? "-" : "+")) : w && (l = "-" + l),
    + l
    + )
    + },
    + stringToNumber: function (a) {
    + var b,
    + c,
    + d,
    + e = f[h.currentLocale],
    + g = a,
    + i = { thousand: 3, million: 6, billion: 9, trillion: 12 }
    + if (h.zeroFormat && a === h.zeroFormat) c = 0
    + else if ((h.nullFormat && a === h.nullFormat) || !a.replace(/[^0-9]+/g, "").length) c = null
    + else {
    + ;(c = 1), "." !== e.delimiters.decimal && (a = a.replace(/\./g, "").replace(e.delimiters.decimal, "."))
    + for (b in i)
    + if (((d = new RegExp("[^a-zA-Z]" + e.abbreviations[b] + "(?:\\)|(\\" + e.currency.symbol + ")?(?:\\))?)?$")), g.match(d))) {
    + c *= Math.pow(10, i[b])
    + break
    + }
    + ;(c *= (a.split("-").length + Math.min(a.split("(").length - 1, a.split(")").length - 1)) % 2 ? 1 : -1), (a = a.replace(/[^0-9\.]+/g, "")), (c *= Number(a))
    + }
    + return c
    + },
    + isNaN: function (a) {
    + return "number" == typeof a && isNaN(a)
    + },
    + includes: function (a, b) {
    + return -1 !== a.indexOf(b)
    + },
    + insert: function (a, b, c) {
    + return a.slice(0, c) + b + a.slice(c)
    + },
    + reduce: function (a, b) {
    + if (null === this) throw new TypeError("Array.prototype.reduce called on null or undefined")
    + if ("function" != typeof b) throw new TypeError(b + " is not a function")
    + var c,
    + d = Object(a),
    + e = d.length >>> 0,
    + f = 0
    + if (3 === arguments.length) c = arguments[2]
    + else {
    + for (; e > f && !(f in d); ) f++
    + if (f >= e) throw new TypeError("Reduce of empty array with no initial value")
    + c = d[f++]
    + }
    + for (; e > f; f++) f in d && (c = b(c, d[f], f, d))
    + return c
    + },
    + multiplier: function (a) {
    + var b = a.toString().split(".")
    + return b.length < 2 ? 1 : Math.pow(10, b[1].length)
    + },
    + correctionFactor: function () {
    + var a = Array.prototype.slice.call(arguments)
    + return a.reduce(function (a, b) {
    + var d = c.multiplier(b)
    + return a > d ? a : d
    + }, 1)
    + },
    + toFixed: function (a, b, c, d) {
    + var e,
    + f,
    + g,
    + h,
    + i = a.toString().split("."),
    + j = b - (d || 0)
    + return (
    + (e = 2 === i.length ? Math.min(Math.max(i[1].length, j), b) : j),
    + (g = Math.pow(10, e)),
    + (h = (c(a + "e+" + e) / g).toFixed(e)),
    + d > b - e && ((f = new RegExp("\\.?0{1," + (d - (b - e)) + "}$")), (h = h.replace(f, ""))),
    + h
    + )
    + },
    + }),
    + (b.options = h),
    + (b.formats = e),
    + (b.locales = f),
    + (b.locale = function (a) {
    + return a && (h.currentLocale = a.toLowerCase()), h.currentLocale
    + }),
    + (b.localeData = function (a) {
    + if (!a) return f[h.currentLocale]
    + if (((a = a.toLowerCase()), !f[a])) throw new Error("Unknown locale : " + a)
    + return f[a]
    + }),
    + (b.reset = function () {
    + for (var a in g) h[a] = g[a]
    + }),
    + (b.zeroFormat = function (a) {
    + h.zeroFormat = "string" == typeof a ? a : null
    + }),
    + (b.nullFormat = function (a) {
    + h.nullFormat = "string" == typeof a ? a : null
    + }),
    + (b.defaultFormat = function (a) {
    + h.defaultFormat = "string" == typeof a ? a : "0.0"
    + }),
    + (b.register = function (a, b, c) {
    + if (((b = b.toLowerCase()), this[a + "s"][b])) throw new TypeError(b + " " + a + " already registered.")
    + return (this[a + "s"][b] = c), c
    + }),
    + (b.validate = function (a, c) {
    + var d, e, f, g, h, i, j, k
    + if (("string" != typeof a && ((a += ""), console.warn && console.warn("Numeral.js: Value is not string. It has been co-erced to: ", a)), (a = a.trim()), a.match(/^\d+$/)))
    + return !0
    + if ("" === a) return !1
    + try {
    + j = b.localeData(c)
    + } catch (l) {
    + j = b.localeData(b.locale())
    + }
    + return (
    + (f = j.currency.symbol),
    + (h = j.abbreviations),
    + (d = j.delimiters.decimal),
    + (e = "." === j.delimiters.thousands ? "\\." : j.delimiters.thousands),
    + (k = a.match(/^[^\d]+/)),
    + null !== k && ((a = a.substr(1)), k[0] !== f)
    + ? !1
    + : ((k = a.match(/[^\d]+$/)),
    + null !== k && ((a = a.slice(0, -1)), k[0] !== h.thousand && k[0] !== h.million && k[0] !== h.billion && k[0] !== h.trillion)
    + ? !1
    + : ((i = new RegExp(e + "{2}")),
    + a.match(/[^\d.,]/g)
    + ? !1
    + : ((g = a.split(d)),
    + g.length > 2
    + ? !1
    + : g.length < 2
    + ? !!g[0].match(/^\d+.*\d$/) && !g[0].match(i)
    + : 1 === g[0].length
    + ? !!g[0].match(/^\d+$/) && !g[0].match(i) && !!g[1].match(/^\d+$/)
    + : !!g[0].match(/^\d+.*\d$/) && !g[0].match(i) && !!g[1].match(/^\d+$/))))
    + )
    + }),
    + (b.fn = a.prototype =
    + {
    + clone: function () {
    + return b(this)
    + },
    + format: function (a, c) {
    + var d,
    + f,
    + g,
    + i = this._value,
    + j = a || h.defaultFormat
    + if (((c = c || Math.round), 0 === i && null !== h.zeroFormat)) f = h.zeroFormat
    + else if (null === i && null !== h.nullFormat) f = h.nullFormat
    + else {
    + for (d in e)
    + if (j.match(e[d].regexps.format)) {
    + g = e[d].format
    + break
    + }
    + ;(g = g || b._.numberToFormat), (f = g(i, j, c))
    + }
    + return f
    + },
    + value: function () {
    + return this._value
    + },
    + input: function () {
    + return this._input
    + },
    + set: function (a) {
    + return (this._value = Number(a)), this
    + },
    + add: function (a) {
    + function b(a, b, c, e) {
    + return a + Math.round(d * b)
    + }
    + var d = c.correctionFactor.call(null, this._value, a)
    + return (this._value = c.reduce([this._value, a], b, 0) / d), this
    + },
    + subtract: function (a) {
    + function b(a, b, c, e) {
    + return a - Math.round(d * b)
    + }
    + var d = c.correctionFactor.call(null, this._value, a)
    + return (this._value = c.reduce([a], b, Math.round(this._value * d)) / d), this
    + },
    + multiply: function (a) {
    + function b(a, b, d, e) {
    + var f = c.correctionFactor(a, b)
    + return (Math.round(a * f) * Math.round(b * f)) / Math.round(f * f)
    + }
    + return (this._value = c.reduce([this._value, a], b, 1)), this
    + },
    + divide: function (a) {
    + function b(a, b, d, e) {
    + var f = c.correctionFactor(a, b)
    + return Math.round(a * f) / Math.round(b * f)
    + }
    + return (this._value = c.reduce([this._value, a], b)), this
    + },
    + difference: function (a) {
    + return Math.abs(b(this._value).subtract(a).value())
    + },
    + }),
    + b.register("locale", "en", {
    + delimiters: { thousands: ",", decimal: "." },
    + abbreviations: { thousand: "k", million: "m", billion: "b", trillion: "t" },
    + ordinal: function (a) {
    + var b = a % 10
    + return 1 === ~~((a % 100) / 10) ? "th" : 1 === b ? "st" : 2 === b ? "nd" : 3 === b ? "rd" : "th"
    + },
    + currency: { symbol: "$" },
    + }),
    + (function () {
    + b.register("format", "bps", {
    + regexps: { format: /(BPS)/, unformat: /(BPS)/ },
    + format: function (a, c, d) {
    + var e,
    + f = b._.includes(c, " BPS") ? " " : ""
    + return (
    + (a = 1e4 * a),
    + (c = c.replace(/\s?BPS/, "")),
    + (e = b._.numberToFormat(a, c, d)),
    + b._.includes(e, ")") ? ((e = e.split("")), e.splice(-1, 0, f + "BPS"), (e = e.join(""))) : (e = e + f + "BPS"),
    + e
    + )
    + },
    + unformat: function (a) {
    + return +(1e-4 * b._.stringToNumber(a)).toFixed(15)
    + },
    + })
    + })(),
    + (function () {
    + var a = { base: 1e3, suffixes: ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] },
    + c = { base: 1024, suffixes: ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"] },
    + d = a.suffixes.concat(
    + c.suffixes.filter(function (b) {
    + return a.suffixes.indexOf(b) < 0
    + })
    + ),
    + e = d.join("|")
    + ;(e = "(" + e.replace("B", "B(?!PS)") + ")"),
    + b.register("format", "bytes", {
    + regexps: { format: /([0\s]i?b)/, unformat: new RegExp(e) },
    + format: function (d, e, f) {
    + var g,
    + h,
    + i,
    + j,
    + k = b._.includes(e, "ib") ? c : a,
    + l = b._.includes(e, " b") || b._.includes(e, " ib") ? " " : ""
    + for (e = e.replace(/\s?i?b/, ""), h = 0; h <= k.suffixes.length; h++)
    + if (((i = Math.pow(k.base, h)), (j = Math.pow(k.base, h + 1)), null === d || 0 === d || (d >= i && j > d))) {
    + ;(l += k.suffixes[h]), i > 0 && (d /= i)
    + break
    + }
    + return (g = b._.numberToFormat(d, e, f)), g + l
    + },
    + unformat: function (d) {
    + var e,
    + f,
    + g = b._.stringToNumber(d)
    + if (g) {
    + for (e = a.suffixes.length - 1; e >= 0; e--) {
    + if (b._.includes(d, a.suffixes[e])) {
    + f = Math.pow(a.base, e)
    + break
    + }
    + if (b._.includes(d, c.suffixes[e])) {
    + f = Math.pow(c.base, e)
    + break
    + }
    + }
    + g *= f || 1
    + }
    + return g
    + },
    + })
    + })(),
    + (function () {
    + b.register("format", "currency", {
    + regexps: { format: /(\$)/ },
    + format: function (a, c, d) {
    + var e,
    + f,
    + g,
    + h = b.locales[b.options.currentLocale],
    + i = { before: c.match(/^([\+|\-|\(|\s|\$]*)/)[0], after: c.match(/([\+|\-|\)|\s|\$]*)$/)[0] }
    + for (
    + c = c.replace(/\s?\$\s?/, ""),
    + e = b._.numberToFormat(a, c, d),
    + a >= 0
    + ? ((i.before = i.before.replace(/[\-\(]/, "")), (i.after = i.after.replace(/[\-\)]/, "")))
    + : 0 > a && !b._.includes(i.before, "-") && !b._.includes(i.before, "(") && (i.before = "-" + i.before),
    + g = 0;
    + g < i.before.length;
    + g++
    + )
    + switch ((f = i.before[g])) {
    + case "$":
    + e = b._.insert(e, h.currency.symbol, g)
    + break
    + case " ":
    + e = b._.insert(e, " ", g + h.currency.symbol.length - 1)
    + }
    + for (g = i.after.length - 1; g >= 0; g--)
    + switch ((f = i.after[g])) {
    + case "$":
    + e = g === i.after.length - 1 ? e + h.currency.symbol : b._.insert(e, h.currency.symbol, -(i.after.length - (1 + g)))
    + break
    + case " ":
    + e = g === i.after.length - 1 ? e + " " : b._.insert(e, " ", -(i.after.length - (1 + g) + h.currency.symbol.length - 1))
    + }
    + return e
    + },
    + })
    + })(),
    + (function () {
    + b.register("format", "exponential", {
    + regexps: { format: /(e\+|e-)/, unformat: /(e\+|e-)/ },
    + format: function (a, c, d) {
    + var e,
    + f = "number" != typeof a || b._.isNaN(a) ? "0e+0" : a.toExponential(),
    + g = f.split("e")
    + return (c = c.replace(/e[\+|\-]{1}0/, "")), (e = b._.numberToFormat(Number(g[0]), c, d)), e + "e" + g[1]
    + },
    + unformat: function (a) {
    + function c(a, c, d, e) {
    + var f = b._.correctionFactor(a, c),
    + g = (a * f * (c * f)) / (f * f)
    + return g
    + }
    + var d = b._.includes(a, "e+") ? a.split("e+") : a.split("e-"),
    + e = Number(d[0]),
    + f = Number(d[1])
    + return (f = b._.includes(a, "e-") ? (f *= -1) : f), b._.reduce([e, Math.pow(10, f)], c, 1)
    + },
    + })
    + })(),
    + (function () {
    + b.register("format", "ordinal", {
    + regexps: { format: /(o)/ },
    + format: function (a, c, d) {
    + var e,
    + f = b.locales[b.options.currentLocale],
    + g = b._.includes(c, " o") ? " " : ""
    + return (c = c.replace(/\s?o/, "")), (g += f.ordinal(a)), (e = b._.numberToFormat(a, c, d)), e + g
    + },
    + })
    + })(),
    + (function () {
    + b.register("format", "percentage", {
    + regexps: { format: /(%)/, unformat: /(%)/ },
    + format: function (a, c, d) {
    + var e,
    + f = b._.includes(c, " %") ? " " : ""
    + return (
    + b.options.scalePercentBy100 && (a = 100 * a),
    + (c = c.replace(/\s?\%/, "")),
    + (e = b._.numberToFormat(a, c, d)),
    + b._.includes(e, ")") ? ((e = e.split("")), e.splice(-1, 0, f + "%"), (e = e.join(""))) : (e = e + f + "%"),
    + e
    + )
    + },
    + unformat: function (a) {
    + var c = b._.stringToNumber(a)
    + return b.options.scalePercentBy100 ? 0.01 * c : c
    + },
    + })
    + })(),
    + (function () {
    + b.register("format", "time", {
    + regexps: { format: /(:)/, unformat: /(:)/ },
    + format: function (a, b, c) {
    + var d = Math.floor(a / 60 / 60),
    + e = Math.floor((a - 60 * d * 60) / 60),
    + f = Math.round(a - 60 * d * 60 - 60 * e)
    + return d + ":" + (10 > e ? "0" + e : e) + ":" + (10 > f ? "0" + f : f)
    + },
    + unformat: function (a) {
    + var b = a.split(":"),
    + c = 0
    + return (
    + 3 === b.length ? ((c += 60 * Number(b[0]) * 60), (c += 60 * Number(b[1])), (c += Number(b[2]))) : 2 === b.length && ((c += 60 * Number(b[0])), (c += Number(b[1]))),
    + Number(c)
    + )
    + },
    + })
    + })(),
    + b
    + )
    + })
    - (function (global, factory) {
    - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
    - typeof define === 'function' && define.amd ? define(['exports'], factory) :
    - (global = global || self, factory(global.d3 = global.d3 || {}));
    - }(this, function (exports) { 'use strict';
    -
    - // Computes the decimal coefficient and exponent of the specified number x with
    - // significant digits p, where x is positive and p is in [1, 21] or undefined.
    - // For example, formatDecimal(1.23) returns ["123", 0].
    - function formatDecimal(x, p) {
    - if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
    - var i, coefficient = x.slice(0, i);
    -
    - // The string returned by toExponential either has the form \d\.\d+e[-+]\d+
    - // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
    - return [
    - coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
    - +x.slice(i + 1)
    - ];
    - }
    -
    - function exponent(x) {
    - return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN;
    - }
    -
    - function formatGroup(grouping, thousands) {
    - return function(value, width) {
    - var i = value.length,
    - t = [],
    - j = 0,
    - g = grouping[0],
    - length = 0;
    -
    - while (i > 0 && g > 0) {
    - if (length + g + 1 > width) g = Math.max(1, width - length);
    - t.push(value.substring(i -= g, i + g));
    - if ((length += g + 1) > width) break;
    - g = grouping[j = (j + 1) % grouping.length];
    - }
    -
    - return t.reverse().join(thousands);
    - };
    - }
    -
    - function formatNumerals(numerals) {
    - return function(value) {
    - return value.replace(/[0-9]/g, function(i) {
    - return numerals[+i];
    - });
    - };
    - }
    -
    - // [[fill]align][sign][symbol][0][width][,][.precision][~][type]
    - var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
    -
    - function formatSpecifier(specifier) {
    - if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
    - var match;
    - return new FormatSpecifier({
    - fill: match[1],
    - align: match[2],
    - sign: match[3],
    - symbol: match[4],
    - zero: match[5],
    - width: match[6],
    - comma: match[7],
    - precision: match[8] && match[8].slice(1),
    - trim: match[9],
    - type: match[10]
    - });
    - }
    -
    - formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof
    -
    - function FormatSpecifier(specifier) {
    - this.fill = specifier.fill === undefined ? " " : specifier.fill + "";
    - this.align = specifier.align === undefined ? ">" : specifier.align + "";
    - this.sign = specifier.sign === undefined ? "-" : specifier.sign + "";
    - this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + "";
    - this.zero = !!specifier.zero;
    - this.width = specifier.width === undefined ? undefined : +specifier.width;
    - this.comma = !!specifier.comma;
    - this.precision = specifier.precision === undefined ? undefined : +specifier.precision;
    - this.trim = !!specifier.trim;
    - this.type = specifier.type === undefined ? "" : specifier.type + "";
    - }
    -
    - FormatSpecifier.prototype.toString = function() {
    - return this.fill
    - + this.align
    - + this.sign
    - + this.symbol
    - + (this.zero ? "0" : "")
    - + (this.width === undefined ? "" : Math.max(1, this.width | 0))
    - + (this.comma ? "," : "")
    - + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0))
    - + (this.trim ? "~" : "")
    - + this.type;
    - };
    -
    - // Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
    - function formatTrim(s) {
    - out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
    - switch (s[i]) {
    - case ".": i0 = i1 = i; break;
    - case "0": if (i0 === 0) i0 = i; i1 = i; break;
    - default: if (i0 > 0) { if (!+s[i]) break out; i0 = 0; } break;
    - }
    - }
    - return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
    - }
    -
    - var prefixExponent;
    -
    - function formatPrefixAuto(x, p) {
    - var d = formatDecimal(x, p);
    - if (!d) return x + "";
    - var coefficient = d[0],
    - exponent = d[1],
    - i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
    - n = coefficient.length;
    - return i === n ? coefficient
    - : i > n ? coefficient + new Array(i - n + 1).join("0")
    - : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
    - : "0." + new Array(1 - i).join("0") + formatDecimal(x, Math.max(0, p + i - 1))[0]; // less than 1y!
    - }
    -
    - function formatRounded(x, p) {
    - var d = formatDecimal(x, p);
    - if (!d) return x + "";
    - var coefficient = d[0],
    - exponent = d[1];
    - return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
    - : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
    - : coefficient + new Array(exponent - coefficient.length + 2).join("0");
    - }
    -
    - var formatTypes = {
    - "%": function(x, p) { return (x * 100).toFixed(p); },
    - "b": function(x) { return Math.round(x).toString(2); },
    - "c": function(x) { return x + ""; },
    - "d": function(x) { return Math.round(x).toString(10); },
    - "e": function(x, p) { return x.toExponential(p); },
    - "f": function(x, p) { return x.toFixed(p); },
    - "g": function(x, p) { return x.toPrecision(p); },
    - "o": function(x) { return Math.round(x).toString(8); },
    - "p": function(x, p) { return formatRounded(x * 100, p); },
    - "r": formatRounded,
    - "s": formatPrefixAuto,
    - "X": function(x) { return Math.round(x).toString(16).toUpperCase(); },
    - "x": function(x) { return Math.round(x).toString(16); }
    - };
    -
    - function identity(x) {
    - return x;
    - }
    -
    - var map = Array.prototype.map,
    - prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
    -
    - function formatLocale(locale) {
    - var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""),
    - currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "",
    - currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "",
    - decimal = locale.decimal === undefined ? "." : locale.decimal + "",
    - numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),
    - percent = locale.percent === undefined ? "%" : locale.percent + "",
    - minus = locale.minus === undefined ? "-" : locale.minus + "",
    - nan = locale.nan === undefined ? "NaN" : locale.nan + "";
    -
    - function newFormat(specifier) {
    - specifier = formatSpecifier(specifier);
    -
    - var fill = specifier.fill,
    - align = specifier.align,
    - sign = specifier.sign,
    - symbol = specifier.symbol,
    - zero = specifier.zero,
    - width = specifier.width,
    - comma = specifier.comma,
    - precision = specifier.precision,
    - trim = specifier.trim,
    - type = specifier.type;
    -
    - // The "n" type is an alias for ",g".
    - if (type === "n") comma = true, type = "g";
    -
    - // The "" type, and any invalid type, is an alias for ".12~g".
    - else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g";
    -
    - // If zero fill is specified, padding goes after sign and before digits.
    - if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
    -
    - // Compute the prefix and suffix.
    - // For SI-prefix, the suffix is lazily computed.
    - var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
    - suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";
    -
    - // What format function should we use?
    - // Is this an integer type?
    - // Can this type generate exponential notation?
    - var formatType = formatTypes[type],
    - maybeSuffix = /[defgprs%]/.test(type);
    -
    - // Set the default precision if not specified,
    - // or clamp the specified precision to the supported range.
    - // For significant precision, it must be in [1, 21].
    - // For fixed precision, it must be in [0, 20].
    - precision = precision === undefined ? 6
    - : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
    - : Math.max(0, Math.min(20, precision));
    -
    - function format(value) {
    - var valuePrefix = prefix,
    - valueSuffix = suffix,
    - i, n, c;
    -
    - if (type === "c") {
    - valueSuffix = formatType(value) + valueSuffix;
    - value = "";
    - } else {
    - value = +value;
    -
    - // Perform the initial formatting.
    - var valueNegative = value < 0;
    - value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
    -
    - // Trim insignificant zeros.
    - if (trim) value = formatTrim(value);
    -
    - // If a negative value rounds to zero during formatting, treat as positive.
    - if (valueNegative && +value === 0) valueNegative = false;
    -
    - // Compute the prefix and suffix.
    - valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
    -
    - valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
    -
    - // Break the formatted value into the integer “value” part that can be
    - // grouped, and fractional or exponential “suffix” part that is not.
    - if (maybeSuffix) {
    - i = -1, n = value.length;
    - while (++i < n) {
    - if (c = value.charCodeAt(i), 48 > c || c > 57) {
    - valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
    - value = value.slice(0, i);
    - break;
    - }
    - }
    - }
    - }
    -
    - // If the fill character is not "0", grouping is applied before padding.
    - if (comma && !zero) value = group(value, Infinity);
    -
    - // Compute the padding.
    - var length = valuePrefix.length + value.length + valueSuffix.length,
    - padding = length < width ? new Array(width - length + 1).join(fill) : "";
    -
    - // If the fill character is "0", grouping is applied after padding.
    - if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
    -
    - // Reconstruct the final output based on the desired alignment.
    - switch (align) {
    - case "<": value = valuePrefix + value + valueSuffix + padding; break;
    - case "=": value = valuePrefix + padding + value + valueSuffix; break;
    - case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;
    - default: value = padding + valuePrefix + value + valueSuffix; break;
    - }
    -
    - return numerals(value);
    - }
    -
    - format.toString = function() {
    - return specifier + "";
    - };
    -
    - return format;
    - }
    -
    - function formatPrefix(specifier, value) {
    - var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)),
    - e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
    - k = Math.pow(10, -e),
    - prefix = prefixes[8 + e / 3];
    - return function(value) {
    - return f(k * value) + prefix;
    - };
    - }
    -
    - return {
    - format: newFormat,
    - formatPrefix: formatPrefix
    - };
    - }
    -
    - var locale;
    -
    - defaultLocale({
    - decimal: ".",
    - thousands: ",",
    - grouping: [3],
    - currency: ["$", ""],
    - minus: "-"
    - });
    -
    - function defaultLocale(definition) {
    - locale = formatLocale(definition);
    - exports.format = locale.format;
    - exports.formatPrefix = locale.formatPrefix;
    - return locale;
    - }
    -
    - function precisionFixed(step) {
    - return Math.max(0, -exponent(Math.abs(step)));
    - }
    -
    - function precisionPrefix(step, value) {
    - return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));
    - }
    -
    - function precisionRound(step, max) {
    - step = Math.abs(step), max = Math.abs(max) - step;
    - return Math.max(0, exponent(max) - exponent(step)) + 1;
    - }
    -
    - exports.FormatSpecifier = FormatSpecifier;
    - exports.formatDefaultLocale = defaultLocale;
    - exports.formatLocale = formatLocale;
    - exports.formatSpecifier = formatSpecifier;
    - exports.precisionFixed = precisionFixed;
    - exports.precisionPrefix = precisionPrefix;
    - exports.precisionRound = precisionRound;
    -
    - Object.defineProperty(exports, '__esModule', { value: true });
    -
    - }));
    - ;
    -
    + ;(function (global, factory) {
    + typeof exports === "object" && typeof module !== "undefined"
    + ? factory(exports)
    + : typeof define === "function" && define.amd
    + ? define(["exports"], factory)
    + : ((global = global || self), factory((global.d3 = global.d3 || {})))
    + })(this, function (exports) {
    + "use strict"
    +
    + // Computes the decimal coefficient and exponent of the specified number x with
    + // significant digits p, where x is positive and p is in [1, 21] or undefined.
    + // For example, formatDecimal(1.23) returns ["123", 0].
    + function formatDecimal(x, p) {
    + if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null // NaN, ±Infinity
    + var i,
    + coefficient = x.slice(0, i)
    +
    + // The string returned by toExponential either has the form \d\.\d+e[-+]\d+
    + // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
    + return [coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, +x.slice(i + 1)]
    + }
    +
    + function exponent(x) {
    + return (x = formatDecimal(Math.abs(x))), x ? x[1] : NaN
    + }
    +
    + function formatGroup(grouping, thousands) {
    + return function (value, width) {
    + var i = value.length,
    + t = [],
    + j = 0,
    + g = grouping[0],
    + length = 0
    +
    + while (i > 0 && g > 0) {
    + if (length + g + 1 > width) g = Math.max(1, width - length)
    + t.push(value.substring((i -= g), i + g))
    + if ((length += g + 1) > width) break
    + g = grouping[(j = (j + 1) % grouping.length)]
    + }
    +
    + return t.reverse().join(thousands)
    + }
    + }
    +
    + function formatNumerals(numerals) {
    + return function (value) {
    + return value.replace(/[0-9]/g, function (i) {
    + return numerals[+i]
    + })
    + }
    + }
    +
    + // [[fill]align][sign][symbol][0][width][,][.precision][~][type]
    + var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i
    +
    + function formatSpecifier(specifier) {
    + if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier)
    + var match
    + return new FormatSpecifier({
    + fill: match[1],
    + align: match[2],
    + sign: match[3],
    + symbol: match[4],
    + zero: match[5],
    + width: match[6],
    + comma: match[7],
    + precision: match[8] && match[8].slice(1),
    + trim: match[9],
    + type: match[10],
    + })
    + }
    +
    + formatSpecifier.prototype = FormatSpecifier.prototype // instanceof
    +
    + function FormatSpecifier(specifier) {
    + this.fill = specifier.fill === undefined ? " " : specifier.fill + ""
    + this.align = specifier.align === undefined ? ">" : specifier.align + ""
    + this.sign = specifier.sign === undefined ? "-" : specifier.sign + ""
    + this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + ""
    + this.zero = !!specifier.zero
    + this.width = specifier.width === undefined ? undefined : +specifier.width
    + this.comma = !!specifier.comma
    + this.precision = specifier.precision === undefined ? undefined : +specifier.precision
    + this.trim = !!specifier.trim
    + this.type = specifier.type === undefined ? "" : specifier.type + ""
    + }
    +
    + FormatSpecifier.prototype.toString = function () {
    + return (
    + this.fill +
    + this.align +
    + this.sign +
    + this.symbol +
    + (this.zero ? "0" : "") +
    + (this.width === undefined ? "" : Math.max(1, this.width | 0)) +
    + (this.comma ? "," : "") +
    + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0)) +
    + (this.trim ? "~" : "") +
    + this.type
    + )
    + }
    +
    + // Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
    + function formatTrim(s) {
    + out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
    + switch (s[i]) {
    + case ".":
    + i0 = i1 = i
    + break
    + case "0":
    + if (i0 === 0) i0 = i
    + i1 = i
    + break
    + default:
    + if (i0 > 0) {
    + if (!+s[i]) break out
    + i0 = 0
    + }
    + break
    + }
    + }
    + return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s
    + }
    +
    + var prefixExponent
    +
    + function formatPrefixAuto(x, p) {
    + var d = formatDecimal(x, p)
    + if (!d) return x + ""
    + var coefficient = d[0],
    + exponent = d[1],
    + i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
    + n = coefficient.length
    + return i === n
    + ? coefficient
    + : i > n
    + ? coefficient + new Array(i - n + 1).join("0")
    + : i > 0
    + ? coefficient.slice(0, i) + "." + coefficient.slice(i)
    + : "0." + new Array(1 - i).join("0") + formatDecimal(x, Math.max(0, p + i - 1))[0] // less than 1y!
    + }
    +
    + function formatRounded(x, p) {
    + var d = formatDecimal(x, p)
    + if (!d) return x + ""
    + var coefficient = d[0],
    + exponent = d[1]
    + return exponent < 0
    + ? "0." + new Array(-exponent).join("0") + coefficient
    + : coefficient.length > exponent + 1
    + ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
    + : coefficient + new Array(exponent - coefficient.length + 2).join("0")
    + }
    +
    + var formatTypes = {
    + "%": function (x, p) {
    + return (x * 100).toFixed(p)
    + },
    + b: function (x) {
    + return Math.round(x).toString(2)
    + },
    + c: function (x) {
    + return x + ""
    + },
    + d: function (x) {
    + return Math.round(x).toString(10)
    + },
    + e: function (x, p) {
    + return x.toExponential(p)
    + },
    + f: function (x, p) {
    + return x.toFixed(p)
    + },
    + g: function (x, p) {
    + return x.toPrecision(p)
    + },
    + o: function (x) {
    + return Math.round(x).toString(8)
    + },
    + p: function (x, p) {
    + return formatRounded(x * 100, p)
    + },
    + r: formatRounded,
    + s: formatPrefixAuto,
    + X: function (x) {
    + return Math.round(x).toString(16).toUpperCase()
    + },
    + x: function (x) {
    + return Math.round(x).toString(16)
    + },
    + }
    +
    + function identity(x) {
    + return x
    + }
    +
    + var map = Array.prototype.map,
    + prefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"]
    +
    + function formatLocale(locale) {
    + var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""),
    + currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "",
    + currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "",
    + decimal = locale.decimal === undefined ? "." : locale.decimal + "",
    + numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),
    + percent = locale.percent === undefined ? "%" : locale.percent + "",
    + minus = locale.minus === undefined ? "-" : locale.minus + "",
    + nan = locale.nan === undefined ? "NaN" : locale.nan + ""
    +
    + function newFormat(specifier) {
    + specifier = formatSpecifier(specifier)
    +
    + var fill = specifier.fill,
    + align = specifier.align,
    + sign = specifier.sign,
    + symbol = specifier.symbol,
    + zero = specifier.zero,
    + width = specifier.width,
    + comma = specifier.comma,
    + precision = specifier.precision,
    + trim = specifier.trim,
    + type = specifier.type
    +
    + // The "n" type is an alias for ",g".
    + if (type === "n") (comma = true), (type = "g")
    + // The "" type, and any invalid type, is an alias for ".12~g".
    + else if (!formatTypes[type]) precision === undefined && (precision = 12), (trim = true), (type = "g")
    +
    + // If zero fill is specified, padding goes after sign and before digits.
    + if (zero || (fill === "0" && align === "=")) (zero = true), (fill = "0"), (align = "=")
    +
    + // Compute the prefix and suffix.
    + // For SI-prefix, the suffix is lazily computed.
    + var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
    + suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""
    +
    + // What format function should we use?
    + // Is this an integer type?
    + // Can this type generate exponential notation?
    + var formatType = formatTypes[type],
    + maybeSuffix = /[defgprs%]/.test(type)
    +
    + // Set the default precision if not specified,
    + // or clamp the specified precision to the supported range.
    + // For significant precision, it must be in [1, 21].
    + // For fixed precision, it must be in [0, 20].
    + precision = precision === undefined ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision))
    +
    + function format(value) {
    + var valuePrefix = prefix,
    + valueSuffix = suffix,
    + i,
    + n,
    + c
    +
    + if (type === "c") {
    + valueSuffix = formatType(value) + valueSuffix
    + value = ""
    + } else {
    + value = +value
    +
    + // Perform the initial formatting.
    + var valueNegative = value < 0
    + value = isNaN(value) ? nan : formatType(Math.abs(value), precision)
    +
    + // Trim insignificant zeros.
    + if (trim) value = formatTrim(value)
    +
    + // If a negative value rounds to zero during formatting, treat as positive.
    + if (valueNegative && +value === 0) valueNegative = false
    +
    + // Compute the prefix and suffix.
    + valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix
    +
    + valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "")
    +
    + // Break the formatted value into the integer “value” part that can be
    + // grouped, and fractional or exponential “suffix” part that is not.
    + if (maybeSuffix) {
    + ;(i = -1), (n = value.length)
    + while (++i < n) {
    + if (((c = value.charCodeAt(i)), 48 > c || c > 57)) {
    + valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix
    + value = value.slice(0, i)
    + break
    + }
    + }
    + }
    + }
    +
    + // If the fill character is not "0", grouping is applied before padding.
    + if (comma && !zero) value = group(value, Infinity)
    +
    + // Compute the padding.
    + var length = valuePrefix.length + value.length + valueSuffix.length,
    + padding = length < width ? new Array(width - length + 1).join(fill) : ""
    +
    + // If the fill character is "0", grouping is applied after padding.
    + if (comma && zero) (value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity)), (padding = "")
    +
    + // Reconstruct the final output based on the desired alignment.
    + switch (align) {
    + case "<":
    + value = valuePrefix + value + valueSuffix + padding
    + break
    + case "=":
    + value = valuePrefix + padding + value + valueSuffix
    + break
    + case "^":
    + value = padding.slice(0, (length = padding.length >> 1)) + valuePrefix + value + valueSuffix + padding.slice(length)
    + break
    + default:
    + value = padding + valuePrefix + value + valueSuffix
    + break
    + }
    +
    + return numerals(value)
    + }
    +
    + format.toString = function () {
    + return specifier + ""
    + }
    +
    + return format
    + }
    +
    + function formatPrefix(specifier, value) {
    + var f = newFormat(((specifier = formatSpecifier(specifier)), (specifier.type = "f"), specifier)),
    + e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
    + k = Math.pow(10, -e),
    + prefix = prefixes[8 + e / 3]
    + return function (value) {
    + return f(k * value) + prefix
    + }
    + }
    +
    + return {
    + format: newFormat,
    + formatPrefix: formatPrefix,
    + }
    + }
    +
    + var locale
    +
    + defaultLocale({
    + decimal: ".",
    + thousands: ",",
    + grouping: [3],
    + currency: ["$", ""],
    + minus: "-",
    + })
    +
    + function defaultLocale(definition) {
    + locale = formatLocale(definition)
    + exports.format = locale.format
    + exports.formatPrefix = locale.formatPrefix
    + return locale
    + }
    +
    + function precisionFixed(step) {
    + return Math.max(0, -exponent(Math.abs(step)))
    + }
    +
    + function precisionPrefix(step, value) {
    + return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)))
    + }
    +
    + function precisionRound(step, max) {
    + ;(step = Math.abs(step)), (max = Math.abs(max) - step)
    + return Math.max(0, exponent(max) - exponent(step)) + 1
    + }
    +
    + exports.FormatSpecifier = FormatSpecifier
    + exports.formatDefaultLocale = defaultLocale
    + exports.formatLocale = formatLocale
    + exports.formatSpecifier = formatSpecifier
    + exports.precisionFixed = precisionFixed
    + exports.precisionPrefix = precisionPrefix
    + exports.precisionRound = precisionRound
    +
    + Object.defineProperty(exports, "__esModule", { value: true })
    + })
    - ;(function(){function n(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function t(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u
    - return true}function i(n,t){for(var r=-1,e=null==n?0:n.length,u=0,i=[];++r
    - return r}function s(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=null==n?0:n.length;++r
    - }function A(n,t){for(var r=-1,e=Array(n);++r
    - }),r}function B(n,t){return function(r){return n(t(r))}}function L(n,t){for(var r=-1,e=n.length,u=0,i=[];++r
    - }var T,$=1/0,F=NaN,N=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],P=/\b__p\+='';/g,Z=/\b(__p\+=)''\+/g,q=/(__e\(.*?\)|\b__t\))\+'';/g,V=/&(?:amp|lt|gt|quot|#39);/g,K=/[&<>"']/g,G=RegExp(V.source),H=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nn=/^\w*$/,tn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rn=/[\\^$.*+?()[\]{}|]/g,en=RegExp(rn.source),un=/^\s+|\s+$/g,on=/^\s+/,fn=/\s+$/,cn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,an=/\{\n\/\* \[wrapped with (.+)\] \*/,ln=/,? & /,sn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,hn=/\\(\\)?/g,pn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_n=/\w*$/,vn=/^[-+]0x[0-9a-f]+$/i,gn=/^0b[01]+$/i,dn=/^\[object .+?Constructor\]$/,yn=/^0o[0-7]+$/i,bn=/^(?:0|[1-9]\d*)$/,xn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,jn=/($^)/,wn=/['\n\r\u2028\u2029\\]/g,mn="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",An="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+mn,En="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",kn=RegExp("['\u2019]","g"),Sn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),On=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+En+mn,"g"),In=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",An].join("|"),"g"),Rn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),zn=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Wn="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Bn={};
    - Bn["[object Float32Array]"]=Bn["[object Float64Array]"]=Bn["[object Int8Array]"]=Bn["[object Int16Array]"]=Bn["[object Int32Array]"]=Bn["[object Uint8Array]"]=Bn["[object Uint8ClampedArray]"]=Bn["[object Uint16Array]"]=Bn["[object Uint32Array]"]=true,Bn["[object Arguments]"]=Bn["[object Array]"]=Bn["[object ArrayBuffer]"]=Bn["[object Boolean]"]=Bn["[object DataView]"]=Bn["[object Date]"]=Bn["[object Error]"]=Bn["[object Function]"]=Bn["[object Map]"]=Bn["[object Number]"]=Bn["[object Object]"]=Bn["[object RegExp]"]=Bn["[object Set]"]=Bn["[object String]"]=Bn["[object WeakMap]"]=false;
    - var Ln={};Ln["[object Arguments]"]=Ln["[object Array]"]=Ln["[object ArrayBuffer]"]=Ln["[object DataView]"]=Ln["[object Boolean]"]=Ln["[object Date]"]=Ln["[object Float32Array]"]=Ln["[object Float64Array]"]=Ln["[object Int8Array]"]=Ln["[object Int16Array]"]=Ln["[object Int32Array]"]=Ln["[object Map]"]=Ln["[object Number]"]=Ln["[object Object]"]=Ln["[object RegExp]"]=Ln["[object Set]"]=Ln["[object String]"]=Ln["[object Symbol]"]=Ln["[object Uint8Array]"]=Ln["[object Uint8ClampedArray]"]=Ln["[object Uint16Array]"]=Ln["[object Uint32Array]"]=true,
    - Ln["[object Error]"]=Ln["[object Function]"]=Ln["[object WeakMap]"]=false;var Un={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Cn=parseFloat,Dn=parseInt,Mn=typeof global=="object"&&global&&global.Object===Object&&global,Tn=typeof self=="object"&&self&&self.Object===Object&&self,$n=Mn||Tn||Function("return this")(),Fn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Nn=Fn&&typeof module=="object"&&module&&!module.nodeType&&module,Pn=Nn&&Nn.exports===Fn,Zn=Pn&&Mn.process,qn=function(){
    - try{var n=Nn&&Nn.f&&Nn.f("util").types;return n?n:Zn&&Zn.binding&&Zn.binding("util")}catch(n){}}(),Vn=qn&&qn.isArrayBuffer,Kn=qn&&qn.isDate,Gn=qn&&qn.isMap,Hn=qn&&qn.isRegExp,Jn=qn&&qn.isSet,Yn=qn&&qn.isTypedArray,Qn=b("length"),Xn=x({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I",
    - "\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C",
    - "\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i",
    - "\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r",
    - "\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij",
    - "\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),nt=x({"&":"&","<":"<",">":">",'"':""","'":"'"}),tt=x({"&":"&","<":"<",">":">",""":'"',"'":"'"}),rt=function x(mn){function An(n){if(yu(n)&&!ff(n)&&!(n instanceof Un)){if(n instanceof On)return n;if(oi.call(n,"__wrapped__"))return Fe(n)}return new On(n)}function En(){}function On(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=T}function Un(n){this.__wrapped__=n,
    - this.__actions__=[],this.__dir__=1,this.__filtered__=false,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Mn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t
    - }function Zn(n){this.size=(this.__data__=new Tn(n)).size}function qn(n,t){var r,e=ff(n),u=!e&&of(n),i=!e&&!u&&af(n),o=!e&&!u&&!i&&_f(n),u=(e=e||u||i||o)?A(n.length,ni):[],f=u.length;for(r in n)!t&&!oi.call(n,r)||e&&("length"==r||i&&("offset"==r||"parent"==r)||o&&("buffer"==r||"byteLength"==r||"byteOffset"==r)||Se(r,f))||u.push(r);return u}function Qn(n){var t=n.length;return t?n[ir(0,t-1)]:T}function et(n,t){return De(Ur(n),pt(t,0,n.length))}function ut(n){return De(Ur(n))}function it(n,t,r){(r===T||lu(n[t],r))&&(r!==T||t in n)||st(n,t,r);
    - }function ot(n,t,r){var e=n[t];oi.call(n,t)&&lu(e,r)&&(r!==T||t in n)||st(n,t,r)}function ft(n,t){for(var r=n.length;r--;)if(lu(n[r][0],t))return r;return-1}function ct(n,t,r,e){return uo(n,function(n,u,i){t(e,n,r(n),i)}),e}function at(n,t){return n&&Cr(t,Wu(t),n)}function lt(n,t){return n&&Cr(t,Bu(t),n)}function st(n,t,r){"__proto__"==t&&Ai?Ai(n,t,{configurable:true,enumerable:true,value:r,writable:true}):n[t]=r}function ht(n,t){for(var r=-1,e=t.length,u=Ku(e),i=null==n;++r
    - }function pt(n,t,r){return n===n&&(r!==T&&(n=n<=r?n:r),t!==T&&(n=n>=t?n:t)),n}function _t(n,t,e,u,i,o){var f,c=1&t,a=2&t,l=4&t;if(e&&(f=i?e(n,u,i,o):e(n)),f!==T)return f;if(!du(n))return n;if(u=ff(n)){if(f=me(n),!c)return Ur(n,f)}else{var s=vo(n),h="[object Function]"==s||"[object GeneratorFunction]"==s;if(af(n))return Ir(n,c);if("[object Object]"==s||"[object Arguments]"==s||h&&!i){if(f=a||h?{}:Ae(n),!c)return a?Mr(n,lt(f,n)):Dr(n,at(f,n))}else{if(!Ln[s])return i?n:{};f=Ee(n,s,c)}}if(o||(o=new Zn),
    - i=o.get(n))return i;o.set(n,f),pf(n)?n.forEach(function(r){f.add(_t(r,t,e,r,n,o))}):sf(n)&&n.forEach(function(r,u){f.set(u,_t(r,t,e,u,n,o))});var a=l?a?ve:_e:a?Bu:Wu,p=u?T:a(n);return r(p||n,function(r,u){p&&(u=r,r=n[u]),ot(f,u,_t(r,t,e,u,n,o))}),f}function vt(n){var t=Wu(n);return function(r){return gt(r,n,t)}}function gt(n,t,r){var e=r.length;if(null==n)return!e;for(n=Qu(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===T&&!(u in n)||!i(o))return false}return true}function dt(n,t,r){if(typeof n!="function")throw new ti("Expected a function");
    - return bo(function(){n.apply(T,r)},t)}function yt(n,t,r,e){var u=-1,i=o,a=true,l=n.length,s=[],h=t.length;if(!l)return s;r&&(t=c(t,k(r))),e?(i=f,a=false):200<=t.length&&(i=O,a=false,t=new Nn(t));n:for(;++u
    - }return c}function jt(n,t){var r=[];return uo(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function wt(n,t,r,e,u){var i=-1,o=n.length;for(r||(r=ke),u||(u=[]);++i
    - ff(n)?t:a(t,r(n))}function Ot(n){if(null==n)n=n===T?"[object Undefined]":"[object Null]";else if(mi&&mi in Qu(n)){var t=oi.call(n,mi),r=ni];try{ni]=T;var e=true}catch(n){}var u=ai.call(n);e&&(t?ni]=r:delete ni]),n=u}else n=ai.call(n);return n}function It(n,t){return n>t}function Rt(n,t){return null!=n&&oi.call(n,t)}function zt(n,t){return null!=n&&t in Qu(n)}function Wt(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=Ku(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,k(t))),s=Ci(p.length,s),
    - l[a]=!r&&(t||120<=u&&120<=p.length)?new Nn(a&&p):T}var p=n[0],_=-1,v=l[0];n:for(;++_r.length?t:kt(t,hr(r,0,-1)),r=null==t?t:t[Me(Ve(r))],null==r?T:n(r,t,e)}function Ut(n){return yu(n)&&"[object Arguments]"==Ot(n)}function Ct(n){
    - return yu(n)&&"[object ArrayBuffer]"==Ot(n)}function Dt(n){return yu(n)&&"[object Date]"==Ot(n)}function Mt(n,t,r,e,u){if(n===t)t=true;else if(null==n||null==t||!yu(n)&&!yu(t))t=n!==n&&t!==t;else n:{var i=ff(n),o=ff(t),f=i?"[object Array]":vo(n),c=o?"[object Array]":vo(t),f="[object Arguments]"==f?"[object Object]":f,c="[object Arguments]"==c?"[object Object]":c,a="[object Object]"==f,o="[object Object]"==c;if((c=f==c)&&af(n)){if(!af(t)){t=false;break n}i=true,a=false}if(c&&!a)u||(u=new Zn),t=i||_f(n)?se(n,t,r,e,Mt,u):he(n,t,f,r,e,Mt,u);else{
    - if(!(1&r)&&(i=a&&oi.call(n,"__wrapped__"),f=o&&oi.call(t,"__wrapped__"),i||f)){n=i?n.value():n,t=f?t.value():t,u||(u=new Zn),t=Mt(n,t,r,e,u);break n}if(c)t:if(u||(u=new Zn),i=1&r,f=_e(n),o=f.length,c=_e(t).length,o==c||i){for(a=o;a--;){var l=f[a];if(!(i?l in t:oi.call(t,l))){t=false;break t}}if((c=u.get(n))&&u.get(t))t=c==t;else{c=true,u.set(n,t),u.set(t,n);for(var s=i;++a
    - }c&&!s&&(r=n.constructor,e=t.constructor,r!=e&&"constructor"in n&&"constructor"in t&&!(typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)&&(c=false)),u.delete(n),u.delete(t),t=c}}else t=false;else t=false}}return t}function Tt(n){return yu(n)&&"[object Map]"==vo(n)}function $t(n,t,r,e){var u=r.length,i=u,o=!e;if(null==n)return!i;for(n=Qu(n);u--;){var f=r[u];if(o&&f[2]?f[1]!==n[f[0]]:!(f[0]in n))return false}for(;++u
    - }else{if(f=new Zn,e)var s=e(a,l,c,n,t,f);if(s===T?!Mt(l,a,3,e,f):!s)return false}}return true}function Ft(n){return!(!du(n)||ci&&ci in n)&&(_u(n)?hi:dn).test(Te(n))}function Nt(n){return yu(n)&&"[object RegExp]"==Ot(n)}function Pt(n){return yu(n)&&"[object Set]"==vo(n)}function Zt(n){return yu(n)&&gu(n.length)&&!!Bn[Ot(n)]}function qt(n){return typeof n=="function"?n:null==n?$u:typeof n=="object"?ff(n)?Jt(n[0],n[1]):Ht(n):Zu(n)}function Vt(n){if(!ze(n))return Li(n);var t,r=[];for(t in Qu(n))oi.call(n,t)&&"constructor"!=t&&r.push(t);
    - return r}function Kt(n,t){return n
    - var l=e?e(c,a,o+"",n,t,f):T,s=l===T;if(s){var h=ff(a),p=!h&&af(a),_=!h&&!p&&_f(a),l=a;h||p||_?ff(c)?l=c:hu(c)?l=Ur(c):p?(s=false,l=Ir(a,true)):_?(s=false,l=zr(a,true)):l=[]:xu(a)||of(a)?(l=c,of(c)?l=Ou(c):du(c)&&!_u(c)||(l=Ae(a))):s=false}s&&(f.set(a,l),Yt(l,a,r,e,f),f.delete(a)),it(n,o,l)}}else f=e?e(Le(n,o),i,o+"",n,t,u):T,f===T&&(f=i),it(n,o,f)},Bu)}function Qt(n,t){var r=n.length;if(r)return t+=0>t?r:0,Se(t,r)?n[t]:T}function Xt(n,t,r){var e=-1;return t=c(t.length?t:[$u],k(ye())),n=Gt(n,function(n){return{
    - a:c(t,function(t){return t(n)}),b:++e,c:n}}),w(n,function(n,t){var e;n:{e=-1;for(var u=n.a,i=t.a,o=u.length,f=r.length;++e=f?c:c*("desc"==r[e]?-1:1);break n}}e=n.b-t.b}return e})}function nr(n,t){return tr(n,t,function(t,r){return zu(n,r)})}function tr(n,t,r){for(var e=-1,u=t.length,i={};++e
    - r&&(f=c(n,k(r)));++it||9007199254740991
    - return De(r,pt(t,0,r.length))}function lr(n,t,r,e){if(!du(n))return n;t=Sr(t,n);for(var u=-1,i=t.length,o=i-1,f=n;null!=f&&++ut&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Ku(u);++e
    - function _r(n,t,r){var e=0,u=null==n?e:n.length;if(typeof t=="number"&&t===t&&2147483647>=u){for(;e>>1,o=n[i];null!==o&&!wu(o)&&(r?o<=t:o
    - var o=n[r],f=t?t(o):o;if(!r||!lu(f,c)){var c=f;i[u++]=0===o?0:o}}return i}function dr(n){return typeof n=="number"?n:wu(n)?F:+n}function yr(n){if(typeof n=="string")return n;if(ff(n))return c(n,yr)+"";if(wu(n))return ro?ro.call(n):"";var t=n+"";return"0"==t&&1/n==-$?"-0":t}function br(n,t,r){var e=-1,u=o,i=n.length,c=true,a=[],l=a;if(r)c=false,u=f;else if(200<=i){if(u=t?null:so(n))return U(u);c=false,u=O,l=new Nn}else l=t?[]:a;n:for(;++e
    - t&&l.push(h),a.push(s)}else u(l,h,r)||(l!==a&&l.push(h),a.push(s))}return a}function xr(n,t){return t=Sr(t,n),n=2>t.length?n:kt(n,hr(t,0,-1)),null==n||delete n[Me(Ve(t))]}function jr(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++ie)return e?br(n[0]):[];for(var u=-1,i=Ku(e);++u
    - return br(wt(i,1),t,r)}function Ar(n,t,r){for(var e=-1,u=n.length,i=t.length,o={};++e=e?n:hr(n,t,r)}function Ir(n,t){if(t)return n.slice();var r=n.length,r=gi?gi(r):new n.constructor(r);return n.copy(r),r}function Rr(n){var t=new n.constructor(n.byteLength);return new vi(t).set(new vi(n)),
    - t}function zr(n,t){return new n.constructor(t?Rr(n.buffer):n.buffer,n.byteOffset,n.length)}function Wr(n,t){if(n!==t){var r=n!==T,e=null===n,u=n===n,i=wu(n),o=t!==T,f=null===t,c=t===t,a=wu(t);if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&n
    - return l}function Lr(n,t,r,e){var u=-1,i=n.length,o=-1,f=r.length,c=-1,a=t.length,l=Ui(i-f,0),s=Ku(l+a);for(e=!e;++u
    - }function Tr(n,r){return function(e,u){var i=ff(e)?t:ct,o=r?r():{};return i(e,n,ye(u,2),o)}}function $r(n){return fr(function(t,r){var e=-1,u=r.length,i=1u?T:i,u=1),t=Qu(t);++e
    - var u=-1,i=Qu(t);e=e(t);for(var o=e.length;o--;){var f=e[n?o:++u];if(false===r(i[f],f,i))break}return t}}function Pr(n,t,r){function e(){return(this&&this!==$n&&this instanceof e?i:n).apply(u?r:this,arguments)}var u=1&t,i=Vr(n);return e}function Zr(n){return function(t){t=Iu(t);var r=Rn.test(t)?M(t):T,e=r?r[0]:t.charAt(0);return t=r?Or(r,1).join(""):t.slice(1),e[n]()+t}}function qr(n){return function(t){return l(Mu(Du(t).replace(kn,"")),n,"")}}function Vr(n){return function(){var t=arguments;switch(t.length){
    - case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=eo(n.prototype),t=n.apply(r,t);return du(t)?t:r}}function Kr(t,r,e){function u(){for(var o=arguments.length,f=Ku(o),c=o,a=de(u);c--;)f[c]=arguments[c];return c=3>o&&f[0]!==a&&f[o-1]!==a?[]:L(f,a),
    - o-=c.length,o
    - return function(){var n=arguments,e=n[0];if(o&&1==n.length&&ff(e))return o.plant(e).value();for(var u=0,n=r?t[u].apply(this,n):e;++u
    - var A=f[w];y[w]=Se(A,x)?m[A]:T}}else v&&1
    - return r=c(r,k(ye())),fr(function(e){var u=this;return t(r,function(t){return n(t,u,e)})})})}function ne(n,t){t=t===T?" ":yr(t);var r=t.length;return 2>r?r?or(t,n):t:(r=or(t,Oi(n/D(t))),Rn.test(t)?Or(M(r),0,n).join(""):r.slice(0,n))}function te(t,r,e,u){function i(){for(var r=-1,c=arguments.length,a=-1,l=u.length,s=Ku(l+c),h=this&&this!==$n&&this instanceof i?f:t;++a
    - e&&typeof e!="number"&&Oe(t,r,e)&&(r=e=T),t=Au(t),r===T?(r=t,t=0):r=Au(r),e=e===T?t
    - var t=Yu[n];return function(n,r){if(n=Su(n),(r=null==r?0:Ci(Eu(r),292))&&Wi(n)){var e=(Iu(n)+"e").split("e"),e=t(e[0]+"e"+(+e[1]+r)),e=(Iu(e)+"e").split("e");return+(e[0]+"e"+(+e[1]-r))}return t(n)}}function oe(n){return function(t){var r=vo(t);return"[object Map]"==r?W(t):"[object Set]"==r?C(t):E(t,n(t))}}function fe(n,t,r,e,u,i,o,f){var c=2&t;if(!c&&typeof n!="function")throw new ti("Expected a function");var a=e?e.length:0;if(a||(t&=-97,e=u=T),o=o===T?o:Ui(Eu(o),0),f=f===T?f:Eu(f),a-=u?u.length:0,
    - 64&t){var l=e,s=u;e=u=T}var h=c?T:ho(n);return i=[n,t,r,e,u,l,s,i,o,f],h&&(r=i[1],n=h[1],t=r|n,e=128==n&&8==r||128==n&&256==r&&i[7].length<=h[8]||384==n&&h[7].length<=h[8]&&8==r,131>t||e)&&(1&n&&(i[2]=h[2],t|=1&r?0:4),(r=h[3])&&(e=i[3],i[3]=e?Br(e,r,h[4]):r,i[4]=e?L(i[3],"__lodash_placeholder__"):h[4]),(r=h[5])&&(e=i[5],i[5]=e?Lr(e,r,h[6]):r,i[6]=e?L(i[5],"__lodash_placeholder__"):h[6]),(r=h[7])&&(i[7]=r),128&n&&(i[8]=null==i[8]?h[8]:Ci(i[8],h[8])),null==i[9]&&(i[9]=h[9]),i[0]=h[0],i[1]=t),n=i[0],
    - t=i[1],r=i[2],e=i[3],u=i[4],f=i[9]=i[9]===T?c?0:n.length:Ui(i[9]-a,0),!f&&24&t&&(t&=-25),Ue((h?co:yo)(t&&1!=t?8==t||16==t?Kr(n,t,f):32!=t&&33!=t||u.length?Jr.apply(T,i):te(n,t,r,e):Pr(n,t,r),i),n,t)}function ce(n,t,r,e){return n===T||lu(n,ei[r])&&!oi.call(e,r)?t:n}function ae(n,t,r,e,u,i){return du(n)&&du(t)&&(i.set(t,n),Yt(n,t,T,ae,i),i.delete(t)),n}function le(n){return xu(n)?T:n}function se(n,t,r,e,u,i){var o=1&r,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return false;if((c=i.get(n))&&i.get(t))return c==t;
    - var c=-1,a=true,l=2&r?new Nn:T;for(i.set(n,t),i.set(t,n);++c
    - if(n.byteLength!=t.byteLength||!i(new vi(n),new vi(t)))break;return true;case"[object Boolean]":case"[object Date]":case"[object Number]":return lu(+n,+t);case"[object Error]":return n.name==t.name&&n.message==t.message;case"[object RegExp]":case"[object String]":return n==t+"";case"[object Map]":var f=W;case"[object Set]":if(f||(f=U),n.size!=t.size&&!(1&e))break;return(r=o.get(n))?r==t:(e|=2,o.set(n,t),t=se(f(n),f(t),e,u,i,o),o.delete(n),t);case"[object Symbol]":if(to)return to.call(n)==to.call(t)}
    - return false}function pe(n){return xo(Be(n,T,Ze),n+"")}function _e(n){return St(n,Wu,po)}function ve(n){return St(n,Bu,_o)}function ge(n){for(var t=n.name+"",r=Gi[t],e=oi.call(Gi,t)?r.length:0;e--;){var u=r[e],i=u.func;if(null==i||i==n)return u.name}return t}function de(n){return(oi.call(An,"placeholder")?An:n).placeholder}function ye(){var n=An.iteratee||Fu,n=n===Fu?qt:n;return arguments.length?n(arguments[0],arguments[1]):n}function be(n,t){var r=n.__data__,e=typeof t;return("string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t)?r[typeof t=="string"?"string":"hash"]:r.map;
    - }function xe(n){for(var t=Wu(n),r=t.length;r--;){var e=t[r],u=n[e];t[r]=[e,u,u===u&&!du(u)]}return t}function je(n,t){var r=null==n?T:n[t];return Ft(r)?r:T}function we(n,t,r){t=Sr(t,n);for(var e=-1,u=t.length,i=false;++e
    - return typeof n.constructor!="function"||ze(n)?{}:eo(di(n))}function Ee(n,t,r){var e=n.constructor;switch(t){case"[object ArrayBuffer]":return Rr(n);case"[object Boolean]":case"[object Date]":return new e(+n);case"[object DataView]":return t=r?Rr(n.buffer):n.buffer,new n.constructor(t,n.byteOffset,n.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":
    - case"[object Uint16Array]":case"[object Uint32Array]":return zr(n,r);case"[object Map]":return new e;case"[object Number]":case"[object String]":return new e(n);case"[object RegExp]":return t=new n.constructor(n.source,_n.exec(n)),t.lastIndex=n.lastIndex,t;case"[object Set]":return new e;case"[object Symbol]":return to?Qu(to.call(n)):{}}}function ke(n){return ff(n)||of(n)||!!(ji&&n&&n[ji])}function Se(n,t){var r=typeof n;return t=null==t?9007199254740991:t,!!t&&("number"==r||"symbol"!=r&&bn.test(n))&&-1
    - }function Oe(n,t,r){if(!du(r))return false;var e=typeof t;return!!("number"==e?su(r)&&Se(t,r.length):"string"==e&&t in r)&&lu(r[t],n)}function Ie(n,t){if(ff(n))return false;var r=typeof n;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=n&&!wu(n))||(nn.test(n)||!X.test(n)||null!=t&&n in Qu(t))}function Re(n){var t=ge(n),r=An[t];return typeof r=="function"&&t in Un.prototype&&(n===r||(t=ho(r),!!t&&n===t[0]))}function ze(n){var t=n&&n.constructor;return n===(typeof t=="function"&&t.prototype||ei)}function We(n,t){
    - return function(r){return null!=r&&(r[n]===t&&(t!==T||n in Qu(r)))}}function Be(t,r,e){return r=Ui(r===T?t.length-1:r,0),function(){for(var u=arguments,i=-1,o=Ui(u.length-r,0),f=Ku(o);++i
    - r=r.join(2
    - return n+""}return""}function $e(n,t){return r(N,function(r){var e="_."+r[0];t&r[1]&&!o(n,e)&&n.push(e)}),n.sort()}function Fe(n){if(n instanceof Un)return n.clone();var t=new On(n.__wrapped__,n.__chain__);return t.__actions__=Ur(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function Ne(n,t,r){var e=null==n?0:n.length;return e?(r=null==r?0:Eu(r),0>r&&(r=Ui(e+r,0)),_(n,ye(t,3),r)):-1}function Pe(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==T&&(u=Eu(r),u=0>r?Ui(e+u,0):Ci(u,e-1)),
    - _(n,ye(t,3),u,true)}function Ze(n){return(null==n?0:n.length)?wt(n,1):[]}function qe(n){return n&&n.length?n[0]:T}function Ve(n){var t=null==n?0:n.length;return t?n[t-1]:T}function Ke(n,t){return n&&n.length&&t&&t.length?er(n,t):n}function Ge(n){return null==n?n:$i.call(n)}function He(n){if(!n||!n.length)return[];var t=0;return n=i(n,function(n){if(hu(n))return t=Ui(n.length,t),true}),A(t,function(t){return c(n,b(t))})}function Je(t,r){if(!t||!t.length)return[];var e=He(t);return null==r?e:c(e,function(t){
    - return n(r,T,t)})}function Ye(n){return n=An(n),n.__chain__=true,n}function Qe(n,t){return t(n)}function Xe(){return this}function nu(n,t){return(ff(n)?r:uo)(n,ye(t,3))}function tu(n,t){return(ff(n)?e:io)(n,ye(t,3))}function ru(n,t){return(ff(n)?c:Gt)(n,ye(t,3))}function eu(n,t,r){return t=r?T:t,t=n&&null==t?n.length:t,fe(n,128,T,T,T,T,t)}function uu(n,t){var r;if(typeof t!="function")throw new ti("Expected a function");return n=Eu(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=T),
    - r}}function iu(n,t,r){return t=r?T:t,n=fe(n,8,T,T,T,T,T,t),n.placeholder=iu.placeholder,n}function ou(n,t,r){return t=r?T:t,n=fe(n,16,T,T,T,T,T,t),n.placeholder=ou.placeholder,n}function fu(n,t,r){function e(t){var r=c,e=a;return c=a=T,_=t,s=n.apply(e,r)}function u(n){var r=n-p;return n-=_,p===T||r>=t||0>r||g&&n>=l}function i(){var n=Go();if(u(n))return o(n);var r,e=bo;r=n-_,n=t-(n-p),r=g?Ci(n,l-r):n,h=e(i,r)}function o(n){return h=T,d&&c?e(n):(c=a=T,s)}function f(){var n=Go(),r=u(n);if(c=arguments,
    - a=this,p=n,r){if(h===T)return _=n=p,h=bo(i,t),v?e(n):s;if(g)return lo(h),h=bo(i,t),e(p)}return h===T&&(h=bo(i,t)),s}var c,a,l,s,h,p,_=0,v=false,g=false,d=true;if(typeof n!="function")throw new ti("Expected a function");return t=Su(t)||0,du(r)&&(v=!!r.leading,l=(g="maxWait"in r)?Ui(Su(r.maxWait)||0,t):l,d="trailing"in r?!!r.trailing:d),f.cancel=function(){h!==T&&lo(h),_=0,c=p=a=h=T},f.flush=function(){return h===T?s:o(Go())},f}function cu(n,t){function r(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;
    - return i.has(u)?i.get(u):(e=n.apply(this,e),r.cache=i.set(u,e)||i,e)}if(typeof n!="function"||null!=t&&typeof t!="function")throw new ti("Expected a function");return r.cache=new(cu.Cache||Fn),r}function au(n){if(typeof n!="function")throw new ti("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function lu(n,t){return n===t||n!==n&&t!==t;
    - }function su(n){return null!=n&&gu(n.length)&&!_u(n)}function hu(n){return yu(n)&&su(n)}function pu(n){if(!yu(n))return false;var t=Ot(n);return"[object Error]"==t||"[object DOMException]"==t||typeof n.message=="string"&&typeof n.name=="string"&&!xu(n)}function _u(n){return!!du(n)&&(n=Ot(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function vu(n){return typeof n=="number"&&n==Eu(n)}function gu(n){return typeof n=="number"&&-1=n;
    - }function du(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function yu(n){return null!=n&&typeof n=="object"}function bu(n){return typeof n=="number"||yu(n)&&"[object Number]"==Ot(n)}function xu(n){return!(!yu(n)||"[object Object]"!=Ot(n))&&(n=di(n),null===n||(n=oi.call(n,"constructor")&&n.constructor,typeof n=="function"&&n instanceof n&&ii.call(n)==li))}function ju(n){return typeof n=="string"||!ff(n)&&yu(n)&&"[object String]"==Ot(n)}function wu(n){return typeof n=="symbol"||yu(n)&&"[object Symbol]"==Ot(n);
    - }function mu(n){if(!n)return[];if(su(n))return ju(n)?M(n):Ur(n);if(wi&&n[wi]){n=n[wi]();for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}return t=vo(n),("[object Map]"==t?W:"[object Set]"==t?U:Uu)(n)}function Au(n){return n?(n=Su(n),n===$||n===-$?1.7976931348623157e308*(0>n?-1:1):n===n?n:0):0===n?n:0}function Eu(n){n=Au(n);var t=n%1;return n===n?t?n-t:n:0}function ku(n){return n?pt(Eu(n),0,4294967295):0}function Su(n){if(typeof n=="number")return n;if(wu(n))return F;if(du(n)&&(n=typeof n.valueOf=="function"?n.valueOf():n,
    - n=du(n)?n+"":n),typeof n!="string")return 0===n?n:+n;n=n.replace(un,"");var t=gn.test(n);return t||yn.test(n)?Dn(n.slice(2),t?2:8):vn.test(n)?F:+n}function Ou(n){return Cr(n,Bu(n))}function Iu(n){return null==n?"":yr(n)}function Ru(n,t,r){return n=null==n?T:kt(n,t),n===T?r:n}function zu(n,t){return null!=n&&we(n,t,zt)}function Wu(n){return su(n)?qn(n):Vt(n)}function Bu(n){if(su(n))n=qn(n,true);else if(du(n)){var t,r=ze(n),e=[];for(t in n)("constructor"!=t||!r&&oi.call(n,t))&&e.push(t);n=e}else{if(t=[],
    - null!=n)for(r in Qu(n))t.push(r);n=t}return n}function Lu(n,t){if(null==n)return{};var r=c(ve(n),function(n){return[n]});return t=ye(t),tr(n,r,function(n,r){return t(n,r[0])})}function Uu(n){return null==n?[]:S(n,Wu(n))}function Cu(n){return $f(Iu(n).toLowerCase())}function Du(n){return(n=Iu(n))&&n.replace(xn,Xn).replace(Sn,"")}function Mu(n,t,r){return n=Iu(n),t=r?T:t,t===T?zn.test(n)?n.match(In)||[]:n.match(sn)||[]:n.match(t)||[]}function Tu(n){return function(){return n}}function $u(n){return n;
    - }function Fu(n){return qt(typeof n=="function"?n:_t(n,1))}function Nu(n,t,e){var u=Wu(t),i=Et(t,u);null!=e||du(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=Et(t,Wu(t)));var o=!(du(e)&&"chain"in e&&!e.chain),f=_u(n);return r(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Ur(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function Pu(){}
    - function Zu(n){return Ie(n)?b(Me(n)):rr(n)}function qu(){return[]}function Vu(){return false}mn=null==mn?$n:rt.defaults($n.Object(),mn,rt.pick($n,Wn));var Ku=mn.Array,Gu=mn.Date,Hu=mn.Error,Ju=mn.Function,Yu=mn.Math,Qu=mn.Object,Xu=mn.RegExp,ni=mn.String,ti=mn.TypeError,ri=Ku.prototype,ei=Qu.prototype,ui=mn["__core-js_shared__"],ii=Ju.prototype.toString,oi=ei.hasOwnProperty,fi=0,ci=function(){var n=/[^.]+$/.exec(ui&&ui.keys&&ui.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),ai=ei.toString,li=ii.call(Qu),si=$n._,hi=Xu("^"+ii.call(oi).replace(rn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pi=Pn?mn.Buffer:T,_i=mn.Symbol,vi=mn.Uint8Array,gi=pi?pi.g:T,di=B(Qu.getPrototypeOf,Qu),yi=Qu.create,bi=ei.propertyIsEnumerable,xi=ri.splice,ji=_i?_i.isConcatSpreadable:T,wi=_i?_i.iterator:T,mi=_i?_i.toStringTag:T,Ai=function(){
    - try{var n=je(Qu,"defineProperty");return n({},"",{}),n}catch(n){}}(),Ei=mn.clearTimeout!==$n.clearTimeout&&mn.clearTimeout,ki=Gu&&Gu.now!==$n.Date.now&&Gu.now,Si=mn.setTimeout!==$n.setTimeout&&mn.setTimeout,Oi=Yu.ceil,Ii=Yu.floor,Ri=Qu.getOwnPropertySymbols,zi=pi?pi.isBuffer:T,Wi=mn.isFinite,Bi=ri.join,Li=B(Qu.keys,Qu),Ui=Yu.max,Ci=Yu.min,Di=Gu.now,Mi=mn.parseInt,Ti=Yu.random,$i=ri.reverse,Fi=je(mn,"DataView"),Ni=je(mn,"Map"),Pi=je(mn,"Promise"),Zi=je(mn,"Set"),qi=je(mn,"WeakMap"),Vi=je(Qu,"create"),Ki=qi&&new qi,Gi={},Hi=Te(Fi),Ji=Te(Ni),Yi=Te(Pi),Qi=Te(Zi),Xi=Te(qi),no=_i?_i.prototype:T,to=no?no.valueOf:T,ro=no?no.toString:T,eo=function(){
    - function n(){}return function(t){return du(t)?yi?yi(t):(n.prototype=t,t=new n,n.prototype=T,t):{}}}();An.templateSettings={escape:J,evaluate:Y,interpolate:Q,variable:"",imports:{_:An}},An.prototype=En.prototype,An.prototype.constructor=An,On.prototype=eo(En.prototype),On.prototype.constructor=On,Un.prototype=eo(En.prototype),Un.prototype.constructor=Un,Mn.prototype.clear=function(){this.__data__=Vi?Vi(null):{},this.size=0},Mn.prototype.delete=function(n){return n=this.has(n)&&delete this.__data__[n],
    - this.size-=n?1:0,n},Mn.prototype.get=function(n){var t=this.__data__;return Vi?(n=t[n],"__lodash_hash_undefined__"===n?T:n):oi.call(t,n)?t[n]:T},Mn.prototype.has=function(n){var t=this.__data__;return Vi?t[n]!==T:oi.call(t,n)},Mn.prototype.set=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=Vi&&t===T?"__lodash_hash_undefined__":t,this},Tn.prototype.clear=function(){this.__data__=[],this.size=0},Tn.prototype.delete=function(n){var t=this.__data__;return n=ft(t,n),!(0>n)&&(n==t.length-1?t.pop():xi.call(t,n,1),
    - },Fn.prototype.has=function(n){return be(this,n).has(n)},Fn.prototype.set=function(n,t){var r=be(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this},Nn.prototype.add=Nn.prototype.push=function(n){return this.__data__.set(n,"__lodash_hash_undefined__"),this},Nn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.clear=function(){this.__data__=new Tn,this.size=0},Zn.prototype.delete=function(n){var t=this.__data__;return n=t.delete(n),this.size=t.size,n},Zn.prototype.get=function(n){
    - return this.__data__.get(n)},Zn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.set=function(n,t){var r=this.__data__;if(r instanceof Tn){var e=r.__data__;if(!Ni||199>e.length)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new Fn(e)}return r.set(n,t),this.size=r.size,this};var uo=Fr(mt),io=Fr(At,true),oo=Nr(),fo=Nr(true),co=Ki?function(n,t){return Ki.set(n,t),n}:$u,ao=Ai?function(n,t){return Ai(n,"toString",{configurable:true,enumerable:false,value:Tu(t),writable:true})}:$u,lo=Ei||function(n){
    - return $n.clearTimeout(n)},so=Zi&&1/U(new Zi([,-0]))[1]==$?function(n){return new Zi(n)}:Pu,ho=Ki?function(n){return Ki.get(n)}:Pu,po=Ri?function(n){return null==n?[]:(n=Qu(n),i(Ri(n),function(t){return bi.call(n,t)}))}:qu,_o=Ri?function(n){for(var t=[];n;)a(t,po(n)),n=di(n);return t}:qu,vo=Ot;(Fi&&"[object DataView]"!=vo(new Fi(new ArrayBuffer(1)))||Ni&&"[object Map]"!=vo(new Ni)||Pi&&"[object Promise]"!=vo(Pi.resolve())||Zi&&"[object Set]"!=vo(new Zi)||qi&&"[object WeakMap]"!=vo(new qi))&&(vo=function(n){
    - var t=Ot(n);if(n=(n="[object Object]"==t?n.constructor:T)?Te(n):"")switch(n){case Hi:return"[object DataView]";case Ji:return"[object Map]";case Yi:return"[object Promise]";case Qi:return"[object Set]";case Xi:return"[object WeakMap]"}return t});var go=ui?_u:Vu,yo=Ce(co),bo=Si||function(n,t){return $n.setTimeout(n,t)},xo=Ce(ao),jo=function(n){n=cu(n,function(n){return 500===t.size&&t.clear(),n});var t=n.cache;return n}(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(tn,function(n,r,e,u){
    - t.push(e?u.replace(hn,"$1"):r||n)}),t}),wo=fr(function(n,t){return hu(n)?yt(n,wt(t,1,hu,true)):[]}),mo=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),ye(r,2)):[]}),Ao=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),T,r):[]}),Eo=fr(function(n){var t=c(n,Er);return t.length&&t[0]===n[0]?Wt(t):[]}),ko=fr(function(n){var t=Ve(n),r=c(n,Er);return t===Ve(r)?t=T:r.pop(),r.length&&r[0]===n[0]?Wt(r,ye(t,2)):[]}),So=fr(function(n){var t=Ve(n),r=c(n,Er);return(t=typeof t=="function"?t:T)&&r.pop(),
    - r.length&&r[0]===n[0]?Wt(r,T,t):[]}),Oo=fr(Ke),Io=pe(function(n,t){var r=null==n?0:n.length,e=ht(n,t);return ur(n,c(t,function(n){return Se(n,r)?+n:n}).sort(Wr)),e}),Ro=fr(function(n){return br(wt(n,1,hu,true))}),zo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T),br(wt(n,1,hu,true),ye(t,2))}),Wo=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return br(wt(n,1,hu,true),T,t)}),Bo=fr(function(n,t){return hu(n)?yt(n,t):[]}),Lo=fr(function(n){return mr(i(n,hu))}),Uo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T),
    - mr(i(n,hu),ye(t,2))}),Co=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return mr(i(n,hu),T,t)}),Do=fr(He),Mo=fr(function(n){var t=n.length,t=1
    - n})):this.thru(t)}),$o=Tr(function(n,t,r){oi.call(n,r)?++n[r]:st(n,r,1)}),Fo=Gr(Ne),No=Gr(Pe),Po=Tr(function(n,t,r){oi.call(n,r)?n[r].push(t):st(n,r,[t])}),Zo=fr(function(t,r,e){var u=-1,i=typeof r=="function",o=su(t)?Ku(t.length):[];return uo(t,function(t){o[++u]=i?n(r,t,e):Lt(t,r,e)}),o}),qo=Tr(function(n,t,r){st(n,r,t)}),Vo=Tr(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),Ko=fr(function(n,t){if(null==n)return[];var r=t.length;return 1
    - Xt(n,wt(t,1),[])}),Go=ki||function(){return $n.Date.now()},Ho=fr(function(n,t,r){var e=1;if(r.length)var u=L(r,de(Ho)),e=32|e;return fe(n,e,t,r,u)}),Jo=fr(function(n,t,r){var e=3;if(r.length)var u=L(r,de(Jo)),e=32|e;return fe(t,e,n,r,u)}),Yo=fr(function(n,t){return dt(n,1,t)}),Qo=fr(function(n,t,r){return dt(n,Su(t)||0,r)});cu.Cache=Fn;var Xo=fr(function(t,r){r=1==r.length&&ff(r[0])?c(r[0],k(ye())):c(wt(r,1),k(ye()));var e=r.length;return fr(function(u){for(var i=-1,o=Ci(u.length,e);++i
    - return n(t,this,u)})}),nf=fr(function(n,t){return fe(n,32,T,t,L(t,de(nf)))}),tf=fr(function(n,t){return fe(n,64,T,t,L(t,de(tf)))}),rf=pe(function(n,t){return fe(n,256,T,T,T,t)}),ef=ee(It),uf=ee(function(n,t){return n>=t}),of=Ut(function(){return arguments}())?Ut:function(n){return yu(n)&&oi.call(n,"callee")&&!bi.call(n,"callee")},ff=Ku.isArray,cf=Vn?k(Vn):Ct,af=zi||Vu,lf=Kn?k(Kn):Dt,sf=Gn?k(Gn):Tt,hf=Hn?k(Hn):Nt,pf=Jn?k(Jn):Pt,_f=Yn?k(Yn):Zt,vf=ee(Kt),gf=ee(function(n,t){return n<=t}),df=$r(function(n,t){
    - if(ze(t)||su(t))Cr(t,Wu(t),n);else for(var r in t)oi.call(t,r)&&ot(n,r,t[r])}),yf=$r(function(n,t){Cr(t,Bu(t),n)}),bf=$r(function(n,t,r,e){Cr(t,Bu(t),n,e)}),xf=$r(function(n,t,r,e){Cr(t,Wu(t),n,e)}),jf=pe(ht),wf=fr(function(n,t){n=Qu(n);var r=-1,e=t.length,u=2
    - null!=t&&typeof t.toString!="function"&&(t=ai.call(t)),n[t]=r},Tu($u)),Ef=Yr(function(n,t,r){null!=t&&typeof t.toString!="function"&&(t=ai.call(t)),oi.call(n,t)?n[t].push(r):n[t]=[r]},ye),kf=fr(Lt),Sf=$r(function(n,t,r){Yt(n,t,r)}),Of=$r(function(n,t,r,e){Yt(n,t,r,e)}),If=pe(function(n,t){var r={};if(null==n)return r;var e=false;t=c(t,function(t){return t=Sr(t,n),e||(e=1
    - }),zf=oe(Wu),Wf=oe(Bu),Bf=qr(function(n,t,r){return t=t.toLowerCase(),n+(r?Cu(t):t)}),Lf=qr(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),Uf=qr(function(n,t,r){return n+(r?" ":"")+t.toLowerCase()}),Cf=Zr("toLowerCase"),Df=qr(function(n,t,r){return n+(r?"_":"")+t.toLowerCase()}),Mf=qr(function(n,t,r){return n+(r?" ":"")+$f(t)}),Tf=qr(function(n,t,r){return n+(r?" ":"")+t.toUpperCase()}),$f=Zr("toUpperCase"),Ff=fr(function(t,r){try{return n(t,T,r)}catch(n){return pu(n)?n:new Hu(n)}}),Nf=pe(function(n,t){
    - return r(t,function(t){t=Me(t),st(n,t,Ho(n[t],n))}),n}),Pf=Hr(),Zf=Hr(true),qf=fr(function(n,t){return function(r){return Lt(r,n,t)}}),Vf=fr(function(n,t){return function(r){return Lt(n,r,t)}}),Kf=Xr(c),Gf=Xr(u),Hf=Xr(h),Jf=re(),Yf=re(true),Qf=Qr(function(n,t){return n+t},0),Xf=ie("ceil"),nc=Qr(function(n,t){return n/t},1),tc=ie("floor"),rc=Qr(function(n,t){return n*t},1),ec=ie("round"),uc=Qr(function(n,t){return n-t},0);return An.after=function(n,t){if(typeof t!="function")throw new ti("Expected a function");
    - return n=Eu(n),function(){if(1>--n)return t.apply(this,arguments)}},An.ary=eu,An.assign=df,An.assignIn=yf,An.assignInWith=bf,An.assignWith=xf,An.at=jf,An.before=uu,An.bind=Ho,An.bindAll=Nf,An.bindKey=Jo,An.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return ff(n)?n:[n]},An.chain=Ye,An.chunk=function(n,t,r){if(t=(r?Oe(n,t,r):t===T)?1:Ui(Eu(t),0),r=null==n?0:n.length,!r||1>t)return[];for(var e=0,u=0,i=Ku(Oi(r/t));e
    - var i=n[t];i&&(u[e++]=i)}return u},An.concat=function(){var n=arguments.length;if(!n)return[];for(var t=Ku(n-1),r=arguments[0];n--;)t[n-1]=arguments[n];return a(ff(r)?Ur(r):[r],wt(t,1))},An.cond=function(t){var r=null==t?0:t.length,e=ye();return t=r?c(t,function(n){if("function"!=typeof n[1])throw new ti("Expected a function");return[e(n[0]),n[1]]}):[],fr(function(e){for(var u=-1;++u
    - An.countBy=$o,An.create=function(n,t){var r=eo(n);return null==t?r:at(r,t)},An.curry=iu,An.curryRight=ou,An.debounce=fu,An.defaults=wf,An.defaultsDeep=mf,An.defer=Yo,An.delay=Qo,An.difference=wo,An.differenceBy=mo,An.differenceWith=Ao,An.drop=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Eu(t),hr(n,0>t?0:t,e)):[]},An.dropRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Eu(t),t=e-t,hr(n,0,0>t?0:t)):[]},An.dropRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true,true):[];
    - },An.dropWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true):[]},An.fill=function(n,t,r,e){var u=null==n?0:n.length;if(!u)return[];for(r&&typeof r!="number"&&Oe(n,t,r)&&(r=0,e=u),u=n.length,r=Eu(r),0>r&&(r=-r>u?0:u+r),e=e===T||e>u?u:Eu(e),0>e&&(e+=u),e=r>e?0:ku(e);r
    - wt(ru(n,t),r)},An.flatten=Ze,An.flattenDeep=function(n){return(null==n?0:n.length)?wt(n,$):[]},An.flattenDepth=function(n,t){return null!=n&&n.length?(t=t===T?1:Eu(t),wt(n,t)):[]},An.flip=function(n){return fe(n,512)},An.flow=Pf,An.flowRight=Zf,An.fromPairs=function(n){for(var t=-1,r=null==n?0:n.length,e={};++t
    - return(null==n?0:n.length)?hr(n,0,-1):[]},An.intersection=Eo,An.intersectionBy=ko,An.intersectionWith=So,An.invert=Af,An.invertBy=Ef,An.invokeMap=Zo,An.iteratee=Fu,An.keyBy=qo,An.keys=Wu,An.keysIn=Bu,An.map=ru,An.mapKeys=function(n,t){var r={};return t=ye(t,3),mt(n,function(n,e,u){st(r,t(n,e,u),n)}),r},An.mapValues=function(n,t){var r={};return t=ye(t,3),mt(n,function(n,e,u){st(r,e,t(n,e,u))}),r},An.matches=function(n){return Ht(_t(n,1))},An.matchesProperty=function(n,t){return Jt(n,_t(t,1))},An.memoize=cu,
    - An.merge=Sf,An.mergeWith=Of,An.method=qf,An.methodOf=Vf,An.mixin=Nu,An.negate=au,An.nthArg=function(n){return n=Eu(n),fr(function(t){return Qt(t,n)})},An.omit=If,An.omitBy=function(n,t){return Lu(n,au(ye(t)))},An.once=function(n){return uu(2,n)},An.orderBy=function(n,t,r,e){return null==n?[]:(ff(t)||(t=null==t?[]:[t]),r=e?T:r,ff(r)||(r=null==r?[]:[r]),Xt(n,t,r))},An.over=Kf,An.overArgs=Xo,An.overEvery=Gf,An.overSome=Hf,An.partial=nf,An.partialRight=tf,An.partition=Vo,An.pick=Rf,An.pickBy=Lu,An.property=Zu,
    - An.propertyOf=function(n){return function(t){return null==n?T:kt(n,t)}},An.pull=Oo,An.pullAll=Ke,An.pullAllBy=function(n,t,r){return n&&n.length&&t&&t.length?er(n,t,ye(r,2)):n},An.pullAllWith=function(n,t,r){return n&&n.length&&t&&t.length?er(n,t,T,r):n},An.pullAt=Io,An.range=Jf,An.rangeRight=Yf,An.rearg=rf,An.reject=function(n,t){return(ff(n)?i:jt)(n,au(ye(t,3)))},An.remove=function(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],i=n.length;for(t=ye(t,3);++e
    - u.push(e))}return ur(n,u),r},An.rest=function(n,t){if(typeof n!="function")throw new ti("Expected a function");return t=t===T?t:Eu(t),fr(n,t)},An.reverse=Ge,An.sampleSize=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:Eu(t),(ff(n)?et:ar)(n,t)},An.set=function(n,t,r){return null==n?n:lr(n,t,r)},An.setWith=function(n,t,r,e){return e=typeof e=="function"?e:T,null==n?n:lr(n,t,r,e)},An.shuffle=function(n){return(ff(n)?ut:sr)(n)},An.slice=function(n,t,r){var e=null==n?0:n.length;return e?(r&&typeof r!="number"&&Oe(n,t,r)?(t=0,
    - r=e):(t=null==t?0:Eu(t),r=r===T?e:Eu(r)),hr(n,t,r)):[]},An.sortBy=Ko,An.sortedUniq=function(n){return n&&n.length?gr(n):[]},An.sortedUniqBy=function(n,t){return n&&n.length?gr(n,ye(t,2)):[]},An.split=function(n,t,r){return r&&typeof r!="number"&&Oe(n,t,r)&&(t=r=T),r=r===T?4294967295:r>>>0,r?(n=Iu(n))&&(typeof t=="string"||null!=t&&!hf(t))&&(t=yr(t),!t&&Rn.test(n))?Or(M(n),0,r):n.split(t,r):[]},An.spread=function(t,r){if(typeof t!="function")throw new ti("Expected a function");return r=null==r?0:Ui(Eu(r),0),
    - fr(function(e){var u=e[r];return e=Or(e,0,r),u&&a(e,u),n(t,this,e)})},An.tail=function(n){var t=null==n?0:n.length;return t?hr(n,1,t):[]},An.take=function(n,t,r){return n&&n.length?(t=r||t===T?1:Eu(t),hr(n,0,0>t?0:t)):[]},An.takeRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Eu(t),t=e-t,hr(n,0>t?0:t,e)):[]},An.takeRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),false,true):[]},An.takeWhile=function(n,t){return n&&n.length?jr(n,ye(t,3)):[]},An.tap=function(n,t){return t(n),
    - n},An.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new ti("Expected a function");return du(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),fu(n,t,{leading:e,maxWait:t,trailing:u})},An.thru=Qe,An.toArray=mu,An.toPairs=zf,An.toPairsIn=Wf,An.toPath=function(n){return ff(n)?c(n,Me):wu(n)?[n]:Ur(jo(Iu(n)))},An.toPlainObject=Ou,An.transform=function(n,t,e){var u=ff(n),i=u||af(n)||_f(n);if(t=ye(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:du(n)&&_u(o)?eo(di(n)):{};
    - }return(i?r:mt)(n,function(n,r,u){return t(e,n,r,u)}),e},An.unary=function(n){return eu(n,1)},An.union=Ro,An.unionBy=zo,An.unionWith=Wo,An.uniq=function(n){return n&&n.length?br(n):[]},An.uniqBy=function(n,t){return n&&n.length?br(n,ye(t,2)):[]},An.uniqWith=function(n,t){return t=typeof t=="function"?t:T,n&&n.length?br(n,T,t):[]},An.unset=function(n,t){return null==n||xr(n,t)},An.unzip=He,An.unzipWith=Je,An.update=function(n,t,r){return null==n?n:lr(n,t,kr(r)(kt(n,t)),void 0)},An.updateWith=function(n,t,r,e){
    - return e=typeof e=="function"?e:T,null!=n&&(n=lr(n,t,kr(r)(kt(n,t)),e)),n},An.values=Uu,An.valuesIn=function(n){return null==n?[]:S(n,Bu(n))},An.without=Bo,An.words=Mu,An.wrap=function(n,t){return nf(kr(t),n)},An.xor=Lo,An.xorBy=Uo,An.xorWith=Co,An.zip=Do,An.zipObject=function(n,t){return Ar(n||[],t||[],ot)},An.zipObjectDeep=function(n,t){return Ar(n||[],t||[],lr)},An.zipWith=Mo,An.entries=zf,An.entriesIn=Wf,An.extend=yf,An.extendWith=bf,Nu(An,An),An.add=Qf,An.attempt=Ff,An.camelCase=Bf,An.capitalize=Cu,
    - An.ceil=Xf,An.clamp=function(n,t,r){return r===T&&(r=t,t=T),r!==T&&(r=Su(r),r=r===r?r:0),t!==T&&(t=Su(t),t=t===t?t:0),pt(Su(n),t,r)},An.clone=function(n){return _t(n,4)},An.cloneDeep=function(n){return _t(n,5)},An.cloneDeepWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,5,t)},An.cloneWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,4,t)},An.conformsTo=function(n,t){return null==t||gt(n,t,Wu(t))},An.deburr=Du,An.defaultTo=function(n,t){return null==n||n!==n?t:n},An.divide=nc,An.endsWith=function(n,t,r){
    - n=Iu(n),t=yr(t);var e=n.length,e=r=r===T?e:pt(Eu(r),0,e);return r-=t.length,0<=r&&n.slice(r,e)==t},An.eq=lu,An.escape=function(n){return(n=Iu(n))&&H.test(n)?n.replace(K,nt):n},An.escapeRegExp=function(n){return(n=Iu(n))&&en.test(n)?n.replace(rn,"\\$&"):n},An.every=function(n,t,r){var e=ff(n)?u:bt;return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.find=Fo,An.findIndex=Ne,An.findKey=function(n,t){return p(n,ye(t,3),mt)},An.findLast=No,An.findLastIndex=Pe,An.findLastKey=function(n,t){return p(n,ye(t,3),At);
    - },An.floor=tc,An.forEach=nu,An.forEachRight=tu,An.forIn=function(n,t){return null==n?n:oo(n,ye(t,3),Bu)},An.forInRight=function(n,t){return null==n?n:fo(n,ye(t,3),Bu)},An.forOwn=function(n,t){return n&&mt(n,ye(t,3))},An.forOwnRight=function(n,t){return n&&At(n,ye(t,3))},An.get=Ru,An.gt=ef,An.gte=uf,An.has=function(n,t){return null!=n&&we(n,t,Rt)},An.hasIn=zu,An.head=qe,An.identity=$u,An.includes=function(n,t,r,e){return n=su(n)?n:Uu(n),r=r&&!e?Eu(r):0,e=n.length,0>r&&(r=Ui(e+r,0)),ju(n)?r<=e&&-1
    - },An.indexOf=function(n,t,r){var e=null==n?0:n.length;return e?(r=null==r?0:Eu(r),0>r&&(r=Ui(e+r,0)),v(n,t,r)):-1},An.inRange=function(n,t,r){return t=Au(t),r===T?(r=t,t=0):r=Au(r),n=Su(n),n>=Ci(t,r)&&n
    - if(null==n)return true;if(su(n)&&(ff(n)||typeof n=="string"||typeof n.splice=="function"||af(n)||_f(n)||of(n)))return!n.length;var t=vo(n);if("[object Map]"==t||"[object Set]"==t)return!n.size;if(ze(n))return!Vt(n).length;for(var r in n)if(oi.call(n,r))return false;return true},An.isEqual=function(n,t){return Mt(n,t)},An.isEqualWith=function(n,t,r){var e=(r=typeof r=="function"?r:T)?r(n,t):T;return e===T?Mt(n,t,T,r):!!e},An.isError=pu,An.isFinite=function(n){return typeof n=="number"&&Wi(n)},An.isFunction=_u,
    - An.isInteger=vu,An.isLength=gu,An.isMap=sf,An.isMatch=function(n,t){return n===t||$t(n,t,xe(t))},An.isMatchWith=function(n,t,r){return r=typeof r=="function"?r:T,$t(n,t,xe(t),r)},An.isNaN=function(n){return bu(n)&&n!=+n},An.isNative=function(n){if(go(n))throw new Hu("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Ft(n)},An.isNil=function(n){return null==n},An.isNull=function(n){return null===n},An.isNumber=bu,An.isObject=du,An.isObjectLike=yu,An.isPlainObject=xu,An.isRegExp=hf,
    - An.isSafeInteger=function(n){return vu(n)&&-9007199254740991<=n&&9007199254740991>=n},An.isSet=pf,An.isString=ju,An.isSymbol=wu,An.isTypedArray=_f,An.isUndefined=function(n){return n===T},An.isWeakMap=function(n){return yu(n)&&"[object WeakMap]"==vo(n)},An.isWeakSet=function(n){return yu(n)&&"[object WeakSet]"==Ot(n)},An.join=function(n,t){return null==n?"":Bi.call(n,t)},An.kebabCase=Lf,An.last=Ve,An.lastIndexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;if(r!==T&&(u=Eu(r),u=0>u?Ui(e+u,0):Ci(u,e-1)),
    - t===t){for(r=u+1;r--&&n[r]!==t;);n=r}else n=_(n,d,u,true);return n},An.lowerCase=Uf,An.lowerFirst=Cf,An.lt=vf,An.lte=gf,An.max=function(n){return n&&n.length?xt(n,$u,It):T},An.maxBy=function(n,t){return n&&n.length?xt(n,ye(t,2),It):T},An.mean=function(n){return y(n,$u)},An.meanBy=function(n,t){return y(n,ye(t,2))},An.min=function(n){return n&&n.length?xt(n,$u,Kt):T},An.minBy=function(n,t){return n&&n.length?xt(n,ye(t,2),Kt):T},An.stubArray=qu,An.stubFalse=Vu,An.stubObject=function(){return{}},An.stubString=function(){
    - return""},An.stubTrue=function(){return true},An.multiply=rc,An.nth=function(n,t){return n&&n.length?Qt(n,Eu(t)):T},An.noConflict=function(){return $n._===this&&($n._=si),this},An.noop=Pu,An.now=Go,An.pad=function(n,t,r){n=Iu(n);var e=(t=Eu(t))?D(n):0;return!t||e>=t?n:(t=(t-e)/2,ne(Ii(t),r)+n+ne(Oi(t),r))},An.padEnd=function(n,t,r){n=Iu(n);var e=(t=Eu(t))?D(n):0;return t&&e
    - return r||null==t?t=0:t&&(t=+t),Mi(Iu(n).replace(on,""),t||0)},An.random=function(n,t,r){if(r&&typeof r!="boolean"&&Oe(n,t,r)&&(t=r=T),r===T&&(typeof t=="boolean"?(r=t,t=T):typeof n=="boolean"&&(r=n,n=T)),n===T&&t===T?(n=0,t=1):(n=Au(n),t===T?(t=n,n=0):t=Au(t)),n>t){var e=n;n=t,t=e}return r||n%1||t%1?(r=Ti(),Ci(n+r*(t-n+Cn("1e-"+((r+"").length-1))),t)):ir(n,t)},An.reduce=function(n,t,r){var e=ff(n)?l:j,u=3>arguments.length;return e(n,ye(t,4),r,u,uo)},An.reduceRight=function(n,t,r){var e=ff(n)?s:j,u=3>arguments.length;
    - return e(n,ye(t,4),r,u,io)},An.repeat=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:Eu(t),or(Iu(n),t)},An.replace=function(){var n=arguments,t=Iu(n[0]);return 3>n.length?t:t.replace(n[1],n[2])},An.result=function(n,t,r){t=Sr(t,n);var e=-1,u=t.length;for(u||(u=1,n=T);++e
    - var t=vo(n);return"[object Map]"==t||"[object Set]"==t?n.size:Vt(n).length},An.snakeCase=Df,An.some=function(n,t,r){var e=ff(n)?h:pr;return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.sortedIndex=function(n,t){return _r(n,t)},An.sortedIndexBy=function(n,t,r){return vr(n,t,ye(r,2))},An.sortedIndexOf=function(n,t){var r=null==n?0:n.length;if(r){var e=_r(n,t);if(e
    - },An.sortedLastIndexOf=function(n,t){if(null==n?0:n.length){var r=_r(n,t,true)-1;if(lu(n[r],t))return r}return-1},An.startCase=Mf,An.startsWith=function(n,t,r){return n=Iu(n),r=null==r?0:pt(Eu(r),0,n.length),t=yr(t),n.slice(r,r+t.length)==t},An.subtract=uc,An.sum=function(n){return n&&n.length?m(n,$u):0},An.sumBy=function(n,t){return n&&n.length?m(n,ye(t,2)):0},An.template=function(n,t,r){var e=An.templateSettings;r&&Oe(n,t,r)&&(t=T),n=Iu(n),t=bf({},t,e,ce),r=bf({},t.imports,e.imports,ce);var u,i,o=Wu(r),f=S(r,o),c=0;
    - r=t.interpolate||jn;var a="__p+='";r=Xu((t.escape||jn).source+"|"+r.source+"|"+(r===Q?pn:jn).source+"|"+(t.evaluate||jn).source+"|$","g");var l=oi.call(t,"sourceURL")?"//# sourceURL="+(t.sourceURL+"").replace(/[\r\n]/g," ")+"\n":"";if(n.replace(r,function(t,r,e,o,f,l){return e||(e=o),a+=n.slice(c,l).replace(wn,z),r&&(u=true,a+="'+__e("+r+")+'"),f&&(i=true,a+="';"+f+";\n__p+='"),e&&(a+="'+((__t=("+e+"))==null?'':__t)+'"),c=l+t.length,t}),a+="';",(t=oi.call(t,"variable")&&t.variable)||(a="with(obj){"+a+"}"),
    - a=(i?a.replace(P,""):a).replace(Z,"$1").replace(q,"$1;"),a="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+a+"return __p}",t=Ff(function(){return Ju(o,l+"return "+a).apply(T,f)}),t.source=a,pu(t))throw t;return t},An.times=function(n,t){if(n=Eu(n),1>n||9007199254740991
    - An.toInteger=Eu,An.toLength=ku,An.toLower=function(n){return Iu(n).toLowerCase()},An.toNumber=Su,An.toSafeInteger=function(n){return n?pt(Eu(n),-9007199254740991,9007199254740991):0===n?n:0},An.toString=Iu,An.toUpper=function(n){return Iu(n).toUpperCase()},An.trim=function(n,t,r){return(n=Iu(n))&&(r||t===T)?n.replace(un,""):n&&(t=yr(t))?(n=M(n),r=M(t),t=I(n,r),r=R(n,r)+1,Or(n,t,r).join("")):n},An.trimEnd=function(n,t,r){return(n=Iu(n))&&(r||t===T)?n.replace(fn,""):n&&(t=yr(t))?(n=M(n),t=R(n,M(t))+1,
    - Or(n,0,t).join("")):n},An.trimStart=function(n,t,r){return(n=Iu(n))&&(r||t===T)?n.replace(on,""):n&&(t=yr(t))?(n=M(n),t=I(n,M(t)),Or(n,t).join("")):n},An.truncate=function(n,t){var r=30,e="...";if(du(t))var u="separator"in t?t.separator:u,r="length"in t?Eu(t.length):r,e="omission"in t?yr(t.omission):e;n=Iu(n);var i=n.length;if(Rn.test(n))var o=M(n),i=o.length;if(r>=i)return n;if(i=r-D(e),1>i)return e;if(r=o?Or(o,0,i).join(""):n.slice(0,i),u===T)return r+e;if(o&&(i+=r.length-i),hf(u)){if(n.slice(i).search(u)){
    - var f=r;for(u.global||(u=Xu(u.source,Iu(_n.exec(u))+"g")),u.lastIndex=0;o=u.exec(f);)var c=o.index;r=r.slice(0,c===T?i:c)}}else n.indexOf(yr(u),i)!=i&&(u=r.lastIndexOf(u),-1
    - }),An.VERSION="4.17.15",r("bind bindKey curry curryRight partial partialRight".split(" "),function(n){An[n].placeholder=An}),r(["drop","take"],function(n,t){Un.prototype[n]=function(r){r=r===T?1:Ui(Eu(r),0);var e=this.__filtered__&&!t?new Un(this):this.clone();return e.__filtered__?e.__takeCount__=Ci(r,e.__takeCount__):e.__views__.push({size:Ci(r,4294967295),type:n+(0>e.__dir__?"Right":"")}),e},Un.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),r(["filter","map","takeWhile"],function(n,t){
    - var r=t+1,e=1==r||3==r;Un.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:ye(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),r(["head","last"],function(n,t){var r="take"+(t?"Right":"");Un.prototype[n]=function(){return this[r](1).value()[0]}}),r(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Un.prototype[n]=function(){return this.__filtered__?new Un(this):this[r](1)}}),Un.prototype.compact=function(){return this.filter($u)},Un.prototype.find=function(n){
    - return this.filter(n).head()},Un.prototype.findLast=function(n){return this.reverse().find(n)},Un.prototype.invokeMap=fr(function(n,t){return typeof n=="function"?new Un(this):this.map(function(r){return Lt(r,n,t)})}),Un.prototype.reject=function(n){return this.filter(au(ye(n)))},Un.prototype.slice=function(n,t){n=Eu(n);var r=this;return r.__filtered__&&(0t)?new Un(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==T&&(t=Eu(t),r=0>t?r.dropRight(-t):r.take(t-n)),r)},Un.prototype.takeRightWhile=function(n){
    - return this.reverse().takeWhile(n).reverse()},Un.prototype.toArray=function(){return this.take(4294967295)},mt(Un.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=An[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);u&&(An.prototype[t]=function(){function t(n){return n=u.apply(An,a([n],f)),e&&h?n[0]:n}var o=this.__wrapped__,f=e?[1]:arguments,c=o instanceof Un,l=f[0],s=c||ff(o);s&&r&&typeof l=="function"&&1!=l.length&&(c=s=false);var h=this.__chain__,p=!!this.__actions__.length,l=i&&!h,c=c&&!p;
    - return!i&&s?(o=c?o:new Un(this),o=n.apply(o,f),o.__actions__.push({func:Qe,args:[t],thisArg:T}),new On(o,h)):l&&c?n.apply(this,f):(o=this.thru(t),l?e?o.value()[0]:o.value():o)})}),r("pop push shift sort splice unshift".split(" "),function(n){var t=ri[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);An.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(ff(u)?u:[],n)}return this[r](function(r){return t.apply(ff(r)?r:[],n)});
    - }}),mt(Un.prototype,function(n,t){var r=An[t];if(r){var e=r.name+"";oi.call(Gi,e)||(Gi[e]=[]),Gi[e].push({name:t,func:r})}}),Gi[Jr(T,2).name]=[{name:"wrapper",func:T}],Un.prototype.clone=function(){var n=new Un(this.__wrapped__);return n.__actions__=Ur(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Ur(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Ur(this.__views__),n},Un.prototype.reverse=function(){if(this.__filtered__){var n=new Un(this);
    - n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},Un.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=ff(t),u=0>r,i=e?t.length:0;n=i;for(var o=this.__views__,f=0,c=-1,a=o.length;++c
    - e=[];n:for(;n--&&a=this.__values__.length;return{done:n,value:n?T:this.__values__[this.__index__++]}},An.prototype.plant=function(n){
    - for(var t,r=this;r instanceof En;){var e=Fe(r);e.__index__=0,e.__values__=T,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},An.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Un?(this.__actions__.length&&(n=new Un(this)),n=n.reverse(),n.__actions__.push({func:Qe,args:[Ge],thisArg:T}),new On(n,this.__chain__)):this.thru(Ge)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return wr(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,
    - wi&&(An.prototype[wi]=Xe),An}();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($n._=rt, define(function(){return rt})):Nn?((Nn.exports=rt)._=rt,Fn._=rt):$n._=rt}).call(this);;
    + ;(function () {
    + function n(n, t, r) {
    + switch (r.length) {
    + case 0:
    + return n.call(t)
    + case 1:
    + return n.call(t, r[0])
    + case 2:
    + return n.call(t, r[0], r[1])
    + case 3:
    + return n.call(t, r[0], r[1], r[2])
    + }
    + return n.apply(t, r)
    + }
    + function t(n, t, r, e) {
    + for (var u = -1, i = null == n ? 0 : n.length; ++u < i; ) {
    + var o = n[u]
    + t(e, o, r(o), n)
    + }
    + return e
    + }
    + function r(n, t) {
    + for (var r = -1, e = null == n ? 0 : n.length; ++r < e && false !== t(n[r], r, n); );
    + return n
    + }
    + function e(n, t) {
    + for (var r = null == n ? 0 : n.length; r-- && false !== t(n[r], r, n); );
    + return n
    + }
    + function u(n, t) {
    + for (var r = -1, e = null == n ? 0 : n.length; ++r < e; ) if (!t(n[r], r, n)) return false
    + return true
    + }
    + function i(n, t) {
    + for (var r = -1, e = null == n ? 0 : n.length, u = 0, i = []; ++r < e; ) {
    + var o = n[r]
    + t(o, r, n) && (i[u++] = o)
    + }
    + return i
    + }
    + function o(n, t) {
    + return !(null == n || !n.length) && -1 < v(n, t, 0)
    + }
    + function f(n, t, r) {
    + for (var e = -1, u = null == n ? 0 : n.length; ++e < u; ) if (r(t, n[e])) return true
    + return false
    + }
    + function c(n, t) {
    + for (var r = -1, e = null == n ? 0 : n.length, u = Array(e); ++r < e; ) u[r] = t(n[r], r, n)
    + return u
    + }
    + function a(n, t) {
    + for (var r = -1, e = t.length, u = n.length; ++r < e; ) n[u + r] = t[r]
    + return n
    + }
    + function l(n, t, r, e) {
    + var u = -1,
    + i = null == n ? 0 : n.length
    + for (e && i && (r = n[++u]); ++u < i; ) r = t(r, n[u], u, n)
    + return r
    + }
    + function s(n, t, r, e) {
    + var u = null == n ? 0 : n.length
    + for (e && u && (r = n[--u]); u--; ) r = t(r, n[u], u, n)
    + return r
    + }
    + function h(n, t) {
    + for (var r = -1, e = null == n ? 0 : n.length; ++r < e; ) if (t(n[r], r, n)) return true
    + return false
    + }
    + function p(n, t, r) {
    + var e
    + return (
    + r(n, function (n, r, u) {
    + if (t(n, r, u)) return (e = r), false
    + }),
    + e
    + )
    + }
    + function _(n, t, r, e) {
    + var u = n.length
    + for (r += e ? 1 : -1; e ? r-- : ++r < u; ) if (t(n[r], r, n)) return r
    + return -1
    + }
    + function v(n, t, r) {
    + if (t === t)
    + n: {
    + --r
    + for (var e = n.length; ++r < e; )
    + if (n[r] === t) {
    + n = r
    + break n
    + }
    + n = -1
    + }
    + else n = _(n, d, r)
    + return n
    + }
    + function g(n, t, r, e) {
    + --r
    + for (var u = n.length; ++r < u; ) if (e(n[r], t)) return r
    + return -1
    + }
    + function d(n) {
    + return n !== n
    + }
    + function y(n, t) {
    + var r = null == n ? 0 : n.length
    + return r ? m(n, t) / r : F
    + }
    + function b(n) {
    + return function (t) {
    + return null == t ? T : t[n]
    + }
    + }
    + function x(n) {
    + return function (t) {
    + return null == n ? T : n[t]
    + }
    + }
    + function j(n, t, r, e, u) {
    + return (
    + u(n, function (n, u, i) {
    + r = e ? ((e = false), n) : t(r, n, u, i)
    + }),
    + r
    + )
    + }
    + function w(n, t) {
    + var r = n.length
    + for (n.sort(t); r--; ) n[r] = n[r].c
    + return n
    + }
    + function m(n, t) {
    + for (var r, e = -1, u = n.length; ++e < u; ) {
    + var i = t(n[e])
    + i !== T && (r = r === T ? i : r + i)
    + }
    + return r
    + }
    + function A(n, t) {
    + for (var r = -1, e = Array(n); ++r < n; ) e[r] = t(r)
    + return e
    + }
    + function E(n, t) {
    + return c(t, function (t) {
    + return [t, n[t]]
    + })
    + }
    + function k(n) {
    + return function (t) {
    + return n(t)
    + }
    + }
    + function S(n, t) {
    + return c(t, function (t) {
    + return n[t]
    + })
    + }
    + function O(n, t) {
    + return n.has(t)
    + }
    + function I(n, t) {
    + for (var r = -1, e = n.length; ++r < e && -1 < v(t, n[r], 0); );
    + return r
    + }
    + function R(n, t) {
    + for (var r = n.length; r-- && -1 < v(t, n[r], 0); );
    + return r
    + }
    + function z(n) {
    + return "\\" + Un[n]
    + }
    + function W(n) {
    + var t = -1,
    + r = Array(n.size)
    + return (
    + n.forEach(function (n, e) {
    + r[++t] = [e, n]
    + }),
    + r
    + )
    + }
    + function B(n, t) {
    + return function (r) {
    + return n(t(r))
    + }
    + }
    + function L(n, t) {
    + for (var r = -1, e = n.length, u = 0, i = []; ++r < e; ) {
    + var o = n[r]
    + ;(o !== t && "__lodash_placeholder__" !== o) || ((n[r] = "__lodash_placeholder__"), (i[u++] = r))
    + }
    + return i
    + }
    + function U(n) {
    + var t = -1,
    + r = Array(n.size)
    + return (
    + n.forEach(function (n) {
    + r[++t] = n
    + }),
    + r
    + )
    + }
    + function C(n) {
    + var t = -1,
    + r = Array(n.size)
    + return (
    + n.forEach(function (n) {
    + r[++t] = [n, n]
    + }),
    + r
    + )
    + }
    + function D(n) {
    + if (Rn.test(n)) {
    + for (var t = (On.lastIndex = 0); On.test(n); ) ++t
    + n = t
    + } else n = Qn(n)
    + return n
    + }
    + function M(n) {
    + return Rn.test(n) ? n.match(On) || [] : n.split("")
    + }
    + var T,
    + $ = 1 / 0,
    + F = NaN,
    + N = [
    + ["ary", 128],
    + ["bind", 1],
    + ["bindKey", 2],
    + ["curry", 8],
    + ["curryRight", 16],
    + ["flip", 512],
    + ["partial", 32],
    + ["partialRight", 64],
    + ["rearg", 256],
    + ],
    + P = /\b__p\+='';/g,
    + Z = /\b(__p\+=)''\+/g,
    + q = /(__e\(.*?\)|\b__t\))\+'';/g,
    + V = /&(?:amp|lt|gt|quot|#39);/g,
    + K = /[&<>"']/g,
    + G = RegExp(V.source),
    + H = RegExp(K.source),
    + J = /<%-([\s\S]+?)%>/g,
    + Y = /<%([\s\S]+?)%>/g,
    + Q = /<%=([\s\S]+?)%>/g,
    + X = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
    + nn = /^\w*$/,
    + tn = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,
    + rn = /[\\^$.*+?()[\]{}|]/g,
    + en = RegExp(rn.source),
    + un = /^\s+|\s+$/g,
    + on = /^\s+/,
    + fn = /\s+$/,
    + cn = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
    + an = /\{\n\/\* \[wrapped with (.+)\] \*/,
    + ln = /,? & /,
    + sn = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,
    + hn = /\\(\\)?/g,
    + pn = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,
    + _n = /\w*$/,
    + vn = /^[-+]0x[0-9a-f]+$/i,
    + gn = /^0b[01]+$/i,
    + dn = /^\[object .+?Constructor\]$/,
    + yn = /^0o[0-7]+$/i,
    + bn = /^(?:0|[1-9]\d*)$/,
    + xn = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,
    + jn = /($^)/,
    + wn = /['\n\r\u2028\u2029\\]/g,
    + mn =
    + "[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",
    + An = "(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])" + mn,
    + En =
    + "(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",
    + kn = RegExp("['\u2019]", "g"),
    + Sn = RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]", "g"),
    + On = RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|" + En + mn, "g"),
    + In = RegExp(
    + [
    + "[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",
    + An,
    + ].join("|"),
    + "g"
    + ),
    + Rn = RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),
    + zn = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,
    + Wn =
    + "Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(
    + " "
    + ),
    + Bn = {}
    + ;(Bn["[object Float32Array]"] =
    + Bn["[object Float64Array]"] =
    + Bn["[object Int8Array]"] =
    + Bn["[object Int16Array]"] =
    + Bn["[object Int32Array]"] =
    + Bn["[object Uint8Array]"] =
    + Bn["[object Uint8ClampedArray]"] =
    + Bn["[object Uint16Array]"] =
    + Bn["[object Uint32Array]"] =
    + true),
    + (Bn["[object Arguments]"] =
    + Bn["[object Array]"] =
    + Bn["[object ArrayBuffer]"] =
    + Bn["[object Boolean]"] =
    + Bn["[object DataView]"] =
    + Bn["[object Date]"] =
    + Bn["[object Error]"] =
    + Bn["[object Function]"] =
    + Bn["[object Map]"] =
    + Bn["[object Number]"] =
    + Bn["[object Object]"] =
    + Bn["[object RegExp]"] =
    + Bn["[object Set]"] =
    + Bn["[object String]"] =
    + Bn["[object WeakMap]"] =
    + false)
    + var Ln = {}
    + ;(Ln["[object Arguments]"] =
    + Ln["[object Array]"] =
    + Ln["[object ArrayBuffer]"] =
    + Ln["[object DataView]"] =
    + Ln["[object Boolean]"] =
    + Ln["[object Date]"] =
    + Ln["[object Float32Array]"] =
    + Ln["[object Float64Array]"] =
    + Ln["[object Int8Array]"] =
    + Ln["[object Int16Array]"] =
    + Ln["[object Int32Array]"] =
    + Ln["[object Map]"] =
    + Ln["[object Number]"] =
    + Ln["[object Object]"] =
    + Ln["[object RegExp]"] =
    + Ln["[object Set]"] =
    + Ln["[object String]"] =
    + Ln["[object Symbol]"] =
    + Ln["[object Uint8Array]"] =
    + Ln["[object Uint8ClampedArray]"] =
    + Ln["[object Uint16Array]"] =
    + Ln["[object Uint32Array]"] =
    + true),
    + (Ln["[object Error]"] = Ln["[object Function]"] = Ln["[object WeakMap]"] = false)
    + var Un = { "\\": "\\", "'": "'", "\n": "n", "\r": "r", "\u2028": "u2028", "\u2029": "u2029" },
    + Cn = parseFloat,
    + Dn = parseInt,
    + Mn = typeof global == "object" && global && global.Object === Object && global,
    + Tn = typeof self == "object" && self && self.Object === Object && self,
    + $n = Mn || Tn || Function("return this")(),
    + Fn = typeof exports == "object" && exports && !exports.nodeType && exports,
    + Nn = Fn && typeof module == "object" && module && !module.nodeType && module,
    + Pn = Nn && Nn.exports === Fn,
    + Zn = Pn && Mn.process,
    + qn = (function () {
    + try {
    + var n = Nn && Nn.f && Nn.f("util").types
    + return n ? n : Zn && Zn.binding && Zn.binding("util")
    + } catch (n) {}
    + })(),
    + Vn = qn && qn.isArrayBuffer,
    + Kn = qn && qn.isDate,
    + Gn = qn && qn.isMap,
    + Hn = qn && qn.isRegExp,
    + Jn = qn && qn.isSet,
    + Yn = qn && qn.isTypedArray,
    + Qn = b("length"),
    + Xn = x({
    + "\xc0": "A",
    + "\xc1": "A",
    + "\xc2": "A",
    + "\xc3": "A",
    + "\xc4": "A",
    + "\xc5": "A",
    + "\xe0": "a",
    + "\xe1": "a",
    + "\xe2": "a",
    + "\xe3": "a",
    + "\xe4": "a",
    + "\xe5": "a",
    + "\xc7": "C",
    + "\xe7": "c",
    + "\xd0": "D",
    + "\xf0": "d",
    + "\xc8": "E",
    + "\xc9": "E",
    + "\xca": "E",
    + "\xcb": "E",
    + "\xe8": "e",
    + "\xe9": "e",
    + "\xea": "e",
    + "\xeb": "e",
    + "\xcc": "I",
    + "\xcd": "I",
    + "\xce": "I",
    + "\xcf": "I",
    + "\xec": "i",
    + "\xed": "i",
    + "\xee": "i",
    + "\xef": "i",
    + "\xd1": "N",
    + "\xf1": "n",
    + "\xd2": "O",
    + "\xd3": "O",
    + "\xd4": "O",
    + "\xd5": "O",
    + "\xd6": "O",
    + "\xd8": "O",
    + "\xf2": "o",
    + "\xf3": "o",
    + "\xf4": "o",
    + "\xf5": "o",
    + "\xf6": "o",
    + "\xf8": "o",
    + "\xd9": "U",
    + "\xda": "U",
    + "\xdb": "U",
    + "\xdc": "U",
    + "\xf9": "u",
    + "\xfa": "u",
    + "\xfb": "u",
    + "\xfc": "u",
    + "\xdd": "Y",
    + "\xfd": "y",
    + "\xff": "y",
    + "\xc6": "Ae",
    + "\xe6": "ae",
    + "\xde": "Th",
    + "\xfe": "th",
    + "\xdf": "ss",
    + "\u0100": "A",
    + "\u0102": "A",
    + "\u0104": "A",
    + "\u0101": "a",
    + "\u0103": "a",
    + "\u0105": "a",
    + "\u0106": "C",
    + "\u0108": "C",
    + "\u010a": "C",
    + "\u010c": "C",
    + "\u0107": "c",
    + "\u0109": "c",
    + "\u010b": "c",
    + "\u010d": "c",
    + "\u010e": "D",
    + "\u0110": "D",
    + "\u010f": "d",
    + "\u0111": "d",
    + "\u0112": "E",
    + "\u0114": "E",
    + "\u0116": "E",
    + "\u0118": "E",
    + "\u011a": "E",
    + "\u0113": "e",
    + "\u0115": "e",
    + "\u0117": "e",
    + "\u0119": "e",
    + "\u011b": "e",
    + "\u011c": "G",
    + "\u011e": "G",
    + "\u0120": "G",
    + "\u0122": "G",
    + "\u011d": "g",
    + "\u011f": "g",
    + "\u0121": "g",
    + "\u0123": "g",
    + "\u0124": "H",
    + "\u0126": "H",
    + "\u0125": "h",
    + "\u0127": "h",
    + "\u0128": "I",
    + "\u012a": "I",
    + "\u012c": "I",
    + "\u012e": "I",
    + "\u0130": "I",
    + "\u0129": "i",
    + "\u012b": "i",
    + "\u012d": "i",
    + "\u012f": "i",
    + "\u0131": "i",
    + "\u0134": "J",
    + "\u0135": "j",
    + "\u0136": "K",
    + "\u0137": "k",
    + "\u0138": "k",
    + "\u0139": "L",
    + "\u013b": "L",
    + "\u013d": "L",
    + "\u013f": "L",
    + "\u0141": "L",
    + "\u013a": "l",
    + "\u013c": "l",
    + "\u013e": "l",
    + "\u0140": "l",
    + "\u0142": "l",
    + "\u0143": "N",
    + "\u0145": "N",
    + "\u0147": "N",
    + "\u014a": "N",
    + "\u0144": "n",
    + "\u0146": "n",
    + "\u0148": "n",
    + "\u014b": "n",
    + "\u014c": "O",
    + "\u014e": "O",
    + "\u0150": "O",
    + "\u014d": "o",
    + "\u014f": "o",
    + "\u0151": "o",
    + "\u0154": "R",
    + "\u0156": "R",
    + "\u0158": "R",
    + "\u0155": "r",
    + "\u0157": "r",
    + "\u0159": "r",
    + "\u015a": "S",
    + "\u015c": "S",
    + "\u015e": "S",
    + "\u0160": "S",
    + "\u015b": "s",
    + "\u015d": "s",
    + "\u015f": "s",
    + "\u0161": "s",
    + "\u0162": "T",
    + "\u0164": "T",
    + "\u0166": "T",
    + "\u0163": "t",
    + "\u0165": "t",
    + "\u0167": "t",
    + "\u0168": "U",
    + "\u016a": "U",
    + "\u016c": "U",
    + "\u016e": "U",
    + "\u0170": "U",
    + "\u0172": "U",
    + "\u0169": "u",
    + "\u016b": "u",
    + "\u016d": "u",
    + "\u016f": "u",
    + "\u0171": "u",
    + "\u0173": "u",
    + "\u0174": "W",
    + "\u0175": "w",
    + "\u0176": "Y",
    + "\u0177": "y",
    + "\u0178": "Y",
    + "\u0179": "Z",
    + "\u017b": "Z",
    + "\u017d": "Z",
    + "\u017a": "z",
    + "\u017c": "z",
    + "\u017e": "z",
    + "\u0132": "IJ",
    + "\u0133": "ij",
    + "\u0152": "Oe",
    + "\u0153": "oe",
    + "\u0149": "'n",
    + "\u017f": "s",
    + }),
    + nt = x({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }),
    + tt = x({ "&": "&", "<": "<", ">": ">", """: '"', "'": "'" }),
    + rt = (function x(mn) {
    + function An(n) {
    + if (yu(n) && !ff(n) && !(n instanceof Un)) {
    + if (n instanceof On) return n
    + if (oi.call(n, "__wrapped__")) return Fe(n)
    + }
    + return new On(n)
    + }
    + function En() {}
    + function On(n, t) {
    + ;(this.__wrapped__ = n), (this.__actions__ = []), (this.__chain__ = !!t), (this.__index__ = 0), (this.__values__ = T)
    + }
    + function Un(n) {
    + ;(this.__wrapped__ = n),
    + (this.__actions__ = []),
    + (this.__dir__ = 1),
    + (this.__filtered__ = false),
    + (this.__iteratees__ = []),
    + (this.__takeCount__ = 4294967295),
    + (this.__views__ = [])
    + }
    + function Mn(n) {
    + var t = -1,
    + r = null == n ? 0 : n.length
    + for (this.clear(); ++t < r; ) {
    + var e = n[t]
    + this.set(e[0], e[1])
    + }
    + }
    + function Tn(n) {
    + var t = -1,
    + r = null == n ? 0 : n.length
    + for (this.clear(); ++t < r; ) {
    + var e = n[t]
    + this.set(e[0], e[1])
    + }
    + }
    + function Fn(n) {
    + var t = -1,
    + r = null == n ? 0 : n.length
    + for (this.clear(); ++t < r; ) {
    + var e = n[t]
    + this.set(e[0], e[1])
    + }
    + }
    + function Nn(n) {
    + var t = -1,
    + r = null == n ? 0 : n.length
    + for (this.__data__ = new Fn(); ++t < r; ) this.add(n[t])
    + }
    + function Zn(n) {
    + this.size = (this.__data__ = new Tn(n)).size
    + }
    + function qn(n, t) {
    + var r,
    + e = ff(n),
    + u = !e && of(n),
    + i = !e && !u && af(n),
    + o = !e && !u && !i && _f(n),
    + u = (e = e || u || i || o) ? A(n.length, ni) : [],
    + f = u.length
    + for (r in n)
    + (!t && !oi.call(n, r)) ||
    + (e && ("length" == r || (i && ("offset" == r || "parent" == r)) || (o && ("buffer" == r || "byteLength" == r || "byteOffset" == r)) || Se(r, f))) ||
    + u.push(r)
    + return u
    + }
    + function Qn(n) {
    + var t = n.length
    + return t ? n[ir(0, t - 1)] : T
    + }
    + function et(n, t) {
    + return De(Ur(n), pt(t, 0, n.length))
    + }
    + function ut(n) {
    + return De(Ur(n))
    + }
    + function it(n, t, r) {
    + ;((r === T || lu(n[t], r)) && (r !== T || t in n)) || st(n, t, r)
    + }
    + function ot(n, t, r) {
    + var e = n[t]
    + ;(oi.call(n, t) && lu(e, r) && (r !== T || t in n)) || st(n, t, r)
    + }
    + function ft(n, t) {
    + for (var r = n.length; r--; ) if (lu(n[r][0], t)) return r
    + return -1
    + }
    + function ct(n, t, r, e) {
    + return (
    + uo(n, function (n, u, i) {
    + t(e, n, r(n), i)
    + }),
    + e
    + )
    + }
    + function at(n, t) {
    + return n && Cr(t, Wu(t), n)
    + }
    + function lt(n, t) {
    + return n && Cr(t, Bu(t), n)
    + }
    + function st(n, t, r) {
    + "__proto__" == t && Ai ? Ai(n, t, { configurable: true, enumerable: true, value: r, writable: true }) : (n[t] = r)
    + }
    + function ht(n, t) {
    + for (var r = -1, e = t.length, u = Ku(e), i = null == n; ++r < e; ) u[r] = i ? T : Ru(n, t[r])
    + return u
    + }
    + function pt(n, t, r) {
    + return n === n && (r !== T && (n = n <= r ? n : r), t !== T && (n = n >= t ? n : t)), n
    + }
    + function _t(n, t, e, u, i, o) {
    + var f,
    + c = 1 & t,
    + a = 2 & t,
    + l = 4 & t
    + if ((e && (f = i ? e(n, u, i, o) : e(n)), f !== T)) return f
    + if (!du(n)) return n
    + if ((u = ff(n))) {
    + if (((f = me(n)), !c)) return Ur(n, f)
    + } else {
    + var s = vo(n),
    + h = "[object Function]" == s || "[object GeneratorFunction]" == s
    + if (af(n)) return Ir(n, c)
    + if ("[object Object]" == s || "[object Arguments]" == s || (h && !i)) {
    + if (((f = a || h ? {} : Ae(n)), !c)) return a ? Mr(n, lt(f, n)) : Dr(n, at(f, n))
    + } else {
    + if (!Ln[s]) return i ? n : {}
    + f = Ee(n, s, c)
    + }
    + }
    + if ((o || (o = new Zn()), (i = o.get(n)))) return i
    + o.set(n, f),
    + pf(n)
    + ? n.forEach(function (r) {
    + f.add(_t(r, t, e, r, n, o))
    + })
    + : sf(n) &&
    + n.forEach(function (r, u) {
    + f.set(u, _t(r, t, e, u, n, o))
    + })
    + var a = l ? (a ? ve : _e) : a ? Bu : Wu,
    + p = u ? T : a(n)
    + return (
    + r(p || n, function (r, u) {
    + p && ((u = r), (r = n[u])), ot(f, u, _t(r, t, e, u, n, o))
    + }),
    + f
    + )
    + }
    + function vt(n) {
    + var t = Wu(n)
    + return function (r) {
    + return gt(r, n, t)
    + }
    + }
    + function gt(n, t, r) {
    + var e = r.length
    + if (null == n) return !e
    + for (n = Qu(n); e--; ) {
    + var u = r[e],
    + i = t[u],
    + o = n[u]
    + if ((o === T && !(u in n)) || !i(o)) return false
    + }
    + return true
    + }
    + function dt(n, t, r) {
    + if (typeof n != "function") throw new ti("Expected a function")
    + return bo(function () {
    + n.apply(T, r)
    + }, t)
    + }
    + function yt(n, t, r, e) {
    + var u = -1,
    + i = o,
    + a = true,
    + l = n.length,
    + s = [],
    + h = t.length
    + if (!l) return s
    + r && (t = c(t, k(r))), e ? ((i = f), (a = false)) : 200 <= t.length && ((i = O), (a = false), (t = new Nn(t)))
    + n: for (; ++u < l; ) {
    + var p = n[u],
    + _ = null == r ? p : r(p),
    + p = e || 0 !== p ? p : 0
    + if (a && _ === _) {
    + for (var v = h; v--; ) if (t[v] === _) continue n
    + s.push(p)
    + } else i(t, _, e) || s.push(p)
    + }
    + return s
    + }
    + function bt(n, t) {
    + var r = true
    + return (
    + uo(n, function (n, e, u) {
    + return (r = !!t(n, e, u))
    + }),
    + r
    + )
    + }
    + function xt(n, t, r) {
    + for (var e = -1, u = n.length; ++e < u; ) {
    + var i = n[e],
    + o = t(i)
    + if (null != o && (f === T ? o === o && !wu(o) : r(o, f)))
    + var f = o,
    + c = i
    + }
    + return c
    + }
    + function jt(n, t) {
    + var r = []
    + return (
    + uo(n, function (n, e, u) {
    + t(n, e, u) && r.push(n)
    + }),
    + r
    + )
    + }
    + function wt(n, t, r, e, u) {
    + var i = -1,
    + o = n.length
    + for (r || (r = ke), u || (u = []); ++i < o; ) {
    + var f = n[i]
    + 0 < t && r(f) ? (1 < t ? wt(f, t - 1, r, e, u) : a(u, f)) : e || (u[u.length] = f)
    + }
    + return u
    + }
    + function mt(n, t) {
    + return n && oo(n, t, Wu)
    + }
    + function At(n, t) {
    + return n && fo(n, t, Wu)
    + }
    + function Et(n, t) {
    + return i(t, function (t) {
    + return _u(n[t])
    + })
    + }
    + function kt(n, t) {
    + t = Sr(t, n)
    + for (var r = 0, e = t.length; null != n && r < e; ) n = n[Me(t[r++])]
    + return r && r == e ? n : T
    + }
    + function St(n, t, r) {
    + return (t = t(n)), ff(n) ? t : a(t, r(n))
    + }
    + function Ot(n) {
    + if (null == n) n = n === T ? "[object Undefined]" : "[object Null]"
    + else if (mi && mi in Qu(n)) {
    + var t = oi.call(n, mi),
    + r = ni]
    + try {
    + ni] = T
    + var e = true
    + } catch (n) {}
    + var u = ai.call(n)
    + e && (t ? (ni] = r) : delete ni]), (n = u)
    + } else n = ai.call(n)
    + return n
    + }
    + function It(n, t) {
    + return n > t
    + }
    + function Rt(n, t) {
    + return null != n && oi.call(n, t)
    + }
    + function zt(n, t) {
    + return null != n && t in Qu(n)
    + }
    + function Wt(n, t, r) {
    + for (var e = r ? f : o, u = n[0].length, i = n.length, a = i, l = Ku(i), s = 1 / 0, h = []; a--; ) {
    + var p = n[a]
    + a && t && (p = c(p, k(t))), (s = Ci(p.length, s)), (l[a] = !r && (t || (120 <= u && 120 <= p.length)) ? new Nn(a && p) : T)
    + }
    + var p = n[0],
    + _ = -1,
    + v = l[0]
    + n: for (; ++_ < u && h.length < s; ) {
    + var g = p[_],
    + d = t ? t(g) : g,
    + g = r || 0 !== g ? g : 0
    + if (v ? !O(v, d) : !e(h, d, r)) {
    + for (a = i; --a; ) {
    + var y = l[a]
    + if (y ? !O(y, d) : !e(n[a], d, r)) continue n
    + }
    + v && v.push(d), h.push(g)
    + }
    + }
    + return h
    + }
    + function Bt(n, t, r) {
    + var e = {}
    + return (
    + mt(n, function (n, u, i) {
    + t(e, r(n), u, i)
    + }),
    + e
    + )
    + }
    + function Lt(t, r, e) {
    + return (r = Sr(r, t)), (t = 2 > r.length ? t : kt(t, hr(r, 0, -1))), (r = null == t ? t : t[Me(Ve(r))]), null == r ? T : n(r, t, e)
    + }
    + function Ut(n) {
    + return yu(n) && "[object Arguments]" == Ot(n)
    + }
    + function Ct(n) {
    + return yu(n) && "[object ArrayBuffer]" == Ot(n)
    + }
    + function Dt(n) {
    + return yu(n) && "[object Date]" == Ot(n)
    + }
    + function Mt(n, t, r, e, u) {
    + if (n === t) t = true
    + else if (null == n || null == t || (!yu(n) && !yu(t))) t = n !== n && t !== t
    + else
    + n: {
    + var i = ff(n),
    + o = ff(t),
    + f = i ? "[object Array]" : vo(n),
    + c = o ? "[object Array]" : vo(t),
    + f = "[object Arguments]" == f ? "[object Object]" : f,
    + c = "[object Arguments]" == c ? "[object Object]" : c,
    + a = "[object Object]" == f,
    + o = "[object Object]" == c
    + if ((c = f == c) && af(n)) {
    + if (!af(t)) {
    + t = false
    + break n
    + }
    + ;(i = true), (a = false)
    + }
    + if (c && !a) u || (u = new Zn()), (t = i || _f(n) ? se(n, t, r, e, Mt, u) : he(n, t, f, r, e, Mt, u))
    + else {
    + if (!(1 & r) && ((i = a && oi.call(n, "__wrapped__")), (f = o && oi.call(t, "__wrapped__")), i || f)) {
    + ;(n = i ? n.value() : n), (t = f ? t.value() : t), u || (u = new Zn()), (t = Mt(n, t, r, e, u))
    + break n
    + }
    + if (c)
    + t: if ((u || (u = new Zn()), (i = 1 & r), (f = _e(n)), (o = f.length), (c = _e(t).length), o == c || i)) {
    + for (a = o; a--; ) {
    + var l = f[a]
    + if (!(i ? l in t : oi.call(t, l))) {
    + t = false
    + break t
    + }
    + }
    + if ((c = u.get(n)) && u.get(t)) t = c == t
    + else {
    + ;(c = true), u.set(n, t), u.set(t, n)
    + for (var s = i; ++a < o; ) {
    + var l = f[a],
    + h = n[l],
    + p = t[l]
    + if (e) var _ = i ? e(p, h, l, t, n, u) : e(h, p, l, n, t, u)
    + if (_ === T ? h !== p && !Mt(h, p, r, e, u) : !_) {
    + c = false
    + break
    + }
    + s || (s = "constructor" == l)
    + }
    + c &&
    + !s &&
    + ((r = n.constructor),
    + (e = t.constructor),
    + r != e && "constructor" in n && "constructor" in t && !(typeof r == "function" && r instanceof r && typeof e == "function" && e instanceof e) && (c = false)),
    + u.delete(n),
    + u.delete(t),
    + (t = c)
    + }
    + } else t = false
    + else t = false
    + }
    + }
    + return t
    + }
    + function Tt(n) {
    + return yu(n) && "[object Map]" == vo(n)
    + }
    + function $t(n, t, r, e) {
    + var u = r.length,
    + i = u,
    + o = !e
    + if (null == n) return !i
    + for (n = Qu(n); u--; ) {
    + var f = r[u]
    + if (o && f[2] ? f[1] !== n[f[0]] : !(f[0] in n)) return false
    + }
    + for (; ++u < i; ) {
    + var f = r[u],
    + c = f[0],
    + a = n[c],
    + l = f[1]
    + if (o && f[2]) {
    + if (a === T && !(c in n)) return false
    + } else {
    + if (((f = new Zn()), e)) var s = e(a, l, c, n, t, f)
    + if (s === T ? !Mt(l, a, 3, e, f) : !s) return false
    + }
    + }
    + return true
    + }
    + function Ft(n) {
    + return !(!du(n) || (ci && ci in n)) && (_u(n) ? hi : dn).test(Te(n))
    + }
    + function Nt(n) {
    + return yu(n) && "[object RegExp]" == Ot(n)
    + }
    + function Pt(n) {
    + return yu(n) && "[object Set]" == vo(n)
    + }
    + function Zt(n) {
    + return yu(n) && gu(n.length) && !!Bn[Ot(n)]
    + }
    + function qt(n) {
    + return typeof n == "function" ? n : null == n ? $u : typeof n == "object" ? (ff(n) ? Jt(n[0], n[1]) : Ht(n)) : Zu(n)
    + }
    + function Vt(n) {
    + if (!ze(n)) return Li(n)
    + var t,
    + r = []
    + for (t in Qu(n)) oi.call(n, t) && "constructor" != t && r.push(t)
    + return r
    + }
    + function Kt(n, t) {
    + return n < t
    + }
    + function Gt(n, t) {
    + var r = -1,
    + e = su(n) ? Ku(n.length) : []
    + return (
    + uo(n, function (n, u, i) {
    + e[++r] = t(n, u, i)
    + }),
    + e
    + )
    + }
    + function Ht(n) {
    + var t = xe(n)
    + return 1 == t.length && t[0][2]
    + ? We(t[0][0], t[0][1])
    + : function (r) {
    + return r === n || $t(r, n, t)
    + }
    + }
    + function Jt(n, t) {
    + return Ie(n) && t === t && !du(t)
    + ? We(Me(n), t)
    + : function (r) {
    + var e = Ru(r, n)
    + return e === T && e === t ? zu(r, n) : Mt(t, e, 3)
    + }
    + }
    + function Yt(n, t, r, e, u) {
    + n !== t &&
    + oo(
    + t,
    + function (i, o) {
    + if ((u || (u = new Zn()), du(i))) {
    + var f = u,
    + c = Le(n, o),
    + a = Le(t, o),
    + l = f.get(a)
    + if (l) it(n, o, l)
    + else {
    + var l = e ? e(c, a, o + "", n, t, f) : T,
    + s = l === T
    + if (s) {
    + var h = ff(a),
    + p = !h && af(a),
    + _ = !h && !p && _f(a),
    + l = a
    + h || p || _
    + ? ff(c)
    + ? (l = c)
    + : hu(c)
    + ? (l = Ur(c))
    + : p
    + ? ((s = false), (l = Ir(a, true)))
    + : _
    + ? ((s = false), (l = zr(a, true)))
    + : (l = [])
    + : xu(a) || of(a)
    + ? ((l = c), of(c) ? (l = Ou(c)) : (du(c) && !_u(c)) || (l = Ae(a)))
    + : (s = false)
    + }
    + s && (f.set(a, l), Yt(l, a, r, e, f), f.delete(a)), it(n, o, l)
    + }
    + } else (f = e ? e(Le(n, o), i, o + "", n, t, u) : T), f === T && (f = i), it(n, o, f)
    + },
    + Bu
    + )
    + }
    + function Qt(n, t) {
    + var r = n.length
    + if (r) return (t += 0 > t ? r : 0), Se(t, r) ? n[t] : T
    + }
    + function Xt(n, t, r) {
    + var e = -1
    + return (
    + (t = c(t.length ? t : [$u], k(ye()))),
    + (n = Gt(n, function (n) {
    + return {
    + a: c(t, function (t) {
    + return t(n)
    + }),
    + b: ++e,
    + c: n,
    + }
    + })),
    + w(n, function (n, t) {
    + var e
    + n: {
    + e = -1
    + for (var u = n.a, i = t.a, o = u.length, f = r.length; ++e < o; ) {
    + var c = Wr(u[e], i[e])
    + if (c) {
    + e = e >= f ? c : c * ("desc" == r[e] ? -1 : 1)
    + break n
    + }
    + }
    + e = n.b - t.b
    + }
    + return e
    + })
    + )
    + }
    + function nr(n, t) {
    + return tr(n, t, function (t, r) {
    + return zu(n, r)
    + })
    + }
    + function tr(n, t, r) {
    + for (var e = -1, u = t.length, i = {}; ++e < u; ) {
    + var o = t[e],
    + f = kt(n, o)
    + r(f, o) && lr(i, Sr(o, n), f)
    + }
    + return i
    + }
    + function rr(n) {
    + return function (t) {
    + return kt(t, n)
    + }
    + }
    + function er(n, t, r, e) {
    + var u = e ? g : v,
    + i = -1,
    + o = t.length,
    + f = n
    + for (n === t && (t = Ur(t)), r && (f = c(n, k(r))); ++i < o; )
    + for (var a = 0, l = t[i], l = r ? r(l) : l; -1 < (a = u(f, l, a, e)); ) f !== n && xi.call(f, a, 1), xi.call(n, a, 1)
    + return n
    + }
    + function ur(n, t) {
    + for (var r = n ? t.length : 0, e = r - 1; r--; ) {
    + var u = t[r]
    + if (r == e || u !== i) {
    + var i = u
    + Se(u) ? xi.call(n, u, 1) : xr(n, u)
    + }
    + }
    + }
    + function ir(n, t) {
    + return n + Ii(Ti() * (t - n + 1))
    + }
    + function or(n, t) {
    + var r = ""
    + if (!n || 1 > t || 9007199254740991 < t) return r
    + do t % 2 && (r += n), (t = Ii(t / 2)) && (n += n)
    + while (t)
    + return r
    + }
    + function fr(n, t) {
    + return xo(Be(n, t, $u), n + "")
    + }
    + function cr(n) {
    + return Qn(Uu(n))
    + }
    + function ar(n, t) {
    + var r = Uu(n)
    + return De(r, pt(t, 0, r.length))
    + }
    + function lr(n, t, r, e) {
    + if (!du(n)) return n
    + t = Sr(t, n)
    + for (var u = -1, i = t.length, o = i - 1, f = n; null != f && ++u < i; ) {
    + var c = Me(t[u]),
    + a = r
    + if (u != o) {
    + var l = f[c],
    + a = e ? e(l, c, f) : T
    + a === T && (a = du(l) ? l : Se(t[u + 1]) ? [] : {})
    + }
    + ot(f, c, a), (f = f[c])
    + }
    + return n
    + }
    + function sr(n) {
    + return De(Uu(n))
    + }
    + function hr(n, t, r) {
    + var e = -1,
    + u = n.length
    + for (0 > t && (t = -t > u ? 0 : u + t), r = r > u ? u : r, 0 > r && (r += u), u = t > r ? 0 : (r - t) >>> 0, t >>>= 0, r = Ku(u); ++e < u; ) r[e] = n[e + t]
    + return r
    + }
    + function pr(n, t) {
    + var r
    + return (
    + uo(n, function (n, e, u) {
    + return (r = t(n, e, u)), !r
    + }),
    + !!r
    + )
    + }
    + function _r(n, t, r) {
    + var e = 0,
    + u = null == n ? e : n.length
    + if (typeof t == "number" && t === t && 2147483647 >= u) {
    + for (; e < u; ) {
    + var i = (e + u) >>> 1,
    + o = n[i]
    + null !== o && !wu(o) && (r ? o <= t : o < t) ? (e = i + 1) : (u = i)
    + }
    + return u
    + }
    + return vr(n, t, $u, r)
    + }
    + function vr(n, t, r, e) {
    + t = r(t)
    + for (var u = 0, i = null == n ? 0 : n.length, o = t !== t, f = null === t, c = wu(t), a = t === T; u < i; ) {
    + var l = Ii((u + i) / 2),
    + s = r(n[l]),
    + h = s !== T,
    + p = null === s,
    + _ = s === s,
    + v = wu(s)
    + ;(o ? e || _ : a ? _ && (e || h) : f ? _ && h && (e || !p) : c ? _ && h && !p && (e || !v) : p || v ? 0 : e ? s <= t : s < t) ? (u = l + 1) : (i = l)
    + }
    + return Ci(i, 4294967294)
    + }
    + function gr(n, t) {
    + for (var r = -1, e = n.length, u = 0, i = []; ++r < e; ) {
    + var o = n[r],
    + f = t ? t(o) : o
    + if (!r || !lu(f, c)) {
    + var c = f
    + i[u++] = 0 === o ? 0 : o
    + }
    + }
    + return i
    + }
    + function dr(n) {
    + return typeof n == "number" ? n : wu(n) ? F : +n
    + }
    + function yr(n) {
    + if (typeof n == "string") return n
    + if (ff(n)) return c(n, yr) + ""
    + if (wu(n)) return ro ? ro.call(n) : ""
    + var t = n + ""
    + return "0" == t && 1 / n == -$ ? "-0" : t
    + }
    + function br(n, t, r) {
    + var e = -1,
    + u = o,
    + i = n.length,
    + c = true,
    + a = [],
    + l = a
    + if (r) (c = false), (u = f)
    + else if (200 <= i) {
    + if ((u = t ? null : so(n))) return U(u)
    + ;(c = false), (u = O), (l = new Nn())
    + } else l = t ? [] : a
    + n: for (; ++e < i; ) {
    + var s = n[e],
    + h = t ? t(s) : s,
    + s = r || 0 !== s ? s : 0
    + if (c && h === h) {
    + for (var p = l.length; p--; ) if (l[p] === h) continue n
    + t && l.push(h), a.push(s)
    + } else u(l, h, r) || (l !== a && l.push(h), a.push(s))
    + }
    + return a
    + }
    + function xr(n, t) {
    + return (t = Sr(t, n)), (n = 2 > t.length ? n : kt(n, hr(t, 0, -1))), null == n || delete n[Me(Ve(t))]
    + }
    + function jr(n, t, r, e) {
    + for (var u = n.length, i = e ? u : -1; (e ? i-- : ++i < u) && t(n[i], i, n); );
    + return r ? hr(n, e ? 0 : i, e ? i + 1 : u) : hr(n, e ? i + 1 : 0, e ? u : i)
    + }
    + function wr(n, t) {
    + var r = n
    + return (
    + r instanceof Un && (r = r.value()),
    + l(
    + t,
    + function (n, t) {
    + return t.func.apply(t.thisArg, a([n], t.args))
    + },
    + r
    + )
    + )
    + }
    + function mr(n, t, r) {
    + var e = n.length
    + if (2 > e) return e ? br(n[0]) : []
    + for (var u = -1, i = Ku(e); ++u < e; ) for (var o = n[u], f = -1; ++f < e; ) f != u && (i[u] = yt(i[u] || o, n[f], t, r))
    + return br(wt(i, 1), t, r)
    + }
    + function Ar(n, t, r) {
    + for (var e = -1, u = n.length, i = t.length, o = {}; ++e < u; ) r(o, n[e], e < i ? t[e] : T)
    + return o
    + }
    + function Er(n) {
    + return hu(n) ? n : []
    + }
    + function kr(n) {
    + return typeof n == "function" ? n : $u
    + }
    + function Sr(n, t) {
    + return ff(n) ? n : Ie(n, t) ? [n] : jo(Iu(n))
    + }
    + function Or(n, t, r) {
    + var e = n.length
    + return (r = r === T ? e : r), !t && r >= e ? n : hr(n, t, r)
    + }
    + function Ir(n, t) {
    + if (t) return n.slice()
    + var r = n.length,
    + r = gi ? gi(r) : new n.constructor(r)
    + return n.copy(r), r
    + }
    + function Rr(n) {
    + var t = new n.constructor(n.byteLength)
    + return new vi(t).set(new vi(n)), t
    + }
    + function zr(n, t) {
    + return new n.constructor(t ? Rr(n.buffer) : n.buffer, n.byteOffset, n.length)
    + }
    + function Wr(n, t) {
    + if (n !== t) {
    + var r = n !== T,
    + e = null === n,
    + u = n === n,
    + i = wu(n),
    + o = t !== T,
    + f = null === t,
    + c = t === t,
    + a = wu(t)
    + if ((!f && !a && !i && n > t) || (i && o && c && !f && !a) || (e && o && c) || (!r && c) || !u) return 1
    + if ((!e && !i && !a && n < t) || (a && r && u && !e && !i) || (f && r && u) || (!o && u) || !c) return -1
    + }
    + return 0
    + }
    + function Br(n, t, r, e) {
    + var u = -1,
    + i = n.length,
    + o = r.length,
    + f = -1,
    + c = t.length,
    + a = Ui(i - o, 0),
    + l = Ku(c + a)
    + for (e = !e; ++f < c; ) l[f] = t[f]
    + for (; ++u < o; ) (e || u < i) && (l[r[u]] = n[u])
    + for (; a--; ) l[f++] = n[u++]
    + return l
    + }
    + function Lr(n, t, r, e) {
    + var u = -1,
    + i = n.length,
    + o = -1,
    + f = r.length,
    + c = -1,
    + a = t.length,
    + l = Ui(i - f, 0),
    + s = Ku(l + a)
    + for (e = !e; ++u < l; ) s[u] = n[u]
    + for (l = u; ++c < a; ) s[l + c] = t[c]
    + for (; ++o < f; ) (e || u < i) && (s[l + r[o]] = n[u++])
    + return s
    + }
    + function Ur(n, t) {
    + var r = -1,
    + e = n.length
    + for (t || (t = Ku(e)); ++r < e; ) t[r] = n[r]
    + return t
    + }
    + function Cr(n, t, r, e) {
    + var u = !r
    + r || (r = {})
    + for (var i = -1, o = t.length; ++i < o; ) {
    + var f = t[i],
    + c = e ? e(r[f], n[f], f, r, n) : T
    + c === T && (c = n[f]), u ? st(r, f, c) : ot(r, f, c)
    + }
    + return r
    + }
    + function Dr(n, t) {
    + return Cr(n, po(n), t)
    + }
    + function Mr(n, t) {
    + return Cr(n, _o(n), t)
    + }
    + function Tr(n, r) {
    + return function (e, u) {
    + var i = ff(e) ? t : ct,
    + o = r ? r() : {}
    + return i(e, n, ye(u, 2), o)
    + }
    + }
    + function $r(n) {
    + return fr(function (t, r) {
    + var e = -1,
    + u = r.length,
    + i = 1 < u ? r[u - 1] : T,
    + o = 2 < u ? r[2] : T,
    + i = 3 < n.length && typeof i == "function" ? (u--, i) : T
    + for (o && Oe(r[0], r[1], o) && ((i = 3 > u ? T : i), (u = 1)), t = Qu(t); ++e < u; ) (o = r[e]) && n(t, o, e, i)
    + return t
    + })
    + }
    + function Fr(n, t) {
    + return function (r, e) {
    + if (null == r) return r
    + if (!su(r)) return n(r, e)
    + for (var u = r.length, i = t ? u : -1, o = Qu(r); (t ? i-- : ++i < u) && false !== e(o[i], i, o); );
    + return r
    + }
    + }
    + function Nr(n) {
    + return function (t, r, e) {
    + var u = -1,
    + i = Qu(t)
    + e = e(t)
    + for (var o = e.length; o--; ) {
    + var f = e[n ? o : ++u]
    + if (false === r(i[f], f, i)) break
    + }
    + return t
    + }
    + }
    + function Pr(n, t, r) {
    + function e() {
    + return (this && this !== $n && this instanceof e ? i : n).apply(u ? r : this, arguments)
    + }
    + var u = 1 & t,
    + i = Vr(n)
    + return e
    + }
    + function Zr(n) {
    + return function (t) {
    + t = Iu(t)
    + var r = Rn.test(t) ? M(t) : T,
    + e = r ? r[0] : t.charAt(0)
    + return (t = r ? Or(r, 1).join("") : t.slice(1)), e[n]() + t
    + }
    + }
    + function qr(n) {
    + return function (t) {
    + return l(Mu(Du(t).replace(kn, "")), n, "")
    + }
    + }
    + function Vr(n) {
    + return function () {
    + var t = arguments
    + switch (t.length) {
    + case 0:
    + return new n()
    + case 1:
    + return new n(t[0])
    + case 2:
    + return new n(t[0], t[1])
    + case 3:
    + return new n(t[0], t[1], t[2])
    + case 4:
    + return new n(t[0], t[1], t[2], t[3])
    + case 5:
    + return new n(t[0], t[1], t[2], t[3], t[4])
    + case 6:
    + return new n(t[0], t[1], t[2], t[3], t[4], t[5])
    + case 7:
    + return new n(t[0], t[1], t[2], t[3], t[4], t[5], t[6])
    + }
    + var r = eo(n.prototype),
    + t = n.apply(r, t)
    + return du(t) ? t : r
    + }
    + }
    + function Kr(t, r, e) {
    + function u() {
    + for (var o = arguments.length, f = Ku(o), c = o, a = de(u); c--; ) f[c] = arguments[c]
    + return (
    + (c = 3 > o && f[0] !== a && f[o - 1] !== a ? [] : L(f, a)),
    + (o -= c.length),
    + o < e ? ue(t, r, Jr, u.placeholder, T, f, c, T, T, e - o) : n(this && this !== $n && this instanceof u ? i : t, this, f)
    + )
    + }
    + var i = Vr(t)
    + return u
    + }
    + function Gr(n) {
    + return function (t, r, e) {
    + var u = Qu(t)
    + if (!su(t)) {
    + var i = ye(r, 3)
    + ;(t = Wu(t)),
    + (r = function (n) {
    + return i(u[n], n, u)
    + })
    + }
    + return (r = n(t, r, e)), -1 < r ? u[i ? t[r] : r] : T
    + }
    + }
    + function Hr(n) {
    + return pe(function (t) {
    + var r = t.length,
    + e = r,
    + u = On.prototype.thru
    + for (n && t.reverse(); e--; ) {
    + var i = t[e]
    + if (typeof i != "function") throw new ti("Expected a function")
    + if (u && !o && "wrapper" == ge(i)) var o = new On([], true)
    + }
    + for (e = o ? e : r; ++e < r; )
    + var i = t[e],
    + u = ge(i),
    + f = "wrapper" == u ? ho(i) : T,
    + o = f && Re(f[0]) && 424 == f[1] && !f[4].length && 1 == f[9] ? o[ge(f[0])].apply(o, f[3]) : 1 == i.length && Re(i) ? o[u]() : o.thru(i)
    + return function () {
    + var n = arguments,
    + e = n[0]
    + if (o && 1 == n.length && ff(e)) return o.plant(e).value()
    + for (var u = 0, n = r ? t[u].apply(this, n) : e; ++u < r; ) n = t[u].call(this, n)
    + return n
    + }
    + })
    + }
    + function Jr(n, t, r, e, u, i, o, f, c, a) {
    + function l() {
    + for (var d = arguments.length, y = Ku(d), b = d; b--; ) y[b] = arguments[b]
    + if (_) {
    + var x,
    + j = de(l),
    + b = y.length
    + for (x = 0; b--; ) y[b] === j && ++x
    + }
    + if ((e && (y = Br(y, e, u, _)), i && (y = Lr(y, i, o, _)), (d -= x), _ && d < a)) return (j = L(y, j)), ue(n, t, Jr, l.placeholder, r, y, j, f, c, a - d)
    + if (((j = h ? r : this), (b = p ? j[n] : n), (d = y.length), f)) {
    + x = y.length
    + for (var w = Ci(f.length, x), m = Ur(y); w--; ) {
    + var A = f[w]
    + y[w] = Se(A, x) ? m[A] : T
    + }
    + } else v && 1 < d && y.reverse()
    + return s && c < d && (y.length = c), this && this !== $n && this instanceof l && (b = g || Vr(b)), b.apply(j, y)
    + }
    + var s = 128 & t,
    + h = 1 & t,
    + p = 2 & t,
    + _ = 24 & t,
    + v = 512 & t,
    + g = p ? T : Vr(n)
    + return l
    + }
    + function Yr(n, t) {
    + return function (r, e) {
    + return Bt(r, n, t(e))
    + }
    + }
    + function Qr(n, t) {
    + return function (r, e) {
    + var u
    + if (r === T && e === T) return t
    + if ((r !== T && (u = r), e !== T)) {
    + if (u === T) return e
    + typeof r == "string" || typeof e == "string" ? ((r = yr(r)), (e = yr(e))) : ((r = dr(r)), (e = dr(e))), (u = n(r, e))
    + }
    + return u
    + }
    + }
    + function Xr(t) {
    + return pe(function (r) {
    + return (
    + (r = c(r, k(ye()))),
    + fr(function (e) {
    + var u = this
    + return t(r, function (t) {
    + return n(t, u, e)
    + })
    + })
    + )
    + })
    + }
    + function ne(n, t) {
    + t = t === T ? " " : yr(t)
    + var r = t.length
    + return 2 > r ? (r ? or(t, n) : t) : ((r = or(t, Oi(n / D(t)))), Rn.test(t) ? Or(M(r), 0, n).join("") : r.slice(0, n))
    + }
    + function te(t, r, e, u) {
    + function i() {
    + for (var r = -1, c = arguments.length, a = -1, l = u.length, s = Ku(l + c), h = this && this !== $n && this instanceof i ? f : t; ++a < l; ) s[a] = u[a]
    + for (; c--; ) s[a++] = arguments[++r]
    + return n(h, o ? e : this, s)
    + }
    + var o = 1 & r,
    + f = Vr(t)
    + return i
    + }
    + function re(n) {
    + return function (t, r, e) {
    + e && typeof e != "number" && Oe(t, r, e) && (r = e = T), (t = Au(t)), r === T ? ((r = t), (t = 0)) : (r = Au(r)), (e = e === T ? (t < r ? 1 : -1) : Au(e))
    + var u = -1
    + r = Ui(Oi((r - t) / (e || 1)), 0)
    + for (var i = Ku(r); r--; ) (i[n ? r : ++u] = t), (t += e)
    + return i
    + }
    + }
    + function ee(n) {
    + return function (t, r) {
    + return (typeof t == "string" && typeof r == "string") || ((t = Su(t)), (r = Su(r))), n(t, r)
    + }
    + }
    + function ue(n, t, r, e, u, i, o, f, c, a) {
    + var l = 8 & t,
    + s = l ? o : T
    + o = l ? T : o
    + var h = l ? i : T
    + return (
    + (i = l ? T : i),
    + (t = (t | (l ? 32 : 64)) & ~(l ? 64 : 32)),
    + 4 & t || (t &= -4),
    + (u = [n, t, u, h, s, i, o, f, c, a]),
    + (r = r.apply(T, u)),
    + Re(n) && yo(r, u),
    + (r.placeholder = e),
    + Ue(r, n, t)
    + )
    + }
    + function ie(n) {
    + var t = Yu[n]
    + return function (n, r) {
    + if (((n = Su(n)), (r = null == r ? 0 : Ci(Eu(r), 292)) && Wi(n))) {
    + var e = (Iu(n) + "e").split("e"),
    + e = t(e[0] + "e" + (+e[1] + r)),
    + e = (Iu(e) + "e").split("e")
    + return +(e[0] + "e" + (+e[1] - r))
    + }
    + return t(n)
    + }
    + }
    + function oe(n) {
    + return function (t) {
    + var r = vo(t)
    + return "[object Map]" == r ? W(t) : "[object Set]" == r ? C(t) : E(t, n(t))
    + }
    + }
    + function fe(n, t, r, e, u, i, o, f) {
    + var c = 2 & t
    + if (!c && typeof n != "function") throw new ti("Expected a function")
    + var a = e ? e.length : 0
    + if ((a || ((t &= -97), (e = u = T)), (o = o === T ? o : Ui(Eu(o), 0)), (f = f === T ? f : Eu(f)), (a -= u ? u.length : 0), 64 & t)) {
    + var l = e,
    + s = u
    + e = u = T
    + }
    + var h = c ? T : ho(n)
    + return (
    + (i = [n, t, r, e, u, l, s, i, o, f]),
    + h &&
    + ((r = i[1]),
    + (n = h[1]),
    + (t = r | n),
    + (e = (128 == n && 8 == r) || (128 == n && 256 == r && i[7].length <= h[8]) || (384 == n && h[7].length <= h[8] && 8 == r)),
    + 131 > t || e) &&
    + (1 & n && ((i[2] = h[2]), (t |= 1 & r ? 0 : 4)),
    + (r = h[3]) && ((e = i[3]), (i[3] = e ? Br(e, r, h[4]) : r), (i[4] = e ? L(i[3], "__lodash_placeholder__") : h[4])),
    + (r = h[5]) && ((e = i[5]), (i[5] = e ? Lr(e, r, h[6]) : r), (i[6] = e ? L(i[5], "__lodash_placeholder__") : h[6])),
    + (r = h[7]) && (i[7] = r),
    + 128 & n && (i[8] = null == i[8] ? h[8] : Ci(i[8], h[8])),
    + null == i[9] && (i[9] = h[9]),
    + (i[0] = h[0]),
    + (i[1] = t)),
    + (n = i[0]),
    + (t = i[1]),
    + (r = i[2]),
    + (e = i[3]),
    + (u = i[4]),
    + (f = i[9] = i[9] === T ? (c ? 0 : n.length) : Ui(i[9] - a, 0)),
    + !f && 24 & t && (t &= -25),
    + Ue((h ? co : yo)(t && 1 != t ? (8 == t || 16 == t ? Kr(n, t, f) : (32 != t && 33 != t) || u.length ? Jr.apply(T, i) : te(n, t, r, e)) : Pr(n, t, r), i), n, t)
    + )
    + }
    + function ce(n, t, r, e) {
    + return n === T || (lu(n, ei[r]) && !oi.call(e, r)) ? t : n
    + }
    + function ae(n, t, r, e, u, i) {
    + return du(n) && du(t) && (i.set(t, n), Yt(n, t, T, ae, i), i.delete(t)), n
    + }
    + function le(n) {
    + return xu(n) ? T : n
    + }
    + function se(n, t, r, e, u, i) {
    + var o = 1 & r,
    + f = n.length,
    + c = t.length
    + if (f != c && !(o && c > f)) return false
    + if ((c = i.get(n)) && i.get(t)) return c == t
    + var c = -1,
    + a = true,
    + l = 2 & r ? new Nn() : T
    + for (i.set(n, t), i.set(t, n); ++c < f; ) {
    + var s = n[c],
    + p = t[c]
    + if (e) var _ = o ? e(p, s, c, t, n, i) : e(s, p, c, n, t, i)
    + if (_ !== T) {
    + if (_) continue
    + a = false
    + break
    + }
    + if (l) {
    + if (
    + !h(t, function (n, t) {
    + if (!O(l, t) && (s === n || u(s, n, r, e, i))) return l.push(t)
    + })
    + ) {
    + a = false
    + break
    + }
    + } else if (s !== p && !u(s, p, r, e, i)) {
    + a = false
    + break
    + }
    + }
    + return i.delete(n), i.delete(t), a
    + }
    + function he(n, t, r, e, u, i, o) {
    + switch (r) {
    + case "[object DataView]":
    + if (n.byteLength != t.byteLength || n.byteOffset != t.byteOffset) break
    + ;(n = n.buffer), (t = t.buffer)
    + case "[object ArrayBuffer]":
    + if (n.byteLength != t.byteLength || !i(new vi(n), new vi(t))) break
    + return true
    + case "[object Boolean]":
    + case "[object Date]":
    + case "[object Number]":
    + return lu(+n, +t)
    + case "[object Error]":
    + return n.name == t.name && n.message == t.message
    + case "[object RegExp]":
    + case "[object String]":
    + return n == t + ""
    + case "[object Map]":
    + var f = W
    + case "[object Set]":
    + if ((f || (f = U), n.size != t.size && !(1 & e))) break
    + return (r = o.get(n)) ? r == t : ((e |= 2), o.set(n, t), (t = se(f(n), f(t), e, u, i, o)), o.delete(n), t)
    + case "[object Symbol]":
    + if (to) return to.call(n) == to.call(t)
    + }
    + return false
    + }
    + function pe(n) {
    + return xo(Be(n, T, Ze), n + "")
    + }
    + function _e(n) {
    + return St(n, Wu, po)
    + }
    + function ve(n) {
    + return St(n, Bu, _o)
    + }
    + function ge(n) {
    + for (var t = n.name + "", r = Gi[t], e = oi.call(Gi, t) ? r.length : 0; e--; ) {
    + var u = r[e],
    + i = u.func
    + if (null == i || i == n) return u.name
    + }
    + return t
    + }
    + function de(n) {
    + return (oi.call(An, "placeholder") ? An : n).placeholder
    + }
    + function ye() {
    + var n = An.iteratee || Fu,
    + n = n === Fu ? qt : n
    + return arguments.length ? n(arguments[0], arguments[1]) : n
    + }
    + function be(n, t) {
    + var r = n.__data__,
    + e = typeof t
    + return ("string" == e || "number" == e || "symbol" == e || "boolean" == e ? "__proto__" !== t : null === t) ? r[typeof t == "string" ? "string" : "hash"] : r.map
    + }
    + function xe(n) {
    + for (var t = Wu(n), r = t.length; r--; ) {
    + var e = t[r],
    + u = n[e]
    + t[r] = [e, u, u === u && !du(u)]
    + }
    + return t
    + }
    + function je(n, t) {
    + var r = null == n ? T : n[t]
    + return Ft(r) ? r : T
    + }
    + function we(n, t, r) {
    + t = Sr(t, n)
    + for (var e = -1, u = t.length, i = false; ++e < u; ) {
    + var o = Me(t[e])
    + if (!(i = null != n && r(n, o))) break
    + n = n[o]
    + }
    + return i || ++e != u ? i : ((u = null == n ? 0 : n.length), !!u && gu(u) && Se(o, u) && (ff(n) || of(n)))
    + }
    + function me(n) {
    + var t = n.length,
    + r = new n.constructor(t)
    + return t && "string" == typeof n[0] && oi.call(n, "index") && ((r.index = n.index), (r.input = n.input)), r
    + }
    + function Ae(n) {
    + return typeof n.constructor != "function" || ze(n) ? {} : eo(di(n))
    + }
    + function Ee(n, t, r) {
    + var e = n.constructor
    + switch (t) {
    + case "[object ArrayBuffer]":
    + return Rr(n)
    + case "[object Boolean]":
    + case "[object Date]":
    + return new e(+n)
    + case "[object DataView]":
    + return (t = r ? Rr(n.buffer) : n.buffer), new n.constructor(t, n.byteOffset, n.byteLength)
    + case "[object Float32Array]":
    + case "[object Float64Array]":
    + case "[object Int8Array]":
    + case "[object Int16Array]":
    + case "[object Int32Array]":
    + case "[object Uint8Array]":
    + case "[object Uint8ClampedArray]":
    + case "[object Uint16Array]":
    + case "[object Uint32Array]":
    + return zr(n, r)
    + case "[object Map]":
    + return new e()
    + case "[object Number]":
    + case "[object String]":
    + return new e(n)
    + case "[object RegExp]":
    + return (t = new n.constructor(n.source, _n.exec(n))), (t.lastIndex = n.lastIndex), t
    + case "[object Set]":
    + return new e()
    + case "[object Symbol]":
    + return to ? Qu(to.call(n)) : {}
    + }
    + }
    + function ke(n) {
    + return ff(n) || of(n) || !!(ji && n && n[ji])
    + }
    + function Se(n, t) {
    + var r = typeof n
    + return (t = null == t ? 9007199254740991 : t), !!t && ("number" == r || ("symbol" != r && bn.test(n))) && -1 < n && 0 == n % 1 && n < t
    + }
    + function Oe(n, t, r) {
    + if (!du(r)) return false
    + var e = typeof t
    + return !!("number" == e ? su(r) && Se(t, r.length) : "string" == e && t in r) && lu(r[t], n)
    + }
    + function Ie(n, t) {
    + if (ff(n)) return false
    + var r = typeof n
    + return !("number" != r && "symbol" != r && "boolean" != r && null != n && !wu(n)) || nn.test(n) || !X.test(n) || (null != t && n in Qu(t))
    + }
    + function Re(n) {
    + var t = ge(n),
    + r = An[t]
    + return typeof r == "function" && t in Un.prototype && (n === r || ((t = ho(r)), !!t && n === t[0]))
    + }
    + function ze(n) {
    + var t = n && n.constructor
    + return n === ((typeof t == "function" && t.prototype) || ei)
    + }
    + function We(n, t) {
    + return function (r) {
    + return null != r && r[n] === t && (t !== T || n in Qu(r))
    + }
    + }
    + function Be(t, r, e) {
    + return (
    + (r = Ui(r === T ? t.length - 1 : r, 0)),
    + function () {
    + for (var u = arguments, i = -1, o = Ui(u.length - r, 0), f = Ku(o); ++i < o; ) f[i] = u[r + i]
    + for (i = -1, o = Ku(r + 1); ++i < r; ) o[i] = u[i]
    + return (o[r] = e(f)), n(t, this, o)
    + }
    + )
    + }
    + function Le(n, t) {
    + if (("constructor" !== t || "function" != typeof n[t]) && "__proto__" != t) return n[t]
    + }
    + function Ue(n, t, r) {
    + var e = t + ""
    + t = xo
    + var u,
    + i = $e
    + return (
    + (u = (u = e.match(an)) ? u[1].split(ln) : []),
    + (r = i(u, r)),
    + (i = r.length) && ((u = i - 1), (r[u] = (1 < i ? "& " : "") + r[u]), (r = r.join(2 < i ? ", " : " ")), (e = e.replace(cn, "{\n/* [wrapped with " + r + "] */\n"))),
    + t(n, e)
    + )
    + }
    + function Ce(n) {
    + var t = 0,
    + r = 0
    + return function () {
    + var e = Di(),
    + u = 16 - (e - r)
    + if (((r = e), 0 < u)) {
    + if (800 <= ++t) return arguments[0]
    + } else t = 0
    + return n.apply(T, arguments)
    + }
    + }
    + function De(n, t) {
    + var r = -1,
    + e = n.length,
    + u = e - 1
    + for (t = t === T ? e : t; ++r < t; ) {
    + var e = ir(r, u),
    + i = n[e]
    + ;(n[e] = n[r]), (n[r] = i)
    + }
    + return (n.length = t), n
    + }
    + function Me(n) {
    + if (typeof n == "string" || wu(n)) return n
    + var t = n + ""
    + return "0" == t && 1 / n == -$ ? "-0" : t
    + }
    + function Te(n) {
    + if (null != n) {
    + try {
    + return ii.call(n)
    + } catch (n) {}
    + return n + ""
    + }
    + return ""
    + }
    + function $e(n, t) {
    + return (
    + r(N, function (r) {
    + var e = "_." + r[0]
    + t & r[1] && !o(n, e) && n.push(e)
    + }),
    + n.sort()
    + )
    + }
    + function Fe(n) {
    + if (n instanceof Un) return n.clone()
    + var t = new On(n.__wrapped__, n.__chain__)
    + return (t.__actions__ = Ur(n.__actions__)), (t.__index__ = n.__index__), (t.__values__ = n.__values__), t
    + }
    + function Ne(n, t, r) {
    + var e = null == n ? 0 : n.length
    + return e ? ((r = null == r ? 0 : Eu(r)), 0 > r && (r = Ui(e + r, 0)), _(n, ye(t, 3), r)) : -1
    + }
    + function Pe(n, t, r) {
    + var e = null == n ? 0 : n.length
    + if (!e) return -1
    + var u = e - 1
    + return r !== T && ((u = Eu(r)), (u = 0 > r ? Ui(e + u, 0) : Ci(u, e - 1))), _(n, ye(t, 3), u, true)
    + }
    + function Ze(n) {
    + return (null == n ? 0 : n.length) ? wt(n, 1) : []
    + }
    + function qe(n) {
    + return n && n.length ? n[0] : T
    + }
    + function Ve(n) {
    + var t = null == n ? 0 : n.length
    + return t ? n[t - 1] : T
    + }
    + function Ke(n, t) {
    + return n && n.length && t && t.length ? er(n, t) : n
    + }
    + function Ge(n) {
    + return null == n ? n : $i.call(n)
    + }
    + function He(n) {
    + if (!n || !n.length) return []
    + var t = 0
    + return (
    + (n = i(n, function (n) {
    + if (hu(n)) return (t = Ui(n.length, t)), true
    + })),
    + A(t, function (t) {
    + return c(n, b(t))
    + })
    + )
    + }
    + function Je(t, r) {
    + if (!t || !t.length) return []
    + var e = He(t)
    + return null == r
    + ? e
    + : c(e, function (t) {
    + return n(r, T, t)
    + })
    + }
    + function Ye(n) {
    + return (n = An(n)), (n.__chain__ = true), n
    + }
    + function Qe(n, t) {
    + return t(n)
    + }
    + function Xe() {
    + return this
    + }
    + function nu(n, t) {
    + return (ff(n) ? r : uo)(n, ye(t, 3))
    + }
    + function tu(n, t) {
    + return (ff(n) ? e : io)(n, ye(t, 3))
    + }
    + function ru(n, t) {
    + return (ff(n) ? c : Gt)(n, ye(t, 3))
    + }
    + function eu(n, t, r) {
    + return (t = r ? T : t), (t = n && null == t ? n.length : t), fe(n, 128, T, T, T, T, t)
    + }
    + function uu(n, t) {
    + var r
    + if (typeof t != "function") throw new ti("Expected a function")
    + return (
    + (n = Eu(n)),
    + function () {
    + return 0 < --n && (r = t.apply(this, arguments)), 1 >= n && (t = T), r
    + }
    + )
    + }
    + function iu(n, t, r) {
    + return (t = r ? T : t), (n = fe(n, 8, T, T, T, T, T, t)), (n.placeholder = iu.placeholder), n
    + }
    + function ou(n, t, r) {
    + return (t = r ? T : t), (n = fe(n, 16, T, T, T, T, T, t)), (n.placeholder = ou.placeholder), n
    + }
    + function fu(n, t, r) {
    + function e(t) {
    + var r = c,
    + e = a
    + return (c = a = T), (_ = t), (s = n.apply(e, r))
    + }
    + function u(n) {
    + var r = n - p
    + return (n -= _), p === T || r >= t || 0 > r || (g && n >= l)
    + }
    + function i() {
    + var n = Go()
    + if (u(n)) return o(n)
    + var r,
    + e = bo
    + ;(r = n - _), (n = t - (n - p)), (r = g ? Ci(n, l - r) : n), (h = e(i, r))
    + }
    + function o(n) {
    + return (h = T), d && c ? e(n) : ((c = a = T), s)
    + }
    + function f() {
    + var n = Go(),
    + r = u(n)
    + if (((c = arguments), (a = this), (p = n), r)) {
    + if (h === T) return (_ = n = p), (h = bo(i, t)), v ? e(n) : s
    + if (g) return lo(h), (h = bo(i, t)), e(p)
    + }
    + return h === T && (h = bo(i, t)), s
    + }
    + var c,
    + a,
    + l,
    + s,
    + h,
    + p,
    + _ = 0,
    + v = false,
    + g = false,
    + d = true
    + if (typeof n != "function") throw new ti("Expected a function")
    + return (
    + (t = Su(t) || 0),
    + du(r) && ((v = !!r.leading), (l = (g = "maxWait" in r) ? Ui(Su(r.maxWait) || 0, t) : l), (d = "trailing" in r ? !!r.trailing : d)),
    + (f.cancel = function () {
    + h !== T && lo(h), (_ = 0), (c = p = a = h = T)
    + }),
    + (f.flush = function () {
    + return h === T ? s : o(Go())
    + }),
    + f
    + )
    + }
    + function cu(n, t) {
    + function r() {
    + var e = arguments,
    + u = t ? t.apply(this, e) : e[0],
    + i = r.cache
    + return i.has(u) ? i.get(u) : ((e = n.apply(this, e)), (r.cache = i.set(u, e) || i), e)
    + }
    + if (typeof n != "function" || (null != t && typeof t != "function")) throw new ti("Expected a function")
    + return (r.cache = new (cu.Cache || Fn)()), r
    + }
    + function au(n) {
    + if (typeof n != "function") throw new ti("Expected a function")
    + return function () {
    + var t = arguments
    + switch (t.length) {
    + case 0:
    + return !n.call(this)
    + case 1:
    + return !n.call(this, t[0])
    + case 2:
    + return !n.call(this, t[0], t[1])
    + case 3:
    + return !n.call(this, t[0], t[1], t[2])
    + }
    + return !n.apply(this, t)
    + }
    + }
    + function lu(n, t) {
    + return n === t || (n !== n && t !== t)
    + }
    + function su(n) {
    + return null != n && gu(n.length) && !_u(n)
    + }
    + function hu(n) {
    + return yu(n) && su(n)
    + }
    + function pu(n) {
    + if (!yu(n)) return false
    + var t = Ot(n)
    + return "[object Error]" == t || "[object DOMException]" == t || (typeof n.message == "string" && typeof n.name == "string" && !xu(n))
    + }
    + function _u(n) {
    + return !!du(n) && ((n = Ot(n)), "[object Function]" == n || "[object GeneratorFunction]" == n || "[object AsyncFunction]" == n || "[object Proxy]" == n)
    + }
    + function vu(n) {
    + return typeof n == "number" && n == Eu(n)
    + }
    + function gu(n) {
    + return typeof n == "number" && -1 < n && 0 == n % 1 && 9007199254740991 >= n
    + }
    + function du(n) {
    + var t = typeof n
    + return null != n && ("object" == t || "function" == t)
    + }
    + function yu(n) {
    + return null != n && typeof n == "object"
    + }
    + function bu(n) {
    + return typeof n == "number" || (yu(n) && "[object Number]" == Ot(n))
    + }
    + function xu(n) {
    + return (
    + !(!yu(n) || "[object Object]" != Ot(n)) &&
    + ((n = di(n)), null === n || ((n = oi.call(n, "constructor") && n.constructor), typeof n == "function" && n instanceof n && ii.call(n) == li))
    + )
    + }
    + function ju(n) {
    + return typeof n == "string" || (!ff(n) && yu(n) && "[object String]" == Ot(n))
    + }
    + function wu(n) {
    + return typeof n == "symbol" || (yu(n) && "[object Symbol]" == Ot(n))
    + }
    + function mu(n) {
    + if (!n) return []
    + if (su(n)) return ju(n) ? M(n) : Ur(n)
    + if (wi && n[wi]) {
    + n = n[wi]()
    + for (var t, r = []; !(t = n.next()).done; ) r.push(t.value)
    + return r
    + }
    + return (t = vo(n)), ("[object Map]" == t ? W : "[object Set]" == t ? U : Uu)(n)
    + }
    + function Au(n) {
    + return n ? ((n = Su(n)), n === $ || n === -$ ? 1.7976931348623157e308 * (0 > n ? -1 : 1) : n === n ? n : 0) : 0 === n ? n : 0
    + }
    + function Eu(n) {
    + n = Au(n)
    + var t = n % 1
    + return n === n ? (t ? n - t : n) : 0
    + }
    + function ku(n) {
    + return n ? pt(Eu(n), 0, 4294967295) : 0
    + }
    + function Su(n) {
    + if (typeof n == "number") return n
    + if (wu(n)) return F
    + if ((du(n) && ((n = typeof n.valueOf == "function" ? n.valueOf() : n), (n = du(n) ? n + "" : n)), typeof n != "string")) return 0 === n ? n : +n
    + n = n.replace(un, "")
    + var t = gn.test(n)
    + return t || yn.test(n) ? Dn(n.slice(2), t ? 2 : 8) : vn.test(n) ? F : +n
    + }
    + function Ou(n) {
    + return Cr(n, Bu(n))
    + }
    + function Iu(n) {
    + return null == n ? "" : yr(n)
    + }
    + function Ru(n, t, r) {
    + return (n = null == n ? T : kt(n, t)), n === T ? r : n
    + }
    + function zu(n, t) {
    + return null != n && we(n, t, zt)
    + }
    + function Wu(n) {
    + return su(n) ? qn(n) : Vt(n)
    + }
    + function Bu(n) {
    + if (su(n)) n = qn(n, true)
    + else if (du(n)) {
    + var t,
    + r = ze(n),
    + e = []
    + for (t in n) ("constructor" != t || (!r && oi.call(n, t))) && e.push(t)
    + n = e
    + } else {
    + if (((t = []), null != n)) for (r in Qu(n)) t.push(r)
    + n = t
    + }
    + return n
    + }
    + function Lu(n, t) {
    + if (null == n) return {}
    + var r = c(ve(n), function (n) {
    + return [n]
    + })
    + return (
    + (t = ye(t)),
    + tr(n, r, function (n, r) {
    + return t(n, r[0])
    + })
    + )
    + }
    + function Uu(n) {
    + return null == n ? [] : S(n, Wu(n))
    + }
    + function Cu(n) {
    + return $f(Iu(n).toLowerCase())
    + }
    + function Du(n) {
    + return (n = Iu(n)) && n.replace(xn, Xn).replace(Sn, "")
    + }
    + function Mu(n, t, r) {
    + return (n = Iu(n)), (t = r ? T : t), t === T ? (zn.test(n) ? n.match(In) || [] : n.match(sn) || []) : n.match(t) || []
    + }
    + function Tu(n) {
    + return function () {
    + return n
    + }
    + }
    + function $u(n) {
    + return n
    + }
    + function Fu(n) {
    + return qt(typeof n == "function" ? n : _t(n, 1))
    + }
    + function Nu(n, t, e) {
    + var u = Wu(t),
    + i = Et(t, u)
    + null != e || (du(t) && (i.length || !u.length)) || ((e = t), (t = n), (n = this), (i = Et(t, Wu(t))))
    + var o = !(du(e) && "chain" in e && !e.chain),
    + f = _u(n)
    + return (
    + r(i, function (r) {
    + var e = t[r]
    + ;(n[r] = e),
    + f &&
    + (n.prototype[r] = function () {
    + var t = this.__chain__
    + if (o || t) {
    + var r = n(this.__wrapped__)
    + return (r.__actions__ = Ur(this.__actions__)).push({ func: e, args: arguments, thisArg: n }), (r.__chain__ = t), r
    + }
    + return e.apply(n, a([this.value()], arguments))
    + })
    + }),
    + n
    + )
    + }
    + function Pu() {}
    + function Zu(n) {
    + return Ie(n) ? b(Me(n)) : rr(n)
    + }
    + function qu() {
    + return []
    + }
    + function Vu() {
    + return false
    + }
    + mn = null == mn ? $n : rt.defaults($n.Object(), mn, rt.pick($n, Wn))
    + var Ku = mn.Array,
    + Gu = mn.Date,
    + Hu = mn.Error,
    + Ju = mn.Function,
    + Yu = mn.Math,
    + Qu = mn.Object,
    + Xu = mn.RegExp,
    + ni = mn.String,
    + ti = mn.TypeError,
    + ri = Ku.prototype,
    + ei = Qu.prototype,
    + ui = mn["__core-js_shared__"],
    + ii = Ju.prototype.toString,
    + oi = ei.hasOwnProperty,
    + fi = 0,
    + ci = (function () {
    + var n = /[^.]+$/.exec((ui && ui.keys && ui.keys.IE_PROTO) || "")
    + return n ? "Symbol(src)_1." + n : ""
    + })(),
    + ai = ei.toString,
    + li = ii.call(Qu),
    + si = $n._,
    + hi = Xu(
    + "^" +
    + ii
    + .call(oi)
    + .replace(rn, "\\$&")
    + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") +
    + "$"
    + ),
    + pi = Pn ? mn.Buffer : T,
    + _i = mn.Symbol,
    + vi = mn.Uint8Array,
    + gi = pi ? pi.g : T,
    + di = B(Qu.getPrototypeOf, Qu),
    + yi = Qu.create,
    + bi = ei.propertyIsEnumerable,
    + xi = ri.splice,
    + ji = _i ? _i.isConcatSpreadable : T,
    + wi = _i ? _i.iterator : T,
    + mi = _i ? _i.toStringTag : T,
    + Ai = (function () {
    + try {
    + var n = je(Qu, "defineProperty")
    + return n({}, "", {}), n
    + } catch (n) {}
    + })(),
    + Ei = mn.clearTimeout !== $n.clearTimeout && mn.clearTimeout,
    + ki = Gu && Gu.now !== $n.Date.now && Gu.now,
    + Si = mn.setTimeout !== $n.setTimeout && mn.setTimeout,
    + Oi = Yu.ceil,
    + Ii = Yu.floor,
    + Ri = Qu.getOwnPropertySymbols,
    + zi = pi ? pi.isBuffer : T,
    + Wi = mn.isFinite,
    + Bi = ri.join,
    + Li = B(Qu.keys, Qu),
    + Ui = Yu.max,
    + Ci = Yu.min,
    + Di = Gu.now,
    + Mi = mn.parseInt,
    + Ti = Yu.random,
    + $i = ri.reverse,
    + Fi = je(mn, "DataView"),
    + Ni = je(mn, "Map"),
    + Pi = je(mn, "Promise"),
    + Zi = je(mn, "Set"),
    + qi = je(mn, "WeakMap"),
    + Vi = je(Qu, "create"),
    + Ki = qi && new qi(),
    + Gi = {},
    + Hi = Te(Fi),
    + Ji = Te(Ni),
    + Yi = Te(Pi),
    + Qi = Te(Zi),
    + Xi = Te(qi),
    + no = _i ? _i.prototype : T,
    + to = no ? no.valueOf : T,
    + ro = no ? no.toString : T,
    + eo = (function () {
    + function n() {}
    + return function (t) {
    + return du(t) ? (yi ? yi(t) : ((n.prototype = t), (t = new n()), (n.prototype = T), t)) : {}
    + }
    + })()
    + ;(An.templateSettings = { escape: J, evaluate: Y, interpolate: Q, variable: "", imports: { _: An } }),
    + (An.prototype = En.prototype),
    + (An.prototype.constructor = An),
    + (On.prototype = eo(En.prototype)),
    + (On.prototype.constructor = On),
    + (Un.prototype = eo(En.prototype)),
    + (Un.prototype.constructor = Un),
    + (Mn.prototype.clear = function () {
    + ;(this.__data__ = Vi ? Vi(null) : {}), (this.size = 0)
    + }),
    + (Mn.prototype.delete = function (n) {
    + return (n = this.has(n) && delete this.__data__[n]), (this.size -= n ? 1 : 0), n
    + }),
    + (Mn.prototype.get = function (n) {
    + var t = this.__data__
    + return Vi ? ((n = t[n]), "__lodash_hash_undefined__" === n ? T : n) : oi.call(t, n) ? t[n] : T
    + }),
    + (Mn.prototype.has = function (n) {
    + var t = this.__data__
    + return Vi ? t[n] !== T : oi.call(t, n)
    + }),
    + (Mn.prototype.set = function (n, t) {
    + var r = this.__data__
    + return (this.size += this.has(n) ? 0 : 1), (r[n] = Vi && t === T ? "__lodash_hash_undefined__" : t), this
    + }),
    + (Tn.prototype.clear = function () {
    + ;(this.__data__ = []), (this.size = 0)
    + }),
    + (Tn.prototype.delete = function (n) {
    + var t = this.__data__
    + return (n = ft(t, n)), !(0 > n) && (n == t.length - 1 ? t.pop() : xi.call(t, n, 1), --this.size, true)
    + }),
    + (Tn.prototype.get = function (n) {
    + var t = this.__data__
    + return (n = ft(t, n)), 0 > n ? T : t[n][1]
    + }),
    + (Tn.prototype.has = function (n) {
    + return -1 < ft(this.__data__, n)
    + }),
    + (Tn.prototype.set = function (n, t) {
    + var r = this.__data__,
    + e = ft(r, n)
    + return 0 > e ? (++this.size, r.push([n, t])) : (r[e][1] = t), this
    + }),
    + (Fn.prototype.clear = function () {
    + ;(this.size = 0), (this.__data__ = { hash: new Mn(), map: new (Ni || Tn)(), string: new Mn() })
    + }),
    + (Fn.prototype.delete = function (n) {
    + return (n = be(this, n).delete(n)), (this.size -= n ? 1 : 0), n
    + }),
    + (Fn.prototype.get = function (n) {
    + return be(this, n).get(n)
    + }),
    + (Fn.prototype.has = function (n) {
    + return be(this, n).has(n)
    + }),
    + (Fn.prototype.set = function (n, t) {
    + var r = be(this, n),
    + e = r.size
    + return r.set(n, t), (this.size += r.size == e ? 0 : 1), this
    + }),
    + (Nn.prototype.add = Nn.prototype.push =
    + function (n) {
    + return this.__data__.set(n, "__lodash_hash_undefined__"), this
    + }),
    + (Nn.prototype.has = function (n) {
    + return this.__data__.has(n)
    + }),
    + (Zn.prototype.clear = function () {
    + ;(this.__data__ = new Tn()), (this.size = 0)
    + }),
    + (Zn.prototype.delete = function (n) {
    + var t = this.__data__
    + return (n = t.delete(n)), (this.size = t.size), n
    + }),
    + (Zn.prototype.get = function (n) {
    + return this.__data__.get(n)
    + }),
    + (Zn.prototype.has = function (n) {
    + return this.__data__.has(n)
    + }),
    + (Zn.prototype.set = function (n, t) {
    + var r = this.__data__
    + if (r instanceof Tn) {
    + var e = r.__data__
    + if (!Ni || 199 > e.length) return e.push([n, t]), (this.size = ++r.size), this
    + r = this.__data__ = new Fn(e)
    + }
    + return r.set(n, t), (this.size = r.size), this
    + })
    + var uo = Fr(mt),
    + io = Fr(At, true),
    + oo = Nr(),
    + fo = Nr(true),
    + co = Ki
    + ? function (n, t) {
    + return Ki.set(n, t), n
    + }
    + : $u,
    + ao = Ai
    + ? function (n, t) {
    + return Ai(n, "toString", { configurable: true, enumerable: false, value: Tu(t), writable: true })
    + }
    + : $u,
    + lo =
    + Ei ||
    + function (n) {
    + return $n.clearTimeout(n)
    + },
    + so =
    + Zi && 1 / U(new Zi([, -0]))[1] == $
    + ? function (n) {
    + return new Zi(n)
    + }
    + : Pu,
    + ho = Ki
    + ? function (n) {
    + return Ki.get(n)
    + }
    + : Pu,
    + po = Ri
    + ? function (n) {
    + return null == n
    + ? []
    + : ((n = Qu(n)),
    + i(Ri(n), function (t) {
    + return bi.call(n, t)
    + }))
    + }
    + : qu,
    + _o = Ri
    + ? function (n) {
    + for (var t = []; n; ) a(t, po(n)), (n = di(n))
    + return t
    + }
    + : qu,
    + vo = Ot
    + ;((Fi && "[object DataView]" != vo(new Fi(new ArrayBuffer(1)))) ||
    + (Ni && "[object Map]" != vo(new Ni())) ||
    + (Pi && "[object Promise]" != vo(Pi.resolve())) ||
    + (Zi && "[object Set]" != vo(new Zi())) ||
    + (qi && "[object WeakMap]" != vo(new qi()))) &&
    + (vo = function (n) {
    + var t = Ot(n)
    + if ((n = (n = "[object Object]" == t ? n.constructor : T) ? Te(n) : ""))
    + switch (n) {
    + case Hi:
    + return "[object DataView]"
    + case Ji:
    + return "[object Map]"
    + case Yi:
    + return "[object Promise]"
    + case Qi:
    + return "[object Set]"
    + case Xi:
    + return "[object WeakMap]"
    + }
    + return t
    + })
    + var go = ui ? _u : Vu,
    + yo = Ce(co),
    + bo =
    + Si ||
    + function (n, t) {
    + return $n.setTimeout(n, t)
    + },
    + xo = Ce(ao),
    + jo = (function (n) {
    + n = cu(n, function (n) {
    + return 500 === t.size && t.clear(), n
    + })
    + var t = n.cache
    + return n
    + })(function (n) {
    + var t = []
    + return (
    + 46 === n.charCodeAt(0) && t.push(""),
    + n.replace(tn, function (n, r, e, u) {
    + t.push(e ? u.replace(hn, "$1") : r || n)
    + }),
    + t
    + )
    + }),
    + wo = fr(function (n, t) {
    + return hu(n) ? yt(n, wt(t, 1, hu, true)) : []
    + }),
    + mo = fr(function (n, t) {
    + var r = Ve(t)
    + return hu(r) && (r = T), hu(n) ? yt(n, wt(t, 1, hu, true), ye(r, 2)) : []
    + }),
    + Ao = fr(function (n, t) {
    + var r = Ve(t)
    + return hu(r) && (r = T), hu(n) ? yt(n, wt(t, 1, hu, true), T, r) : []
    + }),
    + Eo = fr(function (n) {
    + var t = c(n, Er)
    + return t.length && t[0] === n[0] ? Wt(t) : []
    + }),
    + ko = fr(function (n) {
    + var t = Ve(n),
    + r = c(n, Er)
    + return t === Ve(r) ? (t = T) : r.pop(), r.length && r[0] === n[0] ? Wt(r, ye(t, 2)) : []
    + }),
    + So = fr(function (n) {
    + var t = Ve(n),
    + r = c(n, Er)
    + return (t = typeof t == "function" ? t : T) && r.pop(), r.length && r[0] === n[0] ? Wt(r, T, t) : []
    + }),
    + Oo = fr(Ke),
    + Io = pe(function (n, t) {
    + var r = null == n ? 0 : n.length,
    + e = ht(n, t)
    + return (
    + ur(
    + n,
    + c(t, function (n) {
    + return Se(n, r) ? +n : n
    + }).sort(Wr)
    + ),
    + e
    + )
    + }),
    + Ro = fr(function (n) {
    + return br(wt(n, 1, hu, true))
    + }),
    + zo = fr(function (n) {
    + var t = Ve(n)
    + return hu(t) && (t = T), br(wt(n, 1, hu, true), ye(t, 2))
    + }),
    + Wo = fr(function (n) {
    + var t = Ve(n),
    + t = typeof t == "function" ? t : T
    + return br(wt(n, 1, hu, true), T, t)
    + }),
    + Bo = fr(function (n, t) {
    + return hu(n) ? yt(n, t) : []
    + }),
    + Lo = fr(function (n) {
    + return mr(i(n, hu))
    + }),
    + Uo = fr(function (n) {
    + var t = Ve(n)
    + return hu(t) && (t = T), mr(i(n, hu), ye(t, 2))
    + }),
    + Co = fr(function (n) {
    + var t = Ve(n),
    + t = typeof t == "function" ? t : T
    + return mr(i(n, hu), T, t)
    + }),
    + Do = fr(He),
    + Mo = fr(function (n) {
    + var t = n.length,
    + t = 1 < t ? n[t - 1] : T,
    + t = typeof t == "function" ? (n.pop(), t) : T
    + return Je(n, t)
    + }),
    + To = pe(function (n) {
    + function t(t) {
    + return ht(t, n)
    + }
    + var r = n.length,
    + e = r ? n[0] : 0,
    + u = this.__wrapped__
    + return !(1 < r || this.__actions__.length) && u instanceof Un && Se(e)
    + ? ((u = u.slice(e, +e + (r ? 1 : 0))),
    + u.__actions__.push({ func: Qe, args: [t], thisArg: T }),
    + new On(u, this.__chain__).thru(function (n) {
    + return r && !n.length && n.push(T), n
    + }))
    + : this.thru(t)
    + }),
    + $o = Tr(function (n, t, r) {
    + oi.call(n, r) ? ++n[r] : st(n, r, 1)
    + }),
    + Fo = Gr(Ne),
    + No = Gr(Pe),
    + Po = Tr(function (n, t, r) {
    + oi.call(n, r) ? n[r].push(t) : st(n, r, [t])
    + }),
    + Zo = fr(function (t, r, e) {
    + var u = -1,
    + i = typeof r == "function",
    + o = su(t) ? Ku(t.length) : []
    + return (
    + uo(t, function (t) {
    + o[++u] = i ? n(r, t, e) : Lt(t, r, e)
    + }),
    + o
    + )
    + }),
    + qo = Tr(function (n, t, r) {
    + st(n, r, t)
    + }),
    + Vo = Tr(
    + function (n, t, r) {
    + n[r ? 0 : 1].push(t)
    + },
    + function () {
    + return [[], []]
    + }
    + ),
    + Ko = fr(function (n, t) {
    + if (null == n) return []
    + var r = t.length
    + return 1 < r && Oe(n, t[0], t[1]) ? (t = []) : 2 < r && Oe(t[0], t[1], t[2]) && (t = [t[0]]), Xt(n, wt(t, 1), [])
    + }),
    + Go =
    + ki ||
    + function () {
    + return $n.Date.now()
    + },
    + Ho = fr(function (n, t, r) {
    + var e = 1
    + if (r.length)
    + var u = L(r, de(Ho)),
    + e = 32 | e
    + return fe(n, e, t, r, u)
    + }),
    + Jo = fr(function (n, t, r) {
    + var e = 3
    + if (r.length)
    + var u = L(r, de(Jo)),
    + e = 32 | e
    + return fe(t, e, n, r, u)
    + }),
    + Yo = fr(function (n, t) {
    + return dt(n, 1, t)
    + }),
    + Qo = fr(function (n, t, r) {
    + return dt(n, Su(t) || 0, r)
    + })
    + cu.Cache = Fn
    + var Xo = fr(function (t, r) {
    + r = 1 == r.length && ff(r[0]) ? c(r[0], k(ye())) : c(wt(r, 1), k(ye()))
    + var e = r.length
    + return fr(function (u) {
    + for (var i = -1, o = Ci(u.length, e); ++i < o; ) u[i] = r[i].call(this, u[i])
    + return n(t, this, u)
    + })
    + }),
    + nf = fr(function (n, t) {
    + return fe(n, 32, T, t, L(t, de(nf)))
    + }),
    + tf = fr(function (n, t) {
    + return fe(n, 64, T, t, L(t, de(tf)))
    + }),
    + rf = pe(function (n, t) {
    + return fe(n, 256, T, T, T, t)
    + }),
    + ef = ee(It),
    + uf = ee(function (n, t) {
    + return n >= t
    + }),
    + of = Ut(
    + (function () {
    + return arguments
    + })()
    + )
    + ? Ut
    + : function (n) {
    + return yu(n) && oi.call(n, "callee") && !bi.call(n, "callee")
    + },
    + ff = Ku.isArray,
    + cf = Vn ? k(Vn) : Ct,
    + af = zi || Vu,
    + lf = Kn ? k(Kn) : Dt,
    + sf = Gn ? k(Gn) : Tt,
    + hf = Hn ? k(Hn) : Nt,
    + pf = Jn ? k(Jn) : Pt,
    + _f = Yn ? k(Yn) : Zt,
    + vf = ee(Kt),
    + gf = ee(function (n, t) {
    + return n <= t
    + }),
    + df = $r(function (n, t) {
    + if (ze(t) || su(t)) Cr(t, Wu(t), n)
    + else for (var r in t) oi.call(t, r) && ot(n, r, t[r])
    + }),
    + yf = $r(function (n, t) {
    + Cr(t, Bu(t), n)
    + }),
    + bf = $r(function (n, t, r, e) {
    + Cr(t, Bu(t), n, e)
    + }),
    + xf = $r(function (n, t, r, e) {
    + Cr(t, Wu(t), n, e)
    + }),
    + jf = pe(ht),
    + wf = fr(function (n, t) {
    + n = Qu(n)
    + var r = -1,
    + e = t.length,
    + u = 2 < e ? t[2] : T
    + for (u && Oe(t[0], t[1], u) && (e = 1); ++r < e; )
    + for (var u = t[r], i = Bu(u), o = -1, f = i.length; ++o < f; ) {
    + var c = i[o],
    + a = n[c]
    + ;(a === T || (lu(a, ei[c]) && !oi.call(n, c))) && (n[c] = u[c])
    + }
    + return n
    + }),
    + mf = fr(function (t) {
    + return t.push(T, ae), n(Of, T, t)
    + }),
    + Af = Yr(function (n, t, r) {
    + null != t && typeof t.toString != "function" && (t = ai.call(t)), (n[t] = r)
    + }, Tu($u)),
    + Ef = Yr(function (n, t, r) {
    + null != t && typeof t.toString != "function" && (t = ai.call(t)), oi.call(n, t) ? n[t].push(r) : (n[t] = [r])
    + }, ye),
    + kf = fr(Lt),
    + Sf = $r(function (n, t, r) {
    + Yt(n, t, r)
    + }),
    + Of = $r(function (n, t, r, e) {
    + Yt(n, t, r, e)
    + }),
    + If = pe(function (n, t) {
    + var r = {}
    + if (null == n) return r
    + var e = false
    + ;(t = c(t, function (t) {
    + return (t = Sr(t, n)), e || (e = 1 < t.length), t
    + })),
    + Cr(n, ve(n), r),
    + e && (r = _t(r, 7, le))
    + for (var u = t.length; u--; ) xr(r, t[u])
    + return r
    + }),
    + Rf = pe(function (n, t) {
    + return null == n ? {} : nr(n, t)
    + }),
    + zf = oe(Wu),
    + Wf = oe(Bu),
    + Bf = qr(function (n, t, r) {
    + return (t = t.toLowerCase()), n + (r ? Cu(t) : t)
    + }),
    + Lf = qr(function (n, t, r) {
    + return n + (r ? "-" : "") + t.toLowerCase()
    + }),
    + Uf = qr(function (n, t, r) {
    + return n + (r ? " " : "") + t.toLowerCase()
    + }),
    + Cf = Zr("toLowerCase"),
    + Df = qr(function (n, t, r) {
    + return n + (r ? "_" : "") + t.toLowerCase()
    + }),
    + Mf = qr(function (n, t, r) {
    + return n + (r ? " " : "") + $f(t)
    + }),
    + Tf = qr(function (n, t, r) {
    + return n + (r ? " " : "") + t.toUpperCase()
    + }),
    + $f = Zr("toUpperCase"),
    + Ff = fr(function (t, r) {
    + try {
    + return n(t, T, r)
    + } catch (n) {
    + return pu(n) ? n : new Hu(n)
    + }
    + }),
    + Nf = pe(function (n, t) {
    + return (
    + r(t, function (t) {
    + ;(t = Me(t)), st(n, t, Ho(n[t], n))
    + }),
    + n
    + )
    + }),
    + Pf = Hr(),
    + Zf = Hr(true),
    + qf = fr(function (n, t) {
    + return function (r) {
    + return Lt(r, n, t)
    + }
    + }),
    + Vf = fr(function (n, t) {
    + return function (r) {
    + return Lt(n, r, t)
    + }
    + }),
    + Kf = Xr(c),
    + Gf = Xr(u),
    + Hf = Xr(h),
    + Jf = re(),
    + Yf = re(true),
    + Qf = Qr(function (n, t) {
    + return n + t
    + }, 0),
    + Xf = ie("ceil"),
    + nc = Qr(function (n, t) {
    + return n / t
    + }, 1),
    + tc = ie("floor"),
    + rc = Qr(function (n, t) {
    + return n * t
    + }, 1),
    + ec = ie("round"),
    + uc = Qr(function (n, t) {
    + return n - t
    + }, 0)
    + return (
    + (An.after = function (n, t) {
    + if (typeof t != "function") throw new ti("Expected a function")
    + return (
    + (n = Eu(n)),
    + function () {
    + if (1 > --n) return t.apply(this, arguments)
    + }
    + )
    + }),
    + (An.ary = eu),
    + (An.assign = df),
    + (An.assignIn = yf),
    + (An.assignInWith = bf),
    + (An.assignWith = xf),
    + (An.at = jf),
    + (An.before = uu),
    + (An.bind = Ho),
    + (An.bindAll = Nf),
    + (An.bindKey = Jo),
    + (An.castArray = function () {
    + if (!arguments.length) return []
    + var n = arguments[0]
    + return ff(n) ? n : [n]
    + }),
    + (An.chain = Ye),
    + (An.chunk = function (n, t, r) {
    + if (((t = (r ? Oe(n, t, r) : t === T) ? 1 : Ui(Eu(t), 0)), (r = null == n ? 0 : n.length), !r || 1 > t)) return []
    + for (var e = 0, u = 0, i = Ku(Oi(r / t)); e < r; ) i[u++] = hr(n, e, (e += t))
    + return i
    + }),
    + (An.compact = function (n) {
    + for (var t = -1, r = null == n ? 0 : n.length, e = 0, u = []; ++t < r; ) {
    + var i = n[t]
    + i && (u[e++] = i)
    + }
    + return u
    + }),
    + (An.concat = function () {
    + var n = arguments.length
    + if (!n) return []
    + for (var t = Ku(n - 1), r = arguments[0]; n--; ) t[n - 1] = arguments[n]
    + return a(ff(r) ? Ur(r) : [r], wt(t, 1))
    + }),
    + (An.cond = function (t) {
    + var r = null == t ? 0 : t.length,
    + e = ye()
    + return (
    + (t = r
    + ? c(t, function (n) {
    + if ("function" != typeof n[1]) throw new ti("Expected a function")
    + return [e(n[0]), n[1]]
    + })
    + : []),
    + fr(function (e) {
    + for (var u = -1; ++u < r; ) {
    + var i = t[u]
    + if (n(i[0], this, e)) return n(i[1], this, e)
    + }
    + })
    + )
    + }),
    + (An.conforms = function (n) {
    + return vt(_t(n, 1))
    + }),
    + (An.constant = Tu),
    + (An.countBy = $o),
    + (An.create = function (n, t) {
    + var r = eo(n)
    + return null == t ? r : at(r, t)
    + }),
    + (An.curry = iu),
    + (An.curryRight = ou),
    + (An.debounce = fu),
    + (An.defaults = wf),
    + (An.defaultsDeep = mf),
    + (An.defer = Yo),
    + (An.delay = Qo),
    + (An.difference = wo),
    + (An.differenceBy = mo),
    + (An.differenceWith = Ao),
    + (An.drop = function (n, t, r) {
    + var e = null == n ? 0 : n.length
    + return e ? ((t = r || t === T ? 1 : Eu(t)), hr(n, 0 > t ? 0 : t, e)) : []
    + }),
    + (An.dropRight = function (n, t, r) {
    + var e = null == n ? 0 : n.length
    + return e ? ((t = r || t === T ? 1 : Eu(t)), (t = e - t), hr(n, 0, 0 > t ? 0 : t)) : []
    + }),
    + (An.dropRightWhile = function (n, t) {
    + return n && n.length ? jr(n, ye(t, 3), true, true) : []
    + }),
    + (An.dropWhile = function (n, t) {
    + return n && n.length ? jr(n, ye(t, 3), true) : []
    + }),
    + (An.fill = function (n, t, r, e) {
    + var u = null == n ? 0 : n.length
    + if (!u) return []
    + for (
    + r && typeof r != "number" && Oe(n, t, r) && ((r = 0), (e = u)),
    + u = n.length,
    + r = Eu(r),
    + 0 > r && (r = -r > u ? 0 : u + r),
    + e = e === T || e > u ? u : Eu(e),
    + 0 > e && (e += u),
    + e = r > e ? 0 : ku(e);
    + r < e;
    +
    + )
    + n[r++] = t
    + return n
    + }),
    + (An.filter = function (n, t) {
    + return (ff(n) ? i : jt)(n, ye(t, 3))
    + }),
    + (An.flatMap = function (n, t) {
    + return wt(ru(n, t), 1)
    + }),
    + (An.flatMapDeep = function (n, t) {
    + return wt(ru(n, t), $)
    + }),
    + (An.flatMapDepth = function (n, t, r) {
    + return (r = r === T ? 1 : Eu(r)), wt(ru(n, t), r)
    + }),
    + (An.flatten = Ze),
    + (An.flattenDeep = function (n) {
    + return (null == n ? 0 : n.length) ? wt(n, $) : []
    + }),
    + (An.flattenDepth = function (n, t) {
    + return null != n && n.length ? ((t = t === T ? 1 : Eu(t)), wt(n, t)) : []
    + }),
    + (An.flip = function (n) {
    + return fe(n, 512)
    + }),
    + (An.flow = Pf),
    + (An.flowRight = Zf),
    + (An.fromPairs = function (n) {
    + for (var t = -1, r = null == n ? 0 : n.length, e = {}; ++t < r; ) {
    + var u = n[t]
    + e[u[0]] = u[1]
    + }
    + return e
    + }),
    + (An.functions = function (n) {
    + return null == n ? [] : Et(n, Wu(n))
    + }),
    + (An.functionsIn = function (n) {
    + return null == n ? [] : Et(n, Bu(n))
    + }),
    + (An.groupBy = Po),
    + (An.initial = function (n) {
    + return (null == n ? 0 : n.length) ? hr(n, 0, -1) : []
    + }),
    + (An.intersection = Eo),
    + (An.intersectionBy = ko),
    + (An.intersectionWith = So),
    + (An.invert = Af),
    + (An.invertBy = Ef),
    + (An.invokeMap = Zo),
    + (An.iteratee = Fu),
    + (An.keyBy = qo),
    + (An.keys = Wu),
    + (An.keysIn = Bu),
    + (An.map = ru),
    + (An.mapKeys = function (n, t) {
    + var r = {}
    + return (
    + (t = ye(t, 3)),
    + mt(n, function (n, e, u) {
    + st(r, t(n, e, u), n)
    + }),
    + r
    + )
    + }),
    + (An.mapValues = function (n, t) {
    + var r = {}
    + return (
    + (t = ye(t, 3)),
    + mt(n, function (n, e, u) {
    + st(r, e, t(n, e, u))
    + }),
    + r
    + )
    + }),
    + (An.matches = function (n) {
    + return Ht(_t(n, 1))
    + }),
    + (An.matchesProperty = function (n, t) {
    + return Jt(n, _t(t, 1))
    + }),
    + (An.memoize = cu),
    + (An.merge = Sf),
    + (An.mergeWith = Of),
    + (An.method = qf),
    + (An.methodOf = Vf),
    + (An.mixin = Nu),
    + (An.negate = au),
    + (An.nthArg = function (n) {
    + return (
    + (n = Eu(n)),
    + fr(function (t) {
    + return Qt(t, n)
    + })
    + )
    + }),
    + (An.omit = If),
    + (An.omitBy = function (n, t) {
    + return Lu(n, au(ye(t)))
    + }),
    + (An.once = function (n) {
    + return uu(2, n)
    + }),
    + (An.orderBy = function (n, t, r, e) {
    + return null == n ? [] : (ff(t) || (t = null == t ? [] : [t]), (r = e ? T : r), ff(r) || (r = null == r ? [] : [r]), Xt(n, t, r))
    + }),
    + (An.over = Kf),
    + (An.overArgs = Xo),
    + (An.overEvery = Gf),
    + (An.overSome = Hf),
    + (An.partial = nf),
    + (An.partialRight = tf),
    + (An.partition = Vo),
    + (An.pick = Rf),
    + (An.pickBy = Lu),
    + (An.property = Zu),
    + (An.propertyOf = function (n) {
    + return function (t) {
    + return null == n ? T : kt(n, t)
    + }
    + }),
    + (An.pull = Oo),
    + (An.pullAll = Ke),
    + (An.pullAllBy = function (n, t, r) {
    + return n && n.length && t && t.length ? er(n, t, ye(r, 2)) : n
    + }),
    + (An.pullAllWith = function (n, t, r) {
    + return n && n.length && t && t.length ? er(n, t, T, r) : n
    + }),
    + (An.pullAt = Io),
    + (An.range = Jf),
    + (An.rangeRight = Yf),
    + (An.rearg = rf),
    + (An.reject = function (n, t) {
    + return (ff(n) ? i : jt)(n, au(ye(t, 3)))
    + }),
    + (An.remove = function (n, t) {
    + var r = []
    + if (!n || !n.length) return r
    + var e = -1,
    + u = [],
    + i = n.length
    + for (t = ye(t, 3); ++e < i; ) {
    + var o = n[e]
    + t(o, e, n) && (r.push(o), u.push(e))
    + }
    + return ur(n, u), r
    + }),
    + (An.rest = function (n, t) {
    + if (typeof n != "function") throw new ti("Expected a function")
    + return (t = t === T ? t : Eu(t)), fr(n, t)
    + }),
    + (An.reverse = Ge),
    + (An.sampleSize = function (n, t, r) {
    + return (t = (r ? Oe(n, t, r) : t === T) ? 1 : Eu(t)), (ff(n) ? et : ar)(n, t)
    + }),
    + (An.set = function (n, t, r) {
    + return null == n ? n : lr(n, t, r)
    + }),
    + (An.setWith = function (n, t, r, e) {
    + return (e = typeof e == "function" ? e : T), null == n ? n : lr(n, t, r, e)
    + }),
    + (An.shuffle = function (n) {
    + return (ff(n) ? ut : sr)(n)
    + }),
    + (An.slice = function (n, t, r) {
    + var e = null == n ? 0 : n.length
    + return e ? (r && typeof r != "number" && Oe(n, t, r) ? ((t = 0), (r = e)) : ((t = null == t ? 0 : Eu(t)), (r = r === T ? e : Eu(r))), hr(n, t, r)) : []
    + }),
    + (An.sortBy = Ko),
    + (An.sortedUniq = function (n) {
    + return n && n.length ? gr(n) : []
    + }),
    + (An.sortedUniqBy = function (n, t) {
    + return n && n.length ? gr(n, ye(t, 2)) : []
    + }),
    + (An.split = function (n, t, r) {
    + return (
    + r && typeof r != "number" && Oe(n, t, r) && (t = r = T),
    + (r = r === T ? 4294967295 : r >>> 0),
    + r ? ((n = Iu(n)) && (typeof t == "string" || (null != t && !hf(t))) && ((t = yr(t)), !t && Rn.test(n)) ? Or(M(n), 0, r) : n.split(t, r)) : []
    + )
    + }),
    + (An.spread = function (t, r) {
    + if (typeof t != "function") throw new ti("Expected a function")
    + return (
    + (r = null == r ? 0 : Ui(Eu(r), 0)),
    + fr(function (e) {
    + var u = e[r]
    + return (e = Or(e, 0, r)), u && a(e, u), n(t, this, e)
    + })
    + )
    + }),
    + (An.tail = function (n) {
    + var t = null == n ? 0 : n.length
    + return t ? hr(n, 1, t) : []
    + }),
    + (An.take = function (n, t, r) {
    + return n && n.length ? ((t = r || t === T ? 1 : Eu(t)), hr(n, 0, 0 > t ? 0 : t)) : []
    + }),
    + (An.takeRight = function (n, t, r) {
    + var e = null == n ? 0 : n.length
    + return e ? ((t = r || t === T ? 1 : Eu(t)), (t = e - t), hr(n, 0 > t ? 0 : t, e)) : []
    + }),
    + (An.takeRightWhile = function (n, t) {
    + return n && n.length ? jr(n, ye(t, 3), false, true) : []
    + }),
    + (An.takeWhile = function (n, t) {
    + return n && n.length ? jr(n, ye(t, 3)) : []
    + }),
    + (An.tap = function (n, t) {
    + return t(n), n
    + }),
    + (An.throttle = function (n, t, r) {
    + var e = true,
    + u = true
    + if (typeof n != "function") throw new ti("Expected a function")
    + return du(r) && ((e = "leading" in r ? !!r.leading : e), (u = "trailing" in r ? !!r.trailing : u)), fu(n, t, { leading: e, maxWait: t, trailing: u })
    + }),
    + (An.thru = Qe),
    + (An.toArray = mu),
    + (An.toPairs = zf),
    + (An.toPairsIn = Wf),
    + (An.toPath = function (n) {
    + return ff(n) ? c(n, Me) : wu(n) ? [n] : Ur(jo(Iu(n)))
    + }),
    + (An.toPlainObject = Ou),
    + (An.transform = function (n, t, e) {
    + var u = ff(n),
    + i = u || af(n) || _f(n)
    + if (((t = ye(t, 4)), null == e)) {
    + var o = n && n.constructor
    + e = i ? (u ? new o() : []) : du(n) && _u(o) ? eo(di(n)) : {}
    + }
    + return (
    + (i ? r : mt)(n, function (n, r, u) {
    + return t(e, n, r, u)
    + }),
    + e
    + )
    + }),
    + (An.unary = function (n) {
    + return eu(n, 1)
    + }),
    + (An.union = Ro),
    + (An.unionBy = zo),
    + (An.unionWith = Wo),
    + (An.uniq = function (n) {
    + return n && n.length ? br(n) : []
    + }),
    + (An.uniqBy = function (n, t) {
    + return n && n.length ? br(n, ye(t, 2)) : []
    + }),
    + (An.uniqWith = function (n, t) {
    + return (t = typeof t == "function" ? t : T), n && n.length ? br(n, T, t) : []
    + }),
    + (An.unset = function (n, t) {
    + return null == n || xr(n, t)
    + }),
    + (An.unzip = He),
    + (An.unzipWith = Je),
    + (An.update = function (n, t, r) {
    + return null == n ? n : lr(n, t, kr(r)(kt(n, t)), void 0)
    + }),
    + (An.updateWith = function (n, t, r, e) {
    + return (e = typeof e == "function" ? e : T), null != n && (n = lr(n, t, kr(r)(kt(n, t)), e)), n
    + }),
    + (An.values = Uu),
    + (An.valuesIn = function (n) {
    + return null == n ? [] : S(n, Bu(n))
    + }),
    + (An.without = Bo),
    + (An.words = Mu),
    + (An.wrap = function (n, t) {
    + return nf(kr(t), n)
    + }),
    + (An.xor = Lo),
    + (An.xorBy = Uo),
    + (An.xorWith = Co),
    + (An.zip = Do),
    + (An.zipObject = function (n, t) {
    + return Ar(n || [], t || [], ot)
    + }),
    + (An.zipObjectDeep = function (n, t) {
    + return Ar(n || [], t || [], lr)
    + }),
    + (An.zipWith = Mo),
    + (An.entries = zf),
    + (An.entriesIn = Wf),
    + (An.extend = yf),
    + (An.extendWith = bf),
    + Nu(An, An),
    + (An.add = Qf),
    + (An.attempt = Ff),
    + (An.camelCase = Bf),
    + (An.capitalize = Cu),
    + (An.ceil = Xf),
    + (An.clamp = function (n, t, r) {
    + return r === T && ((r = t), (t = T)), r !== T && ((r = Su(r)), (r = r === r ? r : 0)), t !== T && ((t = Su(t)), (t = t === t ? t : 0)), pt(Su(n), t, r)
    + }),
    + (An.clone = function (n) {
    + return _t(n, 4)
    + }),
    + (An.cloneDeep = function (n) {
    + return _t(n, 5)
    + }),
    + (An.cloneDeepWith = function (n, t) {
    + return (t = typeof t == "function" ? t : T), _t(n, 5, t)
    + }),
    + (An.cloneWith = function (n, t) {
    + return (t = typeof t == "function" ? t : T), _t(n, 4, t)
    + }),
    + (An.conformsTo = function (n, t) {
    + return null == t || gt(n, t, Wu(t))
    + }),
    + (An.deburr = Du),
    + (An.defaultTo = function (n, t) {
    + return null == n || n !== n ? t : n
    + }),
    + (An.divide = nc),
    + (An.endsWith = function (n, t, r) {
    + ;(n = Iu(n)), (t = yr(t))
    + var e = n.length,
    + e = (r = r === T ? e : pt(Eu(r), 0, e))
    + return (r -= t.length), 0 <= r && n.slice(r, e) == t
    + }),
    + (An.eq = lu),
    + (An.escape = function (n) {
    + return (n = Iu(n)) && H.test(n) ? n.replace(K, nt) : n
    + }),
    + (An.escapeRegExp = function (n) {
    + return (n = Iu(n)) && en.test(n) ? n.replace(rn, "\\$&") : n
    + }),
    + (An.every = function (n, t, r) {
    + var e = ff(n) ? u : bt
    + return r && Oe(n, t, r) && (t = T), e(n, ye(t, 3))
    + }),
    + (An.find = Fo),
    + (An.findIndex = Ne),
    + (An.findKey = function (n, t) {
    + return p(n, ye(t, 3), mt)
    + }),
    + (An.findLast = No),
    + (An.findLastIndex = Pe),
    + (An.findLastKey = function (n, t) {
    + return p(n, ye(t, 3), At)
    + }),
    + (An.floor = tc),
    + (An.forEach = nu),
    + (An.forEachRight = tu),
    + (An.forIn = function (n, t) {
    + return null == n ? n : oo(n, ye(t, 3), Bu)
    + }),
    + (An.forInRight = function (n, t) {
    + return null == n ? n : fo(n, ye(t, 3), Bu)
    + }),
    + (An.forOwn = function (n, t) {
    + return n && mt(n, ye(t, 3))
    + }),
    + (An.forOwnRight = function (n, t) {
    + return n && At(n, ye(t, 3))
    + }),
    + (An.get = Ru),
    + (An.gt = ef),
    + (An.gte = uf),
    + (An.has = function (n, t) {
    + return null != n && we(n, t, Rt)
    + }),
    + (An.hasIn = zu),
    + (An.head = qe),
    + (An.identity = $u),
    + (An.includes = function (n, t, r, e) {
    + return (n = su(n) ? n : Uu(n)), (r = r && !e ? Eu(r) : 0), (e = n.length), 0 > r && (r = Ui(e + r, 0)), ju(n) ? r <= e && -1 < n.indexOf(t, r) : !!e && -1 < v(n, t, r)
    + }),
    + (An.indexOf = function (n, t, r) {
    + var e = null == n ? 0 : n.length
    + return e ? ((r = null == r ? 0 : Eu(r)), 0 > r && (r = Ui(e + r, 0)), v(n, t, r)) : -1
    + }),
    + (An.inRange = function (n, t, r) {
    + return (t = Au(t)), r === T ? ((r = t), (t = 0)) : (r = Au(r)), (n = Su(n)), n >= Ci(t, r) && n < Ui(t, r)
    + }),
    + (An.invoke = kf),
    + (An.isArguments = of),
    + (An.isArray = ff),
    + (An.isArrayBuffer = cf),
    + (An.isArrayLike = su),
    + (An.isArrayLikeObject = hu),
    + (An.isBoolean = function (n) {
    + return true === n || false === n || (yu(n) && "[object Boolean]" == Ot(n))
    + }),
    + (An.isBuffer = af),
    + (An.isDate = lf),
    + (An.isElement = function (n) {
    + return yu(n) && 1 === n.nodeType && !xu(n)
    + }),
    + (An.isEmpty = function (n) {
    + if (null == n) return true
    + if (su(n) && (ff(n) || typeof n == "string" || typeof n.splice == "function" || af(n) || _f(n) || of(n))) return !n.length
    + var t = vo(n)
    + if ("[object Map]" == t || "[object Set]" == t) return !n.size
    + if (ze(n)) return !Vt(n).length
    + for (var r in n) if (oi.call(n, r)) return false
    + return true
    + }),
    + (An.isEqual = function (n, t) {
    + return Mt(n, t)
    + }),
    + (An.isEqualWith = function (n, t, r) {
    + var e = (r = typeof r == "function" ? r : T) ? r(n, t) : T
    + return e === T ? Mt(n, t, T, r) : !!e
    + }),
    + (An.isError = pu),
    + (An.isFinite = function (n) {
    + return typeof n == "number" && Wi(n)
    + }),
    + (An.isFunction = _u),
    + (An.isInteger = vu),
    + (An.isLength = gu),
    + (An.isMap = sf),
    + (An.isMatch = function (n, t) {
    + return n === t || $t(n, t, xe(t))
    + }),
    + (An.isMatchWith = function (n, t, r) {
    + return (r = typeof r == "function" ? r : T), $t(n, t, xe(t), r)
    + }),
    + (An.isNaN = function (n) {
    + return bu(n) && n != +n
    + }),
    + (An.isNative = function (n) {
    + if (go(n)) throw new Hu("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.")
    + return Ft(n)
    + }),
    + (An.isNil = function (n) {
    + return null == n
    + }),
    + (An.isNull = function (n) {
    + return null === n
    + }),
    + (An.isNumber = bu),
    + (An.isObject = du),
    + (An.isObjectLike = yu),
    + (An.isPlainObject = xu),
    + (An.isRegExp = hf),
    + (An.isSafeInteger = function (n) {
    + return vu(n) && -9007199254740991 <= n && 9007199254740991 >= n
    + }),
    + (An.isSet = pf),
    + (An.isString = ju),
    + (An.isSymbol = wu),
    + (An.isTypedArray = _f),
    + (An.isUndefined = function (n) {
    + return n === T
    + }),
    + (An.isWeakMap = function (n) {
    + return yu(n) && "[object WeakMap]" == vo(n)
    + }),
    + (An.isWeakSet = function (n) {
    + return yu(n) && "[object WeakSet]" == Ot(n)
    + }),
    + (An.join = function (n, t) {
    + return null == n ? "" : Bi.call(n, t)
    + }),
    + (An.kebabCase = Lf),
    + (An.last = Ve),
    + (An.lastIndexOf = function (n, t, r) {
    + var e = null == n ? 0 : n.length
    + if (!e) return -1
    + var u = e
    + if ((r !== T && ((u = Eu(r)), (u = 0 > u ? Ui(e + u, 0) : Ci(u, e - 1))), t === t)) {
    + for (r = u + 1; r-- && n[r] !== t; );
    + n = r
    + } else n = _(n, d, u, true)
    + return n
    + }),
    + (An.lowerCase = Uf),
    + (An.lowerFirst = Cf),
    + (An.lt = vf),
    + (An.lte = gf),
    + (An.max = function (n) {
    + return n && n.length ? xt(n, $u, It) : T
    + }),
    + (An.maxBy = function (n, t) {
    + return n && n.length ? xt(n, ye(t, 2), It) : T
    + }),
    + (An.mean = function (n) {
    + return y(n, $u)
    + }),
    + (An.meanBy = function (n, t) {
    + return y(n, ye(t, 2))
    + }),
    + (An.min = function (n) {
    + return n && n.length ? xt(n, $u, Kt) : T
    + }),
    + (An.minBy = function (n, t) {
    + return n && n.length ? xt(n, ye(t, 2), Kt) : T
    + }),
    + (An.stubArray = qu),
    + (An.stubFalse = Vu),
    + (An.stubObject = function () {
    + return {}
    + }),
    + (An.stubString = function () {
    + return ""
    + }),
    + (An.stubTrue = function () {
    + return true
    + }),
    + (An.multiply = rc),
    + (An.nth = function (n, t) {
    + return n && n.length ? Qt(n, Eu(t)) : T
    + }),
    + (An.noConflict = function () {
    + return $n._ === this && ($n._ = si), this
    + }),
    + (An.noop = Pu),
    + (An.now = Go),
    + (An.pad = function (n, t, r) {
    + n = Iu(n)
    + var e = (t = Eu(t)) ? D(n) : 0
    + return !t || e >= t ? n : ((t = (t - e) / 2), ne(Ii(t), r) + n + ne(Oi(t), r))
    + }),
    + (An.padEnd = function (n, t, r) {
    + n = Iu(n)
    + var e = (t = Eu(t)) ? D(n) : 0
    + return t && e < t ? n + ne(t - e, r) : n
    + }),
    + (An.padStart = function (n, t, r) {
    + n = Iu(n)
    + var e = (t = Eu(t)) ? D(n) : 0
    + return t && e < t ? ne(t - e, r) + n : n
    + }),
    + (An.parseInt = function (n, t, r) {
    + return r || null == t ? (t = 0) : t && (t = +t), Mi(Iu(n).replace(on, ""), t || 0)
    + }),
    + (An.random = function (n, t, r) {
    + if (
    + (r && typeof r != "boolean" && Oe(n, t, r) && (t = r = T),
    + r === T && (typeof t == "boolean" ? ((r = t), (t = T)) : typeof n == "boolean" && ((r = n), (n = T))),
    + n === T && t === T ? ((n = 0), (t = 1)) : ((n = Au(n)), t === T ? ((t = n), (n = 0)) : (t = Au(t))),
    + n > t)
    + ) {
    + var e = n
    + ;(n = t), (t = e)
    + }
    + return r || n % 1 || t % 1 ? ((r = Ti()), Ci(n + r * (t - n + Cn("1e-" + ((r + "").length - 1))), t)) : ir(n, t)
    + }),
    + (An.reduce = function (n, t, r) {
    + var e = ff(n) ? l : j,
    + u = 3 > arguments.length
    + return e(n, ye(t, 4), r, u, uo)
    + }),
    + (An.reduceRight = function (n, t, r) {
    + var e = ff(n) ? s : j,
    + u = 3 > arguments.length
    + return e(n, ye(t, 4), r, u, io)
    + }),
    + (An.repeat = function (n, t, r) {
    + return (t = (r ? Oe(n, t, r) : t === T) ? 1 : Eu(t)), or(Iu(n), t)
    + }),
    + (An.replace = function () {
    + var n = arguments,
    + t = Iu(n[0])
    + return 3 > n.length ? t : t.replace(n[1], n[2])
    + }),
    + (An.result = function (n, t, r) {
    + t = Sr(t, n)
    + var e = -1,
    + u = t.length
    + for (u || ((u = 1), (n = T)); ++e < u; ) {
    + var i = null == n ? T : n[Me(t[e])]
    + i === T && ((e = u), (i = r)), (n = _u(i) ? i.call(n) : i)
    + }
    + return n
    + }),
    + (An.round = ec),
    + (An.runInContext = x),
    + (An.sample = function (n) {
    + return (ff(n) ? Qn : cr)(n)
    + }),
    + (An.size = function (n) {
    + if (null == n) return 0
    + if (su(n)) return ju(n) ? D(n) : n.length
    + var t = vo(n)
    + return "[object Map]" == t || "[object Set]" == t ? n.size : Vt(n).length
    + }),
    + (An.snakeCase = Df),
    + (An.some = function (n, t, r) {
    + var e = ff(n) ? h : pr
    + return r && Oe(n, t, r) && (t = T), e(n, ye(t, 3))
    + }),
    + (An.sortedIndex = function (n, t) {
    + return _r(n, t)
    + }),
    + (An.sortedIndexBy = function (n, t, r) {
    + return vr(n, t, ye(r, 2))
    + }),
    + (An.sortedIndexOf = function (n, t) {
    + var r = null == n ? 0 : n.length
    + if (r) {
    + var e = _r(n, t)
    + if (e < r && lu(n[e], t)) return e
    + }
    + return -1
    + }),
    + (An.sortedLastIndex = function (n, t) {
    + return _r(n, t, true)
    + }),
    + (An.sortedLastIndexBy = function (n, t, r) {
    + return vr(n, t, ye(r, 2), true)
    + }),
    + (An.sortedLastIndexOf = function (n, t) {
    + if (null == n ? 0 : n.length) {
    + var r = _r(n, t, true) - 1
    + if (lu(n[r], t)) return r
    + }
    + return -1
    + }),
    + (An.startCase = Mf),
    + (An.startsWith = function (n, t, r) {
    + return (n = Iu(n)), (r = null == r ? 0 : pt(Eu(r), 0, n.length)), (t = yr(t)), n.slice(r, r + t.length) == t
    + }),
    + (An.subtract = uc),
    + (An.sum = function (n) {
    + return n && n.length ? m(n, $u) : 0
    + }),
    + (An.sumBy = function (n, t) {
    + return n && n.length ? m(n, ye(t, 2)) : 0
    + }),
    + (An.template = function (n, t, r) {
    + var e = An.templateSettings
    + r && Oe(n, t, r) && (t = T), (n = Iu(n)), (t = bf({}, t, e, ce)), (r = bf({}, t.imports, e.imports, ce))
    + var u,
    + i,
    + o = Wu(r),
    + f = S(r, o),
    + c = 0
    + r = t.interpolate || jn
    + var a = "__p+='"
    + r = Xu((t.escape || jn).source + "|" + r.source + "|" + (r === Q ? pn : jn).source + "|" + (t.evaluate || jn).source + "|$", "g")
    + var l = oi.call(t, "sourceURL") ? "//# sourceURL=" + (t.sourceURL + "").replace(/[\r\n]/g, " ") + "\n" : ""
    + if (
    + (n.replace(r, function (t, r, e, o, f, l) {
    + return (
    + e || (e = o),
    + (a += n.slice(c, l).replace(wn, z)),
    + r && ((u = true), (a += "'+__e(" + r + ")+'")),
    + f && ((i = true), (a += "';" + f + ";\n__p+='")),
    + e && (a += "'+((__t=(" + e + "))==null?'':__t)+'"),
    + (c = l + t.length),
    + t
    + )
    + }),
    + (a += "';"),
    + (t = oi.call(t, "variable") && t.variable) || (a = "with(obj){" + a + "}"),
    + (a = (i ? a.replace(P, "") : a).replace(Z, "$1").replace(q, "$1;")),
    + (a =
    + "function(" +
    + (t || "obj") +
    + "){" +
    + (t ? "" : "obj||(obj={});") +
    + "var __t,__p=''" +
    + (u ? ",__e=_.escape" : "") +
    + (i ? ",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}" : ";") +
    + a +
    + "return __p}"),
    + (t = Ff(function () {
    + return Ju(o, l + "return " + a).apply(T, f)
    + })),
    + (t.source = a),
    + pu(t))
    + )
    + throw t
    + return t
    + }),
    + (An.times = function (n, t) {
    + if (((n = Eu(n)), 1 > n || 9007199254740991 < n)) return []
    + var r = 4294967295,
    + e = Ci(n, 4294967295)
    + for (t = ye(t), n -= 4294967295, e = A(e, t); ++r < n; ) t(r)
    + return e
    + }),
    + (An.toFinite = Au),
    + (An.toInteger = Eu),
    + (An.toLength = ku),
    + (An.toLower = function (n) {
    + return Iu(n).toLowerCase()
    + }),
    + (An.toNumber = Su),
    + (An.toSafeInteger = function (n) {
    + return n ? pt(Eu(n), -9007199254740991, 9007199254740991) : 0 === n ? n : 0
    + }),
    + (An.toString = Iu),
    + (An.toUpper = function (n) {
    + return Iu(n).toUpperCase()
    + }),
    + (An.trim = function (n, t, r) {
    + return (n = Iu(n)) && (r || t === T) ? n.replace(un, "") : n && (t = yr(t)) ? ((n = M(n)), (r = M(t)), (t = I(n, r)), (r = R(n, r) + 1), Or(n, t, r).join("")) : n
    + }),
    + (An.trimEnd = function (n, t, r) {
    + return (n = Iu(n)) && (r || t === T) ? n.replace(fn, "") : n && (t = yr(t)) ? ((n = M(n)), (t = R(n, M(t)) + 1), Or(n, 0, t).join("")) : n
    + }),
    + (An.trimStart = function (n, t, r) {
    + return (n = Iu(n)) && (r || t === T) ? n.replace(on, "") : n && (t = yr(t)) ? ((n = M(n)), (t = I(n, M(t))), Or(n, t).join("")) : n
    + }),
    + (An.truncate = function (n, t) {
    + var r = 30,
    + e = "..."
    + if (du(t))
    + var u = "separator" in t ? t.separator : u,
    + r = "length" in t ? Eu(t.length) : r,
    + e = "omission" in t ? yr(t.omission) : e
    + n = Iu(n)
    + var i = n.length
    + if (Rn.test(n))
    + var o = M(n),
    + i = o.length
    + if (r >= i) return n
    + if (((i = r - D(e)), 1 > i)) return e
    + if (((r = o ? Or(o, 0, i).join("") : n.slice(0, i)), u === T)) return r + e
    + if ((o && (i += r.length - i), hf(u))) {
    + if (n.slice(i).search(u)) {
    + var f = r
    + for (u.global || (u = Xu(u.source, Iu(_n.exec(u)) + "g")), u.lastIndex = 0; (o = u.exec(f)); ) var c = o.index
    + r = r.slice(0, c === T ? i : c)
    + }
    + } else n.indexOf(yr(u), i) != i && ((u = r.lastIndexOf(u)), -1 < u && (r = r.slice(0, u)))
    + return r + e
    + }),
    + (An.unescape = function (n) {
    + return (n = Iu(n)) && G.test(n) ? n.replace(V, tt) : n
    + }),
    + (An.uniqueId = function (n) {
    + var t = ++fi
    + return Iu(n) + t
    + }),
    + (An.upperCase = Tf),
    + (An.upperFirst = $f),
    + (An.each = nu),
    + (An.eachRight = tu),
    + (An.first = qe),
    + Nu(
    + An,
    + (function () {
    + var n = {}
    + return (
    + mt(An, function (t, r) {
    + oi.call(An.prototype, r) || (n[r] = t)
    + }),
    + n
    + )
    + })(),
    + { chain: false }
    + ),
    + (An.VERSION = "4.17.15"),
    + r("bind bindKey curry curryRight partial partialRight".split(" "), function (n) {
    + An[n].placeholder = An
    + }),
    + r(["drop", "take"], function (n, t) {
    + ;(Un.prototype[n] = function (r) {
    + r = r === T ? 1 : Ui(Eu(r), 0)
    + var e = this.__filtered__ && !t ? new Un(this) : this.clone()
    + return e.__filtered__ ? (e.__takeCount__ = Ci(r, e.__takeCount__)) : e.__views__.push({ size: Ci(r, 4294967295), type: n + (0 > e.__dir__ ? "Right" : "") }), e
    + }),
    + (Un.prototype[n + "Right"] = function (t) {
    + return this.reverse()[n](t).reverse()
    + })
    + }),
    + r(["filter", "map", "takeWhile"], function (n, t) {
    + var r = t + 1,
    + e = 1 == r || 3 == r
    + Un.prototype[n] = function (n) {
    + var t = this.clone()
    + return t.__iteratees__.push({ iteratee: ye(n, 3), type: r }), (t.__filtered__ = t.__filtered__ || e), t
    + }
    + }),
    + r(["head", "last"], function (n, t) {
    + var r = "take" + (t ? "Right" : "")
    + Un.prototype[n] = function () {
    + return this[r](1).value()[0]
    + }
    + }),
    + r(["initial", "tail"], function (n, t) {
    + var r = "drop" + (t ? "" : "Right")
    + Un.prototype[n] = function () {
    + return this.__filtered__ ? new Un(this) : this[r](1)
    + }
    + }),
    + (Un.prototype.compact = function () {
    + return this.filter($u)
    + }),
    + (Un.prototype.find = function (n) {
    + return this.filter(n).head()
    + }),
    + (Un.prototype.findLast = function (n) {
    + return this.reverse().find(n)
    + }),
    + (Un.prototype.invokeMap = fr(function (n, t) {
    + return typeof n == "function"
    + ? new Un(this)
    + : this.map(function (r) {
    + return Lt(r, n, t)
    + })
    + })),
    + (Un.prototype.reject = function (n) {
    + return this.filter(au(ye(n)))
    + }),
    + (Un.prototype.slice = function (n, t) {
    + n = Eu(n)
    + var r = this
    + return r.__filtered__ && (0 < n || 0 > t)
    + ? new Un(r)
    + : (0 > n ? (r = r.takeRight(-n)) : n && (r = r.drop(n)), t !== T && ((t = Eu(t)), (r = 0 > t ? r.dropRight(-t) : r.take(t - n))), r)
    + }),
    + (Un.prototype.takeRightWhile = function (n) {
    + return this.reverse().takeWhile(n).reverse()
    + }),
    + (Un.prototype.toArray = function () {
    + return this.take(4294967295)
    + }),
    + mt(Un.prototype, function (n, t) {
    + var r = /^(?:filter|find|map|reject)|While$/.test(t),
    + e = /^(?:head|last)$/.test(t),
    + u = An[e ? "take" + ("last" == t ? "Right" : "") : t],
    + i = e || /^find/.test(t)
    + u &&
    + (An.prototype[t] = function () {
    + function t(n) {
    + return (n = u.apply(An, a([n], f))), e && h ? n[0] : n
    + }
    + var o = this.__wrapped__,
    + f = e ? [1] : arguments,
    + c = o instanceof Un,
    + l = f[0],
    + s = c || ff(o)
    + s && r && typeof l == "function" && 1 != l.length && (c = s = false)
    + var h = this.__chain__,
    + p = !!this.__actions__.length,
    + l = i && !h,
    + c = c && !p
    + return !i && s
    + ? ((o = c ? o : new Un(this)), (o = n.apply(o, f)), o.__actions__.push({ func: Qe, args: [t], thisArg: T }), new On(o, h))
    + : l && c
    + ? n.apply(this, f)
    + : ((o = this.thru(t)), l ? (e ? o.value()[0] : o.value()) : o)
    + })
    + }),
    + r("pop push shift sort splice unshift".split(" "), function (n) {
    + var t = ri[n],
    + r = /^(?:push|sort|unshift)$/.test(n) ? "tap" : "thru",
    + e = /^(?:pop|shift)$/.test(n)
    + An.prototype[n] = function () {
    + var n = arguments
    + if (e && !this.__chain__) {
    + var u = this.value()
    + return t.apply(ff(u) ? u : [], n)
    + }
    + return this[r](function (r) {
    + return t.apply(ff(r) ? r : [], n)
    + })
    + }
    + }),
    + mt(Un.prototype, function (n, t) {
    + var r = An[t]
    + if (r) {
    + var e = r.name + ""
    + oi.call(Gi, e) || (Gi[e] = []), Gi[e].push({ name: t, func: r })
    + }
    + }),
    + (Gi[Jr(T, 2).name] = [{ name: "wrapper", func: T }]),
    + (Un.prototype.clone = function () {
    + var n = new Un(this.__wrapped__)
    + return (
    + (n.__actions__ = Ur(this.__actions__)),
    + (n.__dir__ = this.__dir__),
    + (n.__filtered__ = this.__filtered__),
    + (n.__iteratees__ = Ur(this.__iteratees__)),
    + (n.__takeCount__ = this.__takeCount__),
    + (n.__views__ = Ur(this.__views__)),
    + n
    + )
    + }),
    + (Un.prototype.reverse = function () {
    + if (this.__filtered__) {
    + var n = new Un(this)
    + ;(n.__dir__ = -1), (n.__filtered__ = true)
    + } else (n = this.clone()), (n.__dir__ *= -1)
    + return n
    + }),
    + (Un.prototype.value = function () {
    + var n,
    + t = this.__wrapped__.value(),
    + r = this.__dir__,
    + e = ff(t),
    + u = 0 > r,
    + i = e ? t.length : 0
    + n = i
    + for (var o = this.__views__, f = 0, c = -1, a = o.length; ++c < a; ) {
    + var l = o[c],
    + s = l.size
    + switch (l.type) {
    + case "drop":
    + f += s
    + break
    + case "dropRight":
    + n -= s
    + break
    + case "take":
    + n = Ci(n, f + s)
    + break
    + case "takeRight":
    + f = Ui(f, n - s)
    + }
    + }
    + if (
    + ((n = { start: f, end: n }),
    + (o = n.start),
    + (f = n.end),
    + (n = f - o),
    + (o = u ? f : o - 1),
    + (f = this.__iteratees__),
    + (c = f.length),
    + (a = 0),
    + (l = Ci(n, this.__takeCount__)),
    + !e || (!u && i == n && l == n))
    + )
    + return wr(t, this.__actions__)
    + e = []
    + n: for (; n-- && a < l; ) {
    + for (o += r, u = -1, i = t[o]; ++u < c; ) {
    + var h = f[u],
    + s = h.type,
    + h = (0, h.iteratee)(i)
    + if (2 == s) i = h
    + else if (!h) {
    + if (1 == s) continue n
    + break n
    + }
    + }
    + e[a++] = i
    + }
    + return e
    + }),
    + (An.prototype.at = To),
    + (An.prototype.chain = function () {
    + return Ye(this)
    + }),
    + (An.prototype.commit = function () {
    + return new On(this.value(), this.__chain__)
    + }),
    + (An.prototype.next = function () {
    + this.__values__ === T && (this.__values__ = mu(this.value()))
    + var n = this.__index__ >= this.__values__.length
    + return { done: n, value: n ? T : this.__values__[this.__index__++] }
    + }),
    + (An.prototype.plant = function (n) {
    + for (var t, r = this; r instanceof En; ) {
    + var e = Fe(r)
    + ;(e.__index__ = 0), (e.__values__ = T), t ? (u.__wrapped__ = e) : (t = e)
    + var u = e,
    + r = r.__wrapped__
    + }
    + return (u.__wrapped__ = n), t
    + }),
    + (An.prototype.reverse = function () {
    + var n = this.__wrapped__
    + return n instanceof Un
    + ? (this.__actions__.length && (n = new Un(this)), (n = n.reverse()), n.__actions__.push({ func: Qe, args: [Ge], thisArg: T }), new On(n, this.__chain__))
    + : this.thru(Ge)
    + }),
    + (An.prototype.toJSON =
    + An.prototype.valueOf =
    + An.prototype.value =
    + function () {
    + return wr(this.__wrapped__, this.__actions__)
    + }),
    + (An.prototype.first = An.prototype.head),
    + wi && (An.prototype[wi] = Xe),
    + An
    + )
    + })()
    + typeof define == "function" && typeof define.amd == "object" && define.amd
    + ? (($n._ = rt),
    + define(function () {
    + return rt
    + }))
    + : Nn
    + ? (((Nn.exports = rt)._ = rt), (Fn._ = rt))
    + : ($n._ = rt)
    + }).call(this)
    - !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.store=e()}}(function(){return function e(t,n,r){function o(a,u){if(!n[a]){if(!t[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[a]={exports:{}};t[a][0].call(f.exports,function(e){var n=t[a][1][e];return o(n?n:e)},f,f.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a=0;n--)if(l(t[n])){var r=t[n].split("="),o=unescape(r[0]),i=unescape(r[1]);e(i,o)}}function i(e,t){e&&(p.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")}function a(e){e&&s(e)&&(p.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function u(){o(function(e,t){a(t)})}function s(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(p.cookie)}var c=e("../src/util"),f=c.Global,l=c.trim;t.exports={name:"cookieStorage",read:r,write:i,each:o,remove:a,clearAll:u};var p=f.document},{"../src/util":3}],5:[function(e,t,n){"use strict";function r(){return f.localStorage}function o(e){return r().getItem(e)}function i(e,t){return r().setItem(e,t)}function a(e){for(var t=r().length-1;t>=0;t--){var n=r().key(t);e(o(n),n)}}function u(e){return r().removeItem(e)}function s(){return r().clear()}var c=e("../src/util"),f=c.Global;t.exports={name:"localStorage",read:o,write:i,each:a,remove:u,clearAll:s}},{"../src/util":3}],6:[function(e,t,n){"use strict";function r(e){return s[e]}function o(e,t){s[e]=t}function i(e){for(var t in s)s.hasOwnProperty(t)&&e(s[t],t)}function a(e){delete s[e]}function u(e){s={}}t.exports={name:"memoryStorage",read:r,write:o,each:i,remove:a,clearAll:u};var s={}},{}],7:[function(e,t,n){"use strict";function r(){return f.sessionStorage}function o(e){return r().getItem(e)}function i(e,t){return r().setItem(e,t)}function a(e){for(var t=r().length-1;t>=0;t--){var n=r().key(t);e(o(n),n)}}function u(e){return r().removeItem(e)}function s(){return r().clear()}var c=e("../src/util"),f=c.Global;t.exports={name:"sessionStorage",read:o,write:i,each:a,remove:u,clearAll:s}},{"../src/util":3}]},{},[1])(1)});;
    + !(function (e) {
    + if ("object" == typeof exports && "undefined" != typeof module) module.exports = e()
    + else if ("function" == typeof define && define.amd) define([], e)
    + else {
    + var t
    + ;(t = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this), (t.store = e())
    + }
    + })(function () {
    + return (function e(t, n, r) {
    + function o(a, u) {
    + if (!n[a]) {
    + if (!t[a]) {
    + var s = "function" == typeof require && require
    + if (!u && s) return s(a, !0)
    + if (i) return i(a, !0)
    + var c = new Error("Cannot find module '" + a + "'")
    + throw ((c.code = "MODULE_NOT_FOUND"), c)
    + }
    + var f = (n[a] = { exports: {} })
    + t[a][0].call(
    + f.exports,
    + function (e) {
    + var n = t[a][1][e]
    + return o(n ? n : e)
    + },
    + f,
    + f.exports,
    + e,
    + t,
    + n,
    + r
    + )
    + }
    + return n[a].exports
    + }
    + for (var i = "function" == typeof require && require, a = 0; a < r.length; a++) o(r[a])
    + return o
    + })(
    + {
    + 1: [
    + function (e, t, n) {
    + "use strict"
    + var r = e("../src/store-engine"),
    + o = [e("../storages/localStorage"), e("../storages/sessionStorage"), e("../storages/cookieStorage"), e("../storages/memoryStorage")],
    + i = []
    + t.exports = r.createStore(o, i)
    + },
    + { "../src/store-engine": 2, "../storages/cookieStorage": 4, "../storages/localStorage": 5, "../storages/memoryStorage": 6, "../storages/sessionStorage": 7 },
    + ],
    + 2: [
    + function (e, t, n) {
    + "use strict"
    + function r() {
    + var e = "undefined" == typeof console ? null : console
    + if (e) {
    + var t = e.warn ? e.warn : e.log
    + t.apply(e, arguments)
    + }
    + }
    + function o(e, t, n) {
    + n || (n = ""), e && !l(e) && (e = [e]), t && !l(t) && (t = [t])
    + var o = n ? "__storejs_" + n + "_" : "",
    + i = n ? new RegExp("^" + o) : null,
    + h = /^[a-zA-Z0-9_\-]*$/
    + if (!h.test(n)) throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes")
    + var v = {
    + _namespacePrefix: o,
    + _namespaceRegexp: i,
    + _testStorage: function (e) {
    + try {
    + var t = "__storejs__test__"
    + e.write(t, t)
    + var n = e.read(t) === t
    + return e.remove(t), n
    + } catch (r) {
    + return !1
    + }
    + },
    + _assignPluginFnProp: function (e, t) {
    + var n = this[t]
    + this[t] = function () {
    + function t() {
    + if (n)
    + return (
    + s(arguments, function (e, t) {
    + r[t] = e
    + }),
    + n.apply(o, r)
    + )
    + }
    + var r = a(arguments, 0),
    + o = this,
    + i = [t].concat(r)
    + return e.apply(o, i)
    + }
    + },
    + _serialize: function (e) {
    + return JSON.stringify(e)
    + },
    + _deserialize: function (e, t) {
    + if (!e) return t
    + var n = ""
    + try {
    + n = JSON.parse(e)
    + } catch (r) {
    + n = e
    + }
    + return void 0 !== n ? n : t
    + },
    + _addStorage: function (e) {
    + this.enabled || (this._testStorage(e) && ((this.storage = e), (this.enabled = !0)))
    + },
    + _addPlugin: function (e) {
    + var t = this
    + if (l(e))
    + return void s(e, function (e) {
    + t._addPlugin(e)
    + })
    + var n = u(this.plugins, function (t) {
    + return e === t
    + })
    + if (!n) {
    + if ((this.plugins.push(e), !p(e))) throw new Error("Plugins must be function values that return objects")
    + var r = e.call(this)
    + if (!g(r)) throw new Error("Plugins must return an object of function properties")
    + s(r, function (n, r) {
    + if (!p(n)) throw new Error("Bad plugin property: " + r + " from plugin " + e.name + ". Plugins should only return functions.")
    + t._assignPluginFnProp(n, r)
    + })
    + }
    + },
    + addStorage: function (e) {
    + r("store.addStorage(storage) is deprecated. Use createStore([storages])"), this._addStorage(e)
    + },
    + },
    + m = f(v, d, { plugins: [] })
    + return (
    + (m.raw = {}),
    + s(m, function (e, t) {
    + p(e) && (m.raw[t] = c(m, e))
    + }),
    + s(e, function (e) {
    + m._addStorage(e)
    + }),
    + s(t, function (e) {
    + m._addPlugin(e)
    + }),
    + m
    + )
    + }
    + var i = e("./util"),
    + a = i.slice,
    + u = i.pluck,
    + s = i.each,
    + c = i.bind,
    + f = i.create,
    + l = i.isList,
    + p = i.isFunction,
    + g = i.isObject
    + t.exports = { createStore: o }
    + var d = {
    + version: "2.0.12",
    + enabled: !1,
    + get: function (e, t) {
    + var n = this.storage.read(this._namespacePrefix + e)
    + return this._deserialize(n, t)
    + },
    + set: function (e, t) {
    + return void 0 === t ? this.remove(e) : (this.storage.write(this._namespacePrefix + e, this._serialize(t)), t)
    + },
    + remove: function (e) {
    + this.storage.remove(this._namespacePrefix + e)
    + },
    + each: function (e) {
    + var t = this
    + this.storage.each(function (n, r) {
    + e.call(t, t._deserialize(n), (r || "").replace(t._namespaceRegexp, ""))
    + })
    + },
    + clearAll: function () {
    + this.storage.clearAll()
    + },
    + hasNamespace: function (e) {
    + return this._namespacePrefix == "__storejs_" + e + "_"
    + },
    + createStore: function () {
    + return o.apply(this, arguments)
    + },
    + addPlugin: function (e) {
    + this._addPlugin(e)
    + },
    + namespace: function (e) {
    + return o(this.storage, this.plugins, e)
    + },
    + }
    + },
    + { "./util": 3 },
    + ],
    + 3: [
    + function (e, t, n) {
    + ;(function (e) {
    + "use strict"
    + function n() {
    + return Object.assign
    + ? Object.assign
    + : function (e, t, n, r) {
    + for (var o = 1; o < arguments.length; o++)
    + u(Object(arguments[o]), function (t, n) {
    + e[n] = t
    + })
    + return e
    + }
    + }
    + function r() {
    + if (Object.create)
    + return function (e, t, n, r) {
    + var o = a(arguments, 1)
    + return g.apply(this, [Object.create(e)].concat(o))
    + }
    + var e = function () {}
    + return function (t, n, r, o) {
    + var i = a(arguments, 1)
    + return (e.prototype = t), g.apply(this, [new e()].concat(i))
    + }
    + }
    + function o() {
    + return String.prototype.trim
    + ? function (e) {
    + return String.prototype.trim.call(e)
    + }
    + : function (e) {
    + return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "")
    + }
    + }
    + function i(e, t) {
    + return function () {
    + return t.apply(e, Array.prototype.slice.call(arguments, 0))
    + }
    + }
    + function a(e, t) {
    + return Array.prototype.slice.call(e, t || 0)
    + }
    + function u(e, t) {
    + c(e, function (e, n) {
    + return t(e, n), !1
    + })
    + }
    + function s(e, t) {
    + var n = f(e) ? [] : {}
    + return (
    + c(e, function (e, r) {
    + return (n[r] = t(e, r)), !1
    + }),
    + n
    + )
    + }
    + function c(e, t) {
    + if (f(e)) {
    + for (var n = 0; n < e.length; n++) if (t(e[n], n)) return e[n]
    + } else for (var r in e) if (e.hasOwnProperty(r) && t(e[r], r)) return e[r]
    + }
    + function f(e) {
    + return null != e && "function" != typeof e && "number" == typeof e.length
    + }
    + function l(e) {
    + return e && "[object Function]" === {}.toString.call(e)
    + }
    + function p(e) {
    + return e && "[object Object]" === {}.toString.call(e)
    + }
    + var g = n(),
    + d = r(),
    + h = o(),
    + v = "undefined" != typeof window ? window : e
    + t.exports = { assign: g, create: d, trim: h, bind: i, slice: a, each: u, map: s, pluck: c, isList: f, isFunction: l, isObject: p, Global: v }
    + }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
    + },
    + {},
    + ],
    + 4: [
    + function (e, t, n) {
    + "use strict"
    + function r(e) {
    + if (!e || !s(e)) return null
    + var t = "(?:^|.*;\\s*)" + escape(e).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*"
    + return unescape(p.cookie.replace(new RegExp(t), "$1"))
    + }
    + function o(e) {
    + for (var t = p.cookie.split(/; ?/g), n = t.length - 1; n >= 0; n--)
    + if (l(t[n])) {
    + var r = t[n].split("="),
    + o = unescape(r[0]),
    + i = unescape(r[1])
    + e(i, o)
    + }
    + }
    + function i(e, t) {
    + e && (p.cookie = escape(e) + "=" + escape(t) + "; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")
    + }
    + function a(e) {
    + e && s(e) && (p.cookie = escape(e) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")
    + }
    + function u() {
    + o(function (e, t) {
    + a(t)
    + })
    + }
    + function s(e) {
    + return new RegExp("(?:^|;\\s*)" + escape(e).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=").test(p.cookie)
    + }
    + var c = e("../src/util"),
    + f = c.Global,
    + l = c.trim
    + t.exports = { name: "cookieStorage", read: r, write: i, each: o, remove: a, clearAll: u }
    + var p = f.document
    + },
    + { "../src/util": 3 },
    + ],
    + 5: [
    + function (e, t, n) {
    + "use strict"
    + function r() {
    + return f.localStorage
    + }
    + function o(e) {
    + return r().getItem(e)
    + }
    + function i(e, t) {
    + return r().setItem(e, t)
    + }
    + function a(e) {
    + for (var t = r().length - 1; t >= 0; t--) {
    + var n = r().key(t)
    + e(o(n), n)
    + }
    + }
    + function u(e) {
    + return r().removeItem(e)
    + }
    + function s() {
    + return r().clear()
    + }
    + var c = e("../src/util"),
    + f = c.Global
    + t.exports = { name: "localStorage", read: o, write: i, each: a, remove: u, clearAll: s }
    + },
    + { "../src/util": 3 },
    + ],
    + 6: [
    + function (e, t, n) {
    + "use strict"
    + function r(e) {
    + return s[e]
    + }
    + function o(e, t) {
    + s[e] = t
    + }
    + function i(e) {
    + for (var t in s) s.hasOwnProperty(t) && e(s[t], t)
    + }
    + function a(e) {
    + delete s[e]
    + }
    + function u(e) {
    + s = {}
    + }
    + t.exports = { name: "memoryStorage", read: r, write: o, each: i, remove: a, clearAll: u }
    + var s = {}
    + },
    + {},
    + ],
    + 7: [
    + function (e, t, n) {
    + "use strict"
    + function r() {
    + return f.sessionStorage
    + }
    + function o(e) {
    + return r().getItem(e)
    + }
    + function i(e, t) {
    + return r().setItem(e, t)
    + }
    + function a(e) {
    + for (var t = r().length - 1; t >= 0; t--) {
    + var n = r().key(t)
    + e(o(n), n)
    + }
    + }
    + function u(e) {
    + return r().removeItem(e)
    + }
    + function s() {
    + return r().clear()
    + }
    + var c = e("../src/util"),
    + f = c.Global
    + t.exports = { name: "sessionStorage", read: o, write: i, each: a, remove: u, clearAll: s }
    + },
    + { "../src/util": 3 },
    + ],
    + },
    + {},
    + [1]
    + )(1)
    + })
    - !function(a){function b(a,d){if(a=a?a:"",d=d||{},a instanceof b)return a;if(!(this instanceof b))return new b(a,d);var e=c(a);this._originalInput=a,this._r=e.r,this._g=e.g,this._b=e.b,this._a=e.a,this._roundA=P(100*this._a)/100,this._format=d.format||e.format,this._gradientType=d.gradientType,this._r<1&&(this._r=P(this._r)),this._g<1&&(this._g=P(this._g)),this._b<1&&(this._b=P(this._b)),this._ok=e.ok,this._tc_id=O++}function c(a){var b={r:0,g:0,b:0},c=1,e=null,g=null,i=null,j=!1,k=!1;return"string"==typeof a&&(a=K(a)),"object"==typeof a&&(J(a.r)&&J(a.g)&&J(a.b)?(b=d(a.r,a.g,a.b),j=!0,k="%"===String(a.r).substr(-1)?"prgb":"rgb"):J(a.h)&&J(a.s)&&J(a.v)?(e=G(a.s),g=G(a.v),b=h(a.h,e,g),j=!0,k="hsv"):J(a.h)&&J(a.s)&&J(a.l)&&(e=G(a.s),i=G(a.l),b=f(a.h,e,i),j=!0,k="hsl"),a.hasOwnProperty("a")&&(c=a.a)),c=z(c),{ok:j,format:a.format||k,r:Q(255,R(b.r,0)),g:Q(255,R(b.g,0)),b:Q(255,R(b.b,0)),a:c}}function d(a,b,c){return{r:255*A(a,255),g:255*A(b,255),b:255*A(c,255)}}function e(a,b,c){a=A(a,255),b=A(b,255),c=A(c,255);var d,e,f=R(a,b,c),g=Q(a,b,c),h=(f+g)/2;if(f==g)d=e=0;else{var i=f-g;switch(e=h>.5?i/(2-f-g):i/(f+g),f){case a:d=(b-c)/i+(c>b?6:0);break;case b:d=(c-a)/i+2;break;case c:d=(a-b)/i+4}d/=6}return{h:d,s:e,l:h}}function f(a,b,c){function d(a,b,c){return 0>c&&(c+=1),c>1&&(c-=1),1/6>c?a+6*(b-a)*c:.5>c?b:2/3>c?a+6*(b-a)*(2/3-c):a}var e,f,g;if(a=A(a,360),b=A(b,100),c=A(c,100),0===b)e=f=g=c;else{var h=.5>c?c*(1+b):c+b-c*b,i=2*c-h;e=d(i,h,a+1/3),f=d(i,h,a),g=d(i,h,a-1/3)}return{r:255*e,g:255*f,b:255*g}}function g(a,b,c){a=A(a,255),b=A(b,255),c=A(c,255);var d,e,f=R(a,b,c),g=Q(a,b,c),h=f,i=f-g;if(e=0===f?0:i/f,f==g)d=0;else{switch(f){case a:d=(b-c)/i+(c>b?6:0);break;case b:d=(c-a)/i+2;break;case c:d=(a-b)/i+4}d/=6}return{h:d,s:e,v:h}}function h(b,c,d){b=6*A(b,360),c=A(c,100),d=A(d,100);var e=a.floor(b),f=b-e,g=d*(1-c),h=d*(1-f*c),i=d*(1-(1-f)*c),j=e%6,k=[d,h,g,g,i,d][j],l=[i,d,d,h,g,g][j],m=[g,g,i,d,d,h][j];return{r:255*k,g:255*l,b:255*m}}function i(a,b,c,d){var e=[F(P(a).toString(16)),F(P(b).toString(16)),F(P(c).toString(16))];return d&&e[0].charAt(0)==e[0].charAt(1)&&e[1].charAt(0)==e[1].charAt(1)&&e[2].charAt(0)==e[2].charAt(1)?e[0].charAt(0)+e[1].charAt(0)+e[2].charAt(0):e.join("")}function j(a,b,c,d,e){var f=[F(P(a).toString(16)),F(P(b).toString(16)),F(P(c).toString(16)),F(H(d))];return e&&f[0].charAt(0)==f[0].charAt(1)&&f[1].charAt(0)==f[1].charAt(1)&&f[2].charAt(0)==f[2].charAt(1)&&f[3].charAt(0)==f[3].charAt(1)?f[0].charAt(0)+f[1].charAt(0)+f[2].charAt(0)+f[3].charAt(0):f.join("")}function k(a,b,c,d){var e=[F(H(d)),F(P(a).toString(16)),F(P(b).toString(16)),F(P(c).toString(16))];return e.join("")}function l(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.s-=c/100,d.s=B(d.s),b(d)}function m(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.s+=c/100,d.s=B(d.s),b(d)}function n(a){return b(a).desaturate(100)}function o(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.l+=c/100,d.l=B(d.l),b(d)}function p(a,c){c=0===c?0:c||10;var d=b(a).toRgb();return d.r=R(0,Q(255,d.r-P(255*-(c/100)))),d.g=R(0,Q(255,d.g-P(255*-(c/100)))),d.b=R(0,Q(255,d.b-P(255*-(c/100)))),b(d)}function q(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.l-=c/100,d.l=B(d.l),b(d)}function r(a,c){var d=b(a).toHsl(),e=(d.h+c)%360;return d.h=0>e?360+e:e,b(d)}function s(a){var c=b(a).toHsl();return c.h=(c.h+180)%360,b(c)}function t(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+120)%360,s:c.s,l:c.l}),b({h:(d+240)%360,s:c.s,l:c.l})]}function u(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+90)%360,s:c.s,l:c.l}),b({h:(d+180)%360,s:c.s,l:c.l}),b({h:(d+270)%360,s:c.s,l:c.l})]}function v(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+72)%360,s:c.s,l:c.l}),b({h:(d+216)%360,s:c.s,l:c.l})]}function w(a,c,d){c=c||6,d=d||30;var e=b(a).toHsl(),f=360/d,g=[b(a)];for(e.h=(e.h-(f*c>>1)+720)%360;--c;)e.h=(e.h+f)%360,g.push(b(e));return g}function x(a,c){c=c||6;for(var d=b(a).toHsv(),e=d.h,f=d.s,g=d.v,h=[],i=1/c;c--;)h.push(b({h:e,s:f,v:g})),g=(g+i)%1;return h}function y(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[a[c]]=c);return b}function z(a){return a=parseFloat(a),(isNaN(a)||0>a||a>1)&&(a=1),a}function A(b,c){D(b)&&(b="100%");var d=E(b);return b=Q(c,R(0,parseFloat(b))),d&&(b=parseInt(b*c,10)/100),a.abs(b-c)<1e-6?1:b%c/parseFloat(c)}function B(a){return Q(1,R(0,a))}function C(a){return parseInt(a,16)}function D(a){return"string"==typeof a&&-1!=a.indexOf(".")&&1===parseFloat(a)}function E(a){return"string"==typeof a&&-1!=a.indexOf("%")}function F(a){return 1==a.length?"0"+a:""+a}function G(a){return 1>=a&&(a=100*a+"%"),a}function H(b){return a.round(255*parseFloat(b)).toString(16)}function I(a){return C(a)/255}function J(a){return!!V.CSS_UNIT.exec(a)}function K(a){a=a.replace(M,"").replace(N,"").toLowerCase();var b=!1;if(T[a])a=T[a],b=!0;else if("transparent"==a)return{r:0,g:0,b:0,a:0,format:"name"};var c;return(c=V.rgb.exec(a))?{r:c[1],g:c[2],b:c[3]}:(c=V.rgba.exec(a))?{r:c[1],g:c[2],b:c[3],a:c[4]}:(c=V.hsl.exec(a))?{h:c[1],s:c[2],l:c[3]}:(c=V.hsla.exec(a))?{h:c[1],s:c[2],l:c[3],a:c[4]}:(c=V.hsv.exec(a))?{h:c[1],s:c[2],v:c[3]}:(c=V.hsva.exec(a))?{h:c[1],s:c[2],v:c[3],a:c[4]}:(c=V.hex8.exec(a))?{r:C(c[1]),g:C(c[2]),b:C(c[3]),a:I(c[4]),format:b?"name":"hex8"}:(c=V.hex6.exec(a))?{r:C(c[1]),g:C(c[2]),b:C(c[3]),format:b?"name":"hex"}:(c=V.hex4.exec(a))?{r:C(c[1]+""+c[1]),g:C(c[2]+""+c[2]),b:C(c[3]+""+c[3]),a:I(c[4]+""+c[4]),format:b?"name":"hex8"}:(c=V.hex3.exec(a))?{r:C(c[1]+""+c[1]),g:C(c[2]+""+c[2]),b:C(c[3]+""+c[3]),format:b?"name":"hex"}:!1}function L(a){var b,c;return a=a||{level:"AA",size:"small"},b=(a.level||"AA").toUpperCase(),c=(a.size||"small").toLowerCase(),"AA"!==b&&"AAA"!==b&&(b="AA"),"small"!==c&&"large"!==c&&(c="small"),{level:b,size:c}}var M=/^\s+/,N=/\s+$/,O=0,P=a.round,Q=a.min,R=a.max,S=a.random;b.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var a=this.toRgb();return(299*a.r+587*a.g+114*a.b)/1e3},getLuminance:function(){var b,c,d,e,f,g,h=this.toRgb();return b=h.r/255,c=h.g/255,d=h.b/255,e=.03928>=b?b/12.92:a.pow((b+.055)/1.055,2.4),f=.03928>=c?c/12.92:a.pow((c+.055)/1.055,2.4),g=.03928>=d?d/12.92:a.pow((d+.055)/1.055,2.4),.2126*e+.7152*f+.0722*g},setAlpha:function(a){return this._a=z(a),this._roundA=P(100*this._a)/100,this},toHsv:function(){var a=g(this._r,this._g,this._b);return{h:360*a.h,s:a.s,v:a.v,a:this._a}},toHsvString:function(){var a=g(this._r,this._g,this._b),b=P(360*a.h),c=P(100*a.s),d=P(100*a.v);return 1==this._a?"hsv("+b+", "+c+"%, "+d+"%)":"hsva("+b+", "+c+"%, "+d+"%, "+this._roundA+")"},toHsl:function(){var a=e(this._r,this._g,this._b);return{h:360*a.h,s:a.s,l:a.l,a:this._a}},toHslString:function(){var a=e(this._r,this._g,this._b),b=P(360*a.h),c=P(100*a.s),d=P(100*a.l);return 1==this._a?"hsl("+b+", "+c+"%, "+d+"%)":"hsla("+b+", "+c+"%, "+d+"%, "+this._roundA+")"},toHex:function(a){return i(this._r,this._g,this._b,a)},toHexString:function(a){return"#"+this.toHex(a)},toHex8:function(a){return j(this._r,this._g,this._b,this._a,a)},toHex8String:function(a){return"#"+this.toHex8(a)},toRgb:function(){return{r:P(this._r),g:P(this._g),b:P(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+P(this._r)+", "+P(this._g)+", "+P(this._b)+")":"rgba("+P(this._r)+", "+P(this._g)+", "+P(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:P(100*A(this._r,255))+"%",g:P(100*A(this._g,255))+"%",b:P(100*A(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+P(100*A(this._r,255))+"%, "+P(100*A(this._g,255))+"%, "+P(100*A(this._b,255))+"%)":"rgba("+P(100*A(this._r,255))+"%, "+P(100*A(this._g,255))+"%, "+P(100*A(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:U[i(this._r,this._g,this._b,!0)]||!1},toFilter:function(a){var c="#"+k(this._r,this._g,this._b,this._a),d=c,e=this._gradientType?"GradientType = 1, ":"";if(a){var f=b(a);d="#"+k(f._r,f._g,f._b,f._a)}return"progid:DXImageTransform.Microsoft.gradient("+e+"startColorstr="+c+",endColorstr="+d+")"},toString:function(a){var b=!!a;a=a||this._format;var c=!1,d=this._a<1&&this._a>=0,e=!b&&d&&("hex"===a||"hex6"===a||"hex3"===a||"hex4"===a||"hex8"===a||"name"===a);return e?"name"===a&&0===this._a?this.toName():this.toRgbString():("rgb"===a&&(c=this.toRgbString()),"prgb"===a&&(c=this.toPercentageRgbString()),("hex"===a||"hex6"===a)&&(c=this.toHexString()),"hex3"===a&&(c=this.toHexString(!0)),"hex4"===a&&(c=this.toHex8String(!0)),"hex8"===a&&(c=this.toHex8String()),"name"===a&&(c=this.toName()),"hsl"===a&&(c=this.toHslString()),"hsv"===a&&(c=this.toHsvString()),c||this.toHexString())},clone:function(){return b(this.toString())},_applyModification:function(a,b){var c=a.apply(null,[this].concat([].slice.call(b)));return this._r=c._r,this._g=c._g,this._b=c._b,this.setAlpha(c._a),this},lighten:function(){return this._applyModification(o,arguments)},brighten:function(){return this._applyModification(p,arguments)},darken:function(){return this._applyModification(q,arguments)},desaturate:function(){return this._applyModification(l,arguments)},saturate:function(){return this._applyModification(m,arguments)},greyscale:function(){return this._applyModification(n,arguments)},spin:function(){return this._applyModification(r,arguments)},_applyCombination:function(a,b){return a.apply(null,[this].concat([].slice.call(b)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(s,arguments)},monochromatic:function(){return this._applyCombination(x,arguments)},splitcomplement:function(){return this._applyCombination(v,arguments)},triad:function(){return this._applyCombination(t,arguments)},tetrad:function(){return this._applyCombination(u,arguments)}},b.fromRatio=function(a,c){if("object"==typeof a){var d={};for(var e in a)a.hasOwnProperty(e)&&(d[e]="a"===e?a[e]:G(a[e]));a=d}return b(a,c)},b.equals=function(a,c){return a&&c?b(a).toRgbString()==b(c).toRgbString():!1},b.random=function(){return b.fromRatio({r:S(),g:S(),b:S()})},b.mix=function(a,c,d){d=0===d?0:d||50;var e=b(a).toRgb(),f=b(c).toRgb(),g=d/100,h={r:(f.r-e.r)*g+e.r,g:(f.g-e.g)*g+e.g,b:(f.b-e.b)*g+e.b,a:(f.a-e.a)*g+e.a};return b(h)},b.readability=function(c,d){var e=b(c),f=b(d);return(a.max(e.getLuminance(),f.getLuminance())+.05)/(a.min(e.getLuminance(),f.getLuminance())+.05)},b.isReadable=function(a,c,d){var e,f,g=b.readability(a,c);switch(f=!1,e=L(d),e.level+e.size){case"AAsmall":case"AAAlarge":f=g>=4.5;break;case"AAlarge":f=g>=3;break;case"AAAsmall":f=g>=7}return f},b.mostReadable=function(a,c,d){var e,f,g,h,i=null,j=0;d=d||{},f=d.includeFallbackColors,g=d.level,h=d.size;for(var k=0;kj&&(j=e,i=b(c[k]));return b.isReadable(a,i,{level:g,size:h})||!f?i:(d.includeFallbackColors=!1,b.mostReadable(a,["#fff","#000"],d))};var T=b.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},U=b.hexNames=y(T),V=function(){var a="[-\\+]?\\d+%?",b="[-\\+]?\\d*\\.\\d+%?",c="(?:"+b+")|(?:"+a+")",d="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?",e="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?";return{CSS_UNIT:new RegExp(c),rgb:new RegExp("rgb"+d),rgba:new RegExp("rgba"+e),hsl:new RegExp("hsl"+d),hsla:new RegExp("hsla"+e),hsv:new RegExp("hsv"+d),hsva:new RegExp("hsva"+e),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();"undefined"!=typeof module&&module.exports?module.exports=b:"function"==typeof define&&define.amd?define(function(){return b}):window.tinycolor=b}(Math);;
    -
    - (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.superagent = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i
    - "use strict";
    + !(function (a) {
    + function b(a, d) {
    + if (((a = a ? a : ""), (d = d || {}), a instanceof b)) return a
    + if (!(this instanceof b)) return new b(a, d)
    + var e = c(a)
    + ;(this._originalInput = a),
    + (this._r = e.r),
    + (this._g = e.g),
    + (this._b = e.b),
    + (this._a = e.a),
    + (this._roundA = P(100 * this._a) / 100),
    + (this._format = d.format || e.format),
    + (this._gradientType = d.gradientType),
    + this._r < 1 && (this._r = P(this._r)),
    + this._g < 1 && (this._g = P(this._g)),
    + this._b < 1 && (this._b = P(this._b)),
    + (this._ok = e.ok),
    + (this._tc_id = O++)
    + }
    + function c(a) {
    + var b = { r: 0, g: 0, b: 0 },
    + c = 1,
    + e = null,
    + g = null,
    + i = null,
    + j = !1,
    + k = !1
    + return (
    + "string" == typeof a && (a = K(a)),
    + "object" == typeof a &&
    + (J(a.r) && J(a.g) && J(a.b)
    + ? ((b = d(a.r, a.g, a.b)), (j = !0), (k = "%" === String(a.r).substr(-1) ? "prgb" : "rgb"))
    + : J(a.h) && J(a.s) && J(a.v)
    + ? ((e = G(a.s)), (g = G(a.v)), (b = h(a.h, e, g)), (j = !0), (k = "hsv"))
    + : J(a.h) && J(a.s) && J(a.l) && ((e = G(a.s)), (i = G(a.l)), (b = f(a.h, e, i)), (j = !0), (k = "hsl")),
    + a.hasOwnProperty("a") && (c = a.a)),
    + (c = z(c)),
    + { ok: j, format: a.format || k, r: Q(255, R(b.r, 0)), g: Q(255, R(b.g, 0)), b: Q(255, R(b.b, 0)), a: c }
    + )
    + }
    + function d(a, b, c) {
    + return { r: 255 * A(a, 255), g: 255 * A(b, 255), b: 255 * A(c, 255) }
    + }
    + function e(a, b, c) {
    + ;(a = A(a, 255)), (b = A(b, 255)), (c = A(c, 255))
    + var d,
    + e,
    + f = R(a, b, c),
    + g = Q(a, b, c),
    + h = (f + g) / 2
    + if (f == g) d = e = 0
    + else {
    + var i = f - g
    + switch (((e = h > 0.5 ? i / (2 - f - g) : i / (f + g)), f)) {
    + case a:
    + d = (b - c) / i + (c > b ? 6 : 0)
    + break
    + case b:
    + d = (c - a) / i + 2
    + break
    + case c:
    + d = (a - b) / i + 4
    + }
    + d /= 6
    + }
    + return { h: d, s: e, l: h }
    + }
    + function f(a, b, c) {
    + function d(a, b, c) {
    + return 0 > c && (c += 1), c > 1 && (c -= 1), 1 / 6 > c ? a + 6 * (b - a) * c : 0.5 > c ? b : 2 / 3 > c ? a + 6 * (b - a) * (2 / 3 - c) : a
    + }
    + var e, f, g
    + if (((a = A(a, 360)), (b = A(b, 100)), (c = A(c, 100)), 0 === b)) e = f = g = c
    + else {
    + var h = 0.5 > c ? c * (1 + b) : c + b - c * b,
    + i = 2 * c - h
    + ;(e = d(i, h, a + 1 / 3)), (f = d(i, h, a)), (g = d(i, h, a - 1 / 3))
    + }
    + return { r: 255 * e, g: 255 * f, b: 255 * g }
    + }
    + function g(a, b, c) {
    + ;(a = A(a, 255)), (b = A(b, 255)), (c = A(c, 255))
    + var d,
    + e,
    + f = R(a, b, c),
    + g = Q(a, b, c),
    + h = f,
    + i = f - g
    + if (((e = 0 === f ? 0 : i / f), f == g)) d = 0
    + else {
    + switch (f) {
    + case a:
    + d = (b - c) / i + (c > b ? 6 : 0)
    + break
    + case b:
    + d = (c - a) / i + 2
    + break
    + case c:
    + d = (a - b) / i + 4
    + }
    + d /= 6
    + }
    + return { h: d, s: e, v: h }
    + }
    + function h(b, c, d) {
    + ;(b = 6 * A(b, 360)), (c = A(c, 100)), (d = A(d, 100))
    + var e = a.floor(b),
    + f = b - e,
    + g = d * (1 - c),
    + h = d * (1 - f * c),
    + i = d * (1 - (1 - f) * c),
    + j = e % 6,
    + k = [d, h, g, g, i, d][j],
    + l = [i, d, d, h, g, g][j],
    + m = [g, g, i, d, d, h][j]
    + return { r: 255 * k, g: 255 * l, b: 255 * m }
    + }
    + function i(a, b, c, d) {
    + var e = [F(P(a).toString(16)), F(P(b).toString(16)), F(P(c).toString(16))]
    + return d && e[0].charAt(0) == e[0].charAt(1) && e[1].charAt(0) == e[1].charAt(1) && e[2].charAt(0) == e[2].charAt(1)
    + ? e[0].charAt(0) + e[1].charAt(0) + e[2].charAt(0)
    + : e.join("")
    + }
    + function j(a, b, c, d, e) {
    + var f = [F(P(a).toString(16)), F(P(b).toString(16)), F(P(c).toString(16)), F(H(d))]
    + return e && f[0].charAt(0) == f[0].charAt(1) && f[1].charAt(0) == f[1].charAt(1) && f[2].charAt(0) == f[2].charAt(1) && f[3].charAt(0) == f[3].charAt(1)
    + ? f[0].charAt(0) + f[1].charAt(0) + f[2].charAt(0) + f[3].charAt(0)
    + : f.join("")
    + }
    + function k(a, b, c, d) {
    + var e = [F(H(d)), F(P(a).toString(16)), F(P(b).toString(16)), F(P(c).toString(16))]
    + return e.join("")
    + }
    + function l(a, c) {
    + c = 0 === c ? 0 : c || 10
    + var d = b(a).toHsl()
    + return (d.s -= c / 100), (d.s = B(d.s)), b(d)
    + }
    + function m(a, c) {
    + c = 0 === c ? 0 : c || 10
    + var d = b(a).toHsl()
    + return (d.s += c / 100), (d.s = B(d.s)), b(d)
    + }
    + function n(a) {
    + return b(a).desaturate(100)
    + }
    + function o(a, c) {
    + c = 0 === c ? 0 : c || 10
    + var d = b(a).toHsl()
    + return (d.l += c / 100), (d.l = B(d.l)), b(d)
    + }
    + function p(a, c) {
    + c = 0 === c ? 0 : c || 10
    + var d = b(a).toRgb()
    + return (d.r = R(0, Q(255, d.r - P(255 * -(c / 100))))), (d.g = R(0, Q(255, d.g - P(255 * -(c / 100))))), (d.b = R(0, Q(255, d.b - P(255 * -(c / 100))))), b(d)
    + }
    + function q(a, c) {
    + c = 0 === c ? 0 : c || 10
    + var d = b(a).toHsl()
    + return (d.l -= c / 100), (d.l = B(d.l)), b(d)
    + }
    + function r(a, c) {
    + var d = b(a).toHsl(),
    + e = (d.h + c) % 360
    + return (d.h = 0 > e ? 360 + e : e), b(d)
    + }
    + function s(a) {
    + var c = b(a).toHsl()
    + return (c.h = (c.h + 180) % 360), b(c)
    + }
    + function t(a) {
    + var c = b(a).toHsl(),
    + d = c.h
    + return [b(a), b({ h: (d + 120) % 360, s: c.s, l: c.l }), b({ h: (d + 240) % 360, s: c.s, l: c.l })]
    + }
    + function u(a) {
    + var c = b(a).toHsl(),
    + d = c.h
    + return [b(a), b({ h: (d + 90) % 360, s: c.s, l: c.l }), b({ h: (d + 180) % 360, s: c.s, l: c.l }), b({ h: (d + 270) % 360, s: c.s, l: c.l })]
    + }
    + function v(a) {
    + var c = b(a).toHsl(),
    + d = c.h
    + return [b(a), b({ h: (d + 72) % 360, s: c.s, l: c.l }), b({ h: (d + 216) % 360, s: c.s, l: c.l })]
    + }
    + function w(a, c, d) {
    + ;(c = c || 6), (d = d || 30)
    + var e = b(a).toHsl(),
    + f = 360 / d,
    + g = [b(a)]
    + for (e.h = (e.h - ((f * c) >> 1) + 720) % 360; --c; ) (e.h = (e.h + f) % 360), g.push(b(e))
    + return g
    + }
    + function x(a, c) {
    + c = c || 6
    + for (var d = b(a).toHsv(), e = d.h, f = d.s, g = d.v, h = [], i = 1 / c; c--; ) h.push(b({ h: e, s: f, v: g })), (g = (g + i) % 1)
    + return h
    + }
    + function y(a) {
    + var b = {}
    + for (var c in a) a.hasOwnProperty(c) && (b[a[c]] = c)
    + return b
    + }
    + function z(a) {
    + return (a = parseFloat(a)), (isNaN(a) || 0 > a || a > 1) && (a = 1), a
    + }
    + function A(b, c) {
    + D(b) && (b = "100%")
    + var d = E(b)
    + return (b = Q(c, R(0, parseFloat(b)))), d && (b = parseInt(b * c, 10) / 100), a.abs(b - c) < 1e-6 ? 1 : (b % c) / parseFloat(c)
    + }
    + function B(a) {
    + return Q(1, R(0, a))
    + }
    + function C(a) {
    + return parseInt(a, 16)
    + }
    + function D(a) {
    + return "string" == typeof a && -1 != a.indexOf(".") && 1 === parseFloat(a)
    + }
    + function E(a) {
    + return "string" == typeof a && -1 != a.indexOf("%")
    + }
    + function F(a) {
    + return 1 == a.length ? "0" + a : "" + a
    + }
    + function G(a) {
    + return 1 >= a && (a = 100 * a + "%"), a
    + }
    + function H(b) {
    + return a.round(255 * parseFloat(b)).toString(16)
    + }
    + function I(a) {
    + return C(a) / 255
    + }
    + function J(a) {
    + return !!V.CSS_UNIT.exec(a)
    + }
    + function K(a) {
    + a = a.replace(M, "").replace(N, "").toLowerCase()
    + var b = !1
    + if (T[a]) (a = T[a]), (b = !0)
    + else if ("transparent" == a) return { r: 0, g: 0, b: 0, a: 0, format: "name" }
    + var c
    + return (c = V.rgb.exec(a))
    + ? { r: c[1], g: c[2], b: c[3] }
    + : (c = V.rgba.exec(a))
    + ? { r: c[1], g: c[2], b: c[3], a: c[4] }
    + : (c = V.hsl.exec(a))
    + ? { h: c[1], s: c[2], l: c[3] }
    + : (c = V.hsla.exec(a))
    + ? { h: c[1], s: c[2], l: c[3], a: c[4] }
    + : (c = V.hsv.exec(a))
    + ? { h: c[1], s: c[2], v: c[3] }
    + : (c = V.hsva.exec(a))
    + ? { h: c[1], s: c[2], v: c[3], a: c[4] }
    + : (c = V.hex8.exec(a))
    + ? { r: C(c[1]), g: C(c[2]), b: C(c[3]), a: I(c[4]), format: b ? "name" : "hex8" }
    + : (c = V.hex6.exec(a))
    + ? { r: C(c[1]), g: C(c[2]), b: C(c[3]), format: b ? "name" : "hex" }
    + : (c = V.hex4.exec(a))
    + ? { r: C(c[1] + "" + c[1]), g: C(c[2] + "" + c[2]), b: C(c[3] + "" + c[3]), a: I(c[4] + "" + c[4]), format: b ? "name" : "hex8" }
    + : (c = V.hex3.exec(a))
    + ? { r: C(c[1] + "" + c[1]), g: C(c[2] + "" + c[2]), b: C(c[3] + "" + c[3]), format: b ? "name" : "hex" }
    + : !1
    + }
    + function L(a) {
    + var b, c
    + return (
    + (a = a || { level: "AA", size: "small" }),
    + (b = (a.level || "AA").toUpperCase()),
    + (c = (a.size || "small").toLowerCase()),
    + "AA" !== b && "AAA" !== b && (b = "AA"),
    + "small" !== c && "large" !== c && (c = "small"),
    + { level: b, size: c }
    + )
    + }
    + var M = /^\s+/,
    + N = /\s+$/,
    + O = 0,
    + P = a.round,
    + Q = a.min,
    + R = a.max,
    + S = a.random
    + ;(b.prototype = {
    + isDark: function () {
    + return this.getBrightness() < 128
    + },
    + isLight: function () {
    + return !this.isDark()
    + },
    + isValid: function () {
    + return this._ok
    + },
    + getOriginalInput: function () {
    + return this._originalInput
    + },
    + getFormat: function () {
    + return this._format
    + },
    + getAlpha: function () {
    + return this._a
    + },
    + getBrightness: function () {
    + var a = this.toRgb()
    + return (299 * a.r + 587 * a.g + 114 * a.b) / 1e3
    + },
    + getLuminance: function () {
    + var b,
    + c,
    + d,
    + e,
    + f,
    + g,
    + h = this.toRgb()
    + return (
    + (b = h.r / 255),
    + (c = h.g / 255),
    + (d = h.b / 255),
    + (e = 0.03928 >= b ? b / 12.92 : a.pow((b + 0.055) / 1.055, 2.4)),
    + (f = 0.03928 >= c ? c / 12.92 : a.pow((c + 0.055) / 1.055, 2.4)),
    + (g = 0.03928 >= d ? d / 12.92 : a.pow((d + 0.055) / 1.055, 2.4)),
    + 0.2126 * e + 0.7152 * f + 0.0722 * g
    + )
    + },
    + setAlpha: function (a) {
    + return (this._a = z(a)), (this._roundA = P(100 * this._a) / 100), this
    + },
    + toHsv: function () {
    + var a = g(this._r, this._g, this._b)
    + return { h: 360 * a.h, s: a.s, v: a.v, a: this._a }
    + },
    + toHsvString: function () {
    + var a = g(this._r, this._g, this._b),
    + b = P(360 * a.h),
    + c = P(100 * a.s),
    + d = P(100 * a.v)
    + return 1 == this._a ? "hsv(" + b + ", " + c + "%, " + d + "%)" : "hsva(" + b + ", " + c + "%, " + d + "%, " + this._roundA + ")"
    + },
    + toHsl: function () {
    + var a = e(this._r, this._g, this._b)
    + return { h: 360 * a.h, s: a.s, l: a.l, a: this._a }
    + },
    + toHslString: function () {
    + var a = e(this._r, this._g, this._b),
    + b = P(360 * a.h),
    + c = P(100 * a.s),
    + d = P(100 * a.l)
    + return 1 == this._a ? "hsl(" + b + ", " + c + "%, " + d + "%)" : "hsla(" + b + ", " + c + "%, " + d + "%, " + this._roundA + ")"
    + },
    + toHex: function (a) {
    + return i(this._r, this._g, this._b, a)
    + },
    + toHexString: function (a) {
    + return "#" + this.toHex(a)
    + },
    + toHex8: function (a) {
    + return j(this._r, this._g, this._b, this._a, a)
    + },
    + toHex8String: function (a) {
    + return "#" + this.toHex8(a)
    + },
    + toRgb: function () {
    + return { r: P(this._r), g: P(this._g), b: P(this._b), a: this._a }
    + },
    + toRgbString: function () {
    + return 1 == this._a
    + ? "rgb(" + P(this._r) + ", " + P(this._g) + ", " + P(this._b) + ")"
    + : "rgba(" + P(this._r) + ", " + P(this._g) + ", " + P(this._b) + ", " + this._roundA + ")"
    + },
    + toPercentageRgb: function () {
    + return { r: P(100 * A(this._r, 255)) + "%", g: P(100 * A(this._g, 255)) + "%", b: P(100 * A(this._b, 255)) + "%", a: this._a }
    + },
    + toPercentageRgbString: function () {
    + return 1 == this._a
    + ? "rgb(" + P(100 * A(this._r, 255)) + "%, " + P(100 * A(this._g, 255)) + "%, " + P(100 * A(this._b, 255)) + "%)"
    + : "rgba(" + P(100 * A(this._r, 255)) + "%, " + P(100 * A(this._g, 255)) + "%, " + P(100 * A(this._b, 255)) + "%, " + this._roundA + ")"
    + },
    + toName: function () {
    + return 0 === this._a ? "transparent" : this._a < 1 ? !1 : U[i(this._r, this._g, this._b, !0)] || !1
    + },
    + toFilter: function (a) {
    + var c = "#" + k(this._r, this._g, this._b, this._a),
    + d = c,
    + e = this._gradientType ? "GradientType = 1, " : ""
    + if (a) {
    + var f = b(a)
    + d = "#" + k(f._r, f._g, f._b, f._a)
    + }
    + return "progid:DXImageTransform.Microsoft.gradient(" + e + "startColorstr=" + c + ",endColorstr=" + d + ")"
    + },
    + toString: function (a) {
    + var b = !!a
    + a = a || this._format
    + var c = !1,
    + d = this._a < 1 && this._a >= 0,
    + e = !b && d && ("hex" === a || "hex6" === a || "hex3" === a || "hex4" === a || "hex8" === a || "name" === a)
    + return e
    + ? "name" === a && 0 === this._a
    + ? this.toName()
    + : this.toRgbString()
    + : ("rgb" === a && (c = this.toRgbString()),
    + "prgb" === a && (c = this.toPercentageRgbString()),
    + ("hex" === a || "hex6" === a) && (c = this.toHexString()),
    + "hex3" === a && (c = this.toHexString(!0)),
    + "hex4" === a && (c = this.toHex8String(!0)),
    + "hex8" === a && (c = this.toHex8String()),
    + "name" === a && (c = this.toName()),
    + "hsl" === a && (c = this.toHslString()),
    + "hsv" === a && (c = this.toHsvString()),
    + c || this.toHexString())
    + },
    + clone: function () {
    + return b(this.toString())
    + },
    + _applyModification: function (a, b) {
    + var c = a.apply(null, [this].concat([].slice.call(b)))
    + return (this._r = c._r), (this._g = c._g), (this._b = c._b), this.setAlpha(c._a), this
    + },
    + lighten: function () {
    + return this._applyModification(o, arguments)
    + },
    + brighten: function () {
    + return this._applyModification(p, arguments)
    + },
    + darken: function () {
    + return this._applyModification(q, arguments)
    + },
    + desaturate: function () {
    + return this._applyModification(l, arguments)
    + },
    + saturate: function () {
    + return this._applyModification(m, arguments)
    + },
    + greyscale: function () {
    + return this._applyModification(n, arguments)
    + },
    + spin: function () {
    + return this._applyModification(r, arguments)
    + },
    + _applyCombination: function (a, b) {
    + return a.apply(null, [this].concat([].slice.call(b)))
    + },
    + analogous: function () {
    + return this._applyCombination(w, arguments)
    + },
    + complement: function () {
    + return this._applyCombination(s, arguments)
    + },
    + monochromatic: function () {
    + return this._applyCombination(x, arguments)
    + },
    + splitcomplement: function () {
    + return this._applyCombination(v, arguments)
    + },
    + triad: function () {
    + return this._applyCombination(t, arguments)
    + },
    + tetrad: function () {
    + return this._applyCombination(u, arguments)
    + },
    + }),
    + (b.fromRatio = function (a, c) {
    + if ("object" == typeof a) {
    + var d = {}
    + for (var e in a) a.hasOwnProperty(e) && (d[e] = "a" === e ? a[e] : G(a[e]))
    + a = d
    + }
    + return b(a, c)
    + }),
    + (b.equals = function (a, c) {
    + return a && c ? b(a).toRgbString() == b(c).toRgbString() : !1
    + }),
    + (b.random = function () {
    + return b.fromRatio({ r: S(), g: S(), b: S() })
    + }),
    + (b.mix = function (a, c, d) {
    + d = 0 === d ? 0 : d || 50
    + var e = b(a).toRgb(),
    + f = b(c).toRgb(),
    + g = d / 100,
    + h = { r: (f.r - e.r) * g + e.r, g: (f.g - e.g) * g + e.g, b: (f.b - e.b) * g + e.b, a: (f.a - e.a) * g + e.a }
    + return b(h)
    + }),
    + (b.readability = function (c, d) {
    + var e = b(c),
    + f = b(d)
    + return (a.max(e.getLuminance(), f.getLuminance()) + 0.05) / (a.min(e.getLuminance(), f.getLuminance()) + 0.05)
    + }),
    + (b.isReadable = function (a, c, d) {
    + var e,
    + f,
    + g = b.readability(a, c)
    + switch (((f = !1), (e = L(d)), e.level + e.size)) {
    + case "AAsmall":
    + case "AAAlarge":
    + f = g >= 4.5
    + break
    + case "AAlarge":
    + f = g >= 3
    + break
    + case "AAAsmall":
    + f = g >= 7
    + }
    + return f
    + }),
    + (b.mostReadable = function (a, c, d) {
    + var e,
    + f,
    + g,
    + h,
    + i = null,
    + j = 0
    + ;(d = d || {}), (f = d.includeFallbackColors), (g = d.level), (h = d.size)
    + for (var k = 0; k < c.length; k++) (e = b.readability(a, c[k])), e > j && ((j = e), (i = b(c[k])))
    + return b.isReadable(a, i, { level: g, size: h }) || !f ? i : ((d.includeFallbackColors = !1), b.mostReadable(a, ["#fff", "#000"], d))
    + })
    + var T = (b.names = {
    + aliceblue: "f0f8ff",
    + antiquewhite: "faebd7",
    + aqua: "0ff",
    + aquamarine: "7fffd4",
    + azure: "f0ffff",
    + beige: "f5f5dc",
    + bisque: "ffe4c4",
    + black: "000",
    + blanchedalmond: "ffebcd",
    + blue: "00f",
    + blueviolet: "8a2be2",
    + brown: "a52a2a",
    + burlywood: "deb887",
    + burntsienna: "ea7e5d",
    + cadetblue: "5f9ea0",
    + chartreuse: "7fff00",
    + chocolate: "d2691e",
    + coral: "ff7f50",
    + cornflowerblue: "6495ed",
    + cornsilk: "fff8dc",
    + crimson: "dc143c",
    + cyan: "0ff",
    + darkblue: "00008b",
    + darkcyan: "008b8b",
    + darkgoldenrod: "b8860b",
    + darkgray: "a9a9a9",
    + darkgreen: "006400",
    + darkgrey: "a9a9a9",
    + darkkhaki: "bdb76b",
    + darkmagenta: "8b008b",
    + darkolivegreen: "556b2f",
    + darkorange: "ff8c00",
    + darkorchid: "9932cc",
    + darkred: "8b0000",
    + darksalmon: "e9967a",
    + darkseagreen: "8fbc8f",
    + darkslateblue: "483d8b",
    + darkslategray: "2f4f4f",
    + darkslategrey: "2f4f4f",
    + darkturquoise: "00ced1",
    + darkviolet: "9400d3",
    + deeppink: "ff1493",
    + deepskyblue: "00bfff",
    + dimgray: "696969",
    + dimgrey: "696969",
    + dodgerblue: "1e90ff",
    + firebrick: "b22222",
    + floralwhite: "fffaf0",
    + forestgreen: "228b22",
    + fuchsia: "f0f",
    + gainsboro: "dcdcdc",
    + ghostwhite: "f8f8ff",
    + gold: "ffd700",
    + goldenrod: "daa520",
    + gray: "808080",
    + green: "008000",
    + greenyellow: "adff2f",
    + grey: "808080",
    + honeydew: "f0fff0",
    + hotpink: "ff69b4",
    + indianred: "cd5c5c",
    + indigo: "4b0082",
    + ivory: "fffff0",
    + khaki: "f0e68c",
    + lavender: "e6e6fa",
    + lavenderblush: "fff0f5",
    + lawngreen: "7cfc00",
    + lemonchiffon: "fffacd",
    + lightblue: "add8e6",
    + lightcoral: "f08080",
    + lightcyan: "e0ffff",
    + lightgoldenrodyellow: "fafad2",
    + lightgray: "d3d3d3",
    + lightgreen: "90ee90",
    + lightgrey: "d3d3d3",
    + lightpink: "ffb6c1",
    + lightsalmon: "ffa07a",
    + lightseagreen: "20b2aa",
    + lightskyblue: "87cefa",
    + lightslategray: "789",
    + lightslategrey: "789",
    + lightsteelblue: "b0c4de",
    + lightyellow: "ffffe0",
    + lime: "0f0",
    + limegreen: "32cd32",
    + linen: "faf0e6",
    + magenta: "f0f",
    + maroon: "800000",
    + mediumaquamarine: "66cdaa",
    + mediumblue: "0000cd",
    + mediumorchid: "ba55d3",
    + mediumpurple: "9370db",
    + mediumseagreen: "3cb371",
    + mediumslateblue: "7b68ee",
    + mediumspringgreen: "00fa9a",
    + mediumturquoise: "48d1cc",
    + mediumvioletred: "c71585",
    + midnightblue: "191970",
    + mintcream: "f5fffa",
    + mistyrose: "ffe4e1",
    + moccasin: "ffe4b5",
    + navajowhite: "ffdead",
    + navy: "000080",
    + oldlace: "fdf5e6",
    + olive: "808000",
    + olivedrab: "6b8e23",
    + orange: "ffa500",
    + orangered: "ff4500",
    + orchid: "da70d6",
    + palegoldenrod: "eee8aa",
    + palegreen: "98fb98",
    + paleturquoise: "afeeee",
    + palevioletred: "db7093",
    + papayawhip: "ffefd5",
    + peachpuff: "ffdab9",
    + peru: "cd853f",
    + pink: "ffc0cb",
    + plum: "dda0dd",
    + powderblue: "b0e0e6",
    + purple: "800080",
    + rebeccapurple: "663399",
    + red: "f00",
    + rosybrown: "bc8f8f",
    + royalblue: "4169e1",
    + saddlebrown: "8b4513",
    + salmon: "fa8072",
    + sandybrown: "f4a460",
    + seagreen: "2e8b57",
    + seashell: "fff5ee",
    + sienna: "a0522d",
    + silver: "c0c0c0",
    + skyblue: "87ceeb",
    + slateblue: "6a5acd",
    + slategray: "708090",
    + slategrey: "708090",
    + snow: "fffafa",
    + springgreen: "00ff7f",
    + steelblue: "4682b4",
    + tan: "d2b48c",
    + teal: "008080",
    + thistle: "d8bfd8",
    + tomato: "ff6347",
    + turquoise: "40e0d0",
    + violet: "ee82ee",
    + wheat: "f5deb3",
    + white: "fff",
    + whitesmoke: "f5f5f5",
    + yellow: "ff0",
    + yellowgreen: "9acd32",
    + }),
    + U = (b.hexNames = y(T)),
    + V = (function () {
    + var a = "[-\\+]?\\d+%?",
    + b = "[-\\+]?\\d*\\.\\d+%?",
    + c = "(?:" + b + ")|(?:" + a + ")",
    + d = "[\\s|\\(]+(" + c + ")[,|\\s]+(" + c + ")[,|\\s]+(" + c + ")\\s*\\)?",
    + e = "[\\s|\\(]+(" + c + ")[,|\\s]+(" + c + ")[,|\\s]+(" + c + ")[,|\\s]+(" + c + ")\\s*\\)?"
    + return {
    + CSS_UNIT: new RegExp(c),
    + rgb: new RegExp("rgb" + d),
    + rgba: new RegExp("rgba" + e),
    + hsl: new RegExp("hsl" + d),
    + hsla: new RegExp("hsla" + e),
    + hsv: new RegExp("hsv" + d),
    + hsva: new RegExp("hsva" + e),
    + hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
    + hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
    + hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
    + hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
    + }
    + })()
    + "undefined" != typeof module && module.exports
    + ? (module.exports = b)
    + : "function" == typeof define && define.amd
    + ? define(function () {
    + return b
    + })
    + : (window.tinycolor = b)
    + })(Math)
    + ;(function (f) {
    + if (typeof exports === "object" && typeof module !== "undefined") {
    + module.exports = f()
    + } else if (typeof define === "function" && define.amd) {
    + define([], f)
    + } else {
    + var g
    + if (typeof window !== "undefined") {
    + g = window
    + } else if (typeof global !== "undefined") {
    + g = global
    + } else if (typeof self !== "undefined") {
    + g = self
    + } else {
    + g = this
    + }
    + g.superagent = f()
    + }
    + })(function () {
    + var define, module, exports
    + return (function () {
    + function r(e, n, t) {
    + function o(i, f) {
    + if (!n[i]) {
    + if (!e[i]) {
    + var c = "function" == typeof require && require
    + if (!f && c) return c(i, !0)
    + if (u) return u(i, !0)
    + var a = new Error("Cannot find module '" + i + "'")
    + throw ((a.code = "MODULE_NOT_FOUND"), a)
    + }
    + var p = (n[i] = { exports: {} })
    + e[i][0].call(
    + p.exports,
    + function (r) {
    + var n = e[i][1][r]
    + return o(n || r)
    + },
    + p,
    + p.exports,
    + r,
    + e,
    + n,
    + t
    + )
    + }
    + return n[i].exports
    + }
    + for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) o(t[i])
    + return o
    + }
    + return r
    + })()(
    + {
    + 1: [
    + function (require, module, exports) {
    + "use strict"
    +
    + /**
    + * Expose `Emitter`.
    + */
    + if (typeof module !== "undefined") {
    + module.exports = Emitter
    + }
    + /**
    + * Initialize a new `Emitter`.
    + *
    + * @api public
    + */
    +
    + function Emitter(obj) {
    + if (obj) return mixin(obj)
    + }
    +
    + /**
    + * Mixin the emitter properties.
    + *
    + * @param {Object} obj
    + * @return {Object}
    + * @api private
    + */
    +
    + function mixin(obj) {
    + for (var key in Emitter.prototype) {
    + obj[key] = Emitter.prototype[key]
    + }
    +
    + return obj
    + }
    + /**
    + * Listen on the given `event` with `fn`.
    + *
    + * @param {String} event
    + * @param {Function} fn
    + * @return {Emitter}
    + * @api public
    + */
    +
    + Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
    + this._callbacks = this._callbacks || {}
    + ;(this._callbacks["$" + event] = this._callbacks["$" + event] || []).push(fn)
    + return this
    + }
    + /**
    + * Adds an `event` listener that will be invoked a single
    + * time then automatically removed.
    + *
    + * @param {String} event
    + * @param {Function} fn
    + * @return {Emitter}
    + * @api public
    + */
    +
    + Emitter.prototype.once = function (event, fn) {
    + function on() {
    + this.off(event, on)
    + fn.apply(this, arguments)
    + }
    +
    + on.fn = fn
    + this.on(event, on)
    + return this
    + }
    + /**
    + * Remove the given callback for `event` or all
    + * registered callbacks.
    + *
    + * @param {String} event
    + * @param {Function} fn
    + * @return {Emitter}
    + * @api public
    + */
    +
    + Emitter.prototype.off =
    + Emitter.prototype.removeListener =
    + Emitter.prototype.removeAllListeners =
    + Emitter.prototype.removeEventListener =
    + function (event, fn) {
    + this._callbacks = this._callbacks || {} // all
    +
    + if (0 == arguments.length) {
    + this._callbacks = {}
    + return this
    + } // specific event
    +
    + var callbacks = this._callbacks["$" + event]
    + if (!callbacks) return this // remove all handlers
    +
    + if (1 == arguments.length) {
    + delete this._callbacks["$" + event]
    + return this
    + } // remove specific handler
    +
    + var cb
    +
    + for (var i = 0; i < callbacks.length; i++) {
    + cb = callbacks[i]
    +
    + if (cb === fn || cb.fn === fn) {
    + callbacks.splice(i, 1)
    + break
    + }
    + } // Remove event specific arrays for event types that no
    + // one is subscribed for to avoid memory leak.
    +
    + if (callbacks.length === 0) {
    + delete this._callbacks["$" + event]
    + }
    +
    + return this
    + }
    + /**
    + * Emit `event` with the given args.
    + *
    + * @param {String} event
    + * @param {Mixed} ...
    + * @return {Emitter}
    + */
    +
    + Emitter.prototype.emit = function (event) {
    + this._callbacks = this._callbacks || {}
    + var args = new Array(arguments.length - 1),
    + callbacks = this._callbacks["$" + event]
    +
    + for (var i = 1; i < arguments.length; i++) {
    + args[i - 1] = arguments[i]
    + }
    +
    + if (callbacks) {
    + callbacks = callbacks.slice(0)
    +
    + for (var i = 0, len = callbacks.length; i < len; ++i) {
    + callbacks[i].apply(this, args)
    + }
    + }
    +
    + return this
    + }
    + /**
    + * Return array of callbacks for `event`.
    + *
    + * @param {String} event
    + * @return {Array}
    + * @api public
    + */
    +
    + Emitter.prototype.listeners = function (event) {
    + this._callbacks = this._callbacks || {}
    + return this._callbacks["$" + event] || []
    + }
    + /**
    + * Check if this emitter has `event` handlers.
    + *
    + * @param {String} event
    + * @return {Boolean}
    + * @api public
    + */
    +
    + Emitter.prototype.hasListeners = function (event) {
    + return !!this.listeners(event).length
    + }
    + },
    + {},
    + ],
    + 2: [
    + function (require, module, exports) {
    + "use strict"
    +
    + function _typeof(obj) {
    + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    + _typeof = function _typeof(obj) {
    + return typeof obj
    + }
    + } else {
    + _typeof = function _typeof(obj) {
    + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj
    + }
    + }
    + return _typeof(obj)
    + }
    +
    + module.exports = stringify
    + stringify.default = stringify
    + stringify.stable = deterministicStringify
    + stringify.stableStringify = deterministicStringify
    + var arr = [] // Regular stringify
    +
    + function stringify(obj, replacer, spacer) {
    + decirc(obj, "", [], undefined)
    + var res = JSON.stringify(obj, replacer, spacer)
    +
    + while (arr.length !== 0) {
    + var part = arr.pop()
    + part[0][part[1]] = part[2]
    + }
    +
    + return res
    + }
    +
    + function decirc(val, k, stack, parent) {
    + var i
    +
    + if (_typeof(val) === "object" && val !== null) {
    + for (i = 0; i < stack.length; i++) {
    + if (stack[i] === val) {
    + parent[k] = "[Circular]"
    + arr.push([parent, k, val])
    + return
    + }
    + }
    +
    + stack.push(val) // Optimize for Arrays. Big arrays could kill the performance otherwise!
    +
    + if (Array.isArray(val)) {
    + for (i = 0; i < val.length; i++) {
    + decirc(val[i], i, stack, val)
    + }
    + } else {
    + var keys = Object.keys(val)
    +
    + for (i = 0; i < keys.length; i++) {
    + var key = keys[i]
    + decirc(val[key], key, stack, val)
    + }
    + }
    +
    + stack.pop()
    + }
    + } // Stable-stringify
    +
    + function compareFunction(a, b) {
    + if (a < b) {
    + return -1
    + }
    +
    + if (a > b) {
    + return 1
    + }
    +
    + return 0
    + }
    +
    + function deterministicStringify(obj, replacer, spacer) {
    + var tmp = deterministicDecirc(obj, "", [], undefined) || obj
    + var res = JSON.stringify(tmp, replacer, spacer)
    +
    + while (arr.length !== 0) {
    + var part = arr.pop()
    + part[0][part[1]] = part[2]
    + }
    +
    + return res
    + }
    +
    + function deterministicDecirc(val, k, stack, parent) {
    + var i
    +
    + if (_typeof(val) === "object" && val !== null) {
    + for (i = 0; i < stack.length; i++) {
    + if (stack[i] === val) {
    + parent[k] = "[Circular]"
    + arr.push([parent, k, val])
    + return
    + }
    + }
    +
    + if (typeof val.toJSON === "function") {
    + return
    + }
    +
    + stack.push(val) // Optimize for Arrays. Big arrays could kill the performance otherwise!
    +
    + if (Array.isArray(val)) {
    + for (i = 0; i < val.length; i++) {
    + deterministicDecirc(val[i], i, stack, val)
    + }
    + } else {
    + // Create a temporary object in the required way
    + var tmp = {}
    + var keys = Object.keys(val).sort(compareFunction)
    +
    + for (i = 0; i < keys.length; i++) {
    + var key = keys[i]
    + deterministicDecirc(val[key], key, stack, val)
    + tmp[key] = val[key]
    + }
    +
    + if (parent !== undefined) {
    + arr.push([parent, k, val])
    + parent[k] = tmp
    + } else {
    + return tmp
    + }
    + }
    +
    + stack.pop()
    + }
    + }
    + },
    + {},
    + ],
    + 3: [
    + function (require, module, exports) {
    + "use strict"
    +
    + function _toConsumableArray(arr) {
    + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread()
    + }
    +
    + function _nonIterableSpread() {
    + throw new TypeError("Invalid attempt to spread non-iterable instance")
    + }
    +
    + function _iterableToArray(iter) {
    + if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter)
    + }
    +
    + function _arrayWithoutHoles(arr) {
    + if (Array.isArray(arr)) {
    + for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
    + arr2[i] = arr[i]
    + }
    + return arr2
    + }
    + }
    +
    + function Agent() {
    + this._defaults = []
    + }
    +
    + ;[
    + "use",
    + "on",
    + "once",
    + "set",
    + "query",
    + "type",
    + "accept",
    + "auth",
    + "withCredentials",
    + "sortQuery",
    + "retry",
    + "ok",
    + "redirects",
    + "timeout",
    + "buffer",
    + "serialize",
    + "parse",
    + "ca",
    + "key",
    + "pfx",
    + "cert",
    + ].forEach(function (fn) {
    + // Default setting for all requests from this agent
    + Agent.prototype[fn] = function () {
    + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
    + args[_key] = arguments[_key]
    + }
    +
    + this._defaults.push({
    + fn: fn,
    + args: args,
    + })
    +
    + return this
    + }
    + })
    +
    + Agent.prototype._setDefaults = function (req) {
    + this._defaults.forEach(function (def) {
    + req[def.fn].apply(req, _toConsumableArray(def.args))
    + })
    + }
    +
    + module.exports = Agent
    + },
    + {},
    + ],
    + 4: [
    + function (require, module, exports) {
    + "use strict"
    +
    + function _typeof(obj) {
    + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    + _typeof = function _typeof(obj) {
    + return typeof obj
    + }
    + } else {
    + _typeof = function _typeof(obj) {
    + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj
    + }
    + }
    + return _typeof(obj)
    + }
    +
    + /**
    + * Check if `obj` is an object.
    + *
    + * @param {Object} obj
    + * @return {Boolean}
    + * @api private
    + */
    + function isObject(obj) {
    + return obj !== null && _typeof(obj) === "object"
    + }
    +
    + module.exports = isObject
    + },
    + {},
    + ],
    + 5: [
    + function (require, module, exports) {
    + "use strict"
    +
    + function _typeof(obj) {
    + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    + _typeof = function _typeof(obj) {
    + return typeof obj
    + }
    + } else {
    + _typeof = function _typeof(obj) {
    + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj
    + }
    + }
    + return _typeof(obj)
    + }
    +
    + /**
    + * Root reference for iframes.
    + */
    + var root
    +
    + if (typeof window !== "undefined") {
    + // Browser window
    + root = window
    + } else if (typeof self === "undefined") {
    + // Other environments
    + console.warn("Using browser-only version of superagent in non-browser environment")
    + root = void 0
    + } else {
    + // Web Worker
    + root = self
    + }
    +
    + var Emitter = require("component-emitter")
    +
    + var safeStringify = require("fast-safe-stringify")
    +
    + var RequestBase = require("./request-base")
    +
    + var isObject = require("./is-object")
    +
    + var ResponseBase = require("./response-base")
    +
    + var Agent = require("./agent-base")
    + /**
    + * Noop.
    + */
    +
    + function noop() {}
    + /**
    + * Expose `request`.
    + */
    +
    + module.exports = function (method, url) {
    + // callback
    + if (typeof url === "function") {
    + return new exports.Request("GET", method).end(url)
    + } // url first
    +
    + if (arguments.length === 1) {
    + return new exports.Request("GET", method)
    + }
    +
    + return new exports.Request(method, url)
    + }
    +
    + exports = module.exports
    + var request = exports
    + exports.Request = Request
    + /**
    + * Determine XHR.
    + */
    +
    + request.getXHR = function () {
    + if (root.XMLHttpRequest && (!root.location || root.location.protocol !== "file:" || !root.ActiveXObject)) {
    + return new XMLHttpRequest()
    + }
    +
    + try {
    + return new ActiveXObject("Microsoft.XMLHTTP")
    + } catch (err) {}
    +
    + try {
    + return new ActiveXObject("Msxml2.XMLHTTP.6.0")
    + } catch (err) {}
    +
    + try {
    + return new ActiveXObject("Msxml2.XMLHTTP.3.0")
    + } catch (err) {}
    +
    + try {
    + return new ActiveXObject("Msxml2.XMLHTTP")
    + } catch (err) {}
    +
    + throw new Error("Browser-only version of superagent could not find XHR")
    + }
    + /**
    + * Removes leading and trailing whitespace, added to support IE.
    + *
    + * @param {String} s
    + * @return {String}
    + * @api private
    + */
    +
    + var trim = "".trim
    + ? function (s) {
    + return s.trim()
    + }
    + : function (s) {
    + return s.replace(/(^\s*|\s*$)/g, "")
    + }
    + /**
    + * Serialize the given `obj`.
    + *
    + * @param {Object} obj
    + * @return {String}
    + * @api private
    + */
    +
    + function serialize(obj) {
    + if (!isObject(obj)) return obj
    + var pairs = []
    +
    + for (var key in obj) {
    + if (Object.prototype.hasOwnProperty.call(obj, key)) pushEncodedKeyValuePair(pairs, key, obj[key])
    + }
    +
    + return pairs.join("&")
    + }
    + /**
    + * Helps 'serialize' with serializing arrays.
    + * Mutates the pairs array.
    + *
    + * @param {Array} pairs
    + * @param {String} key
    + * @param {Mixed} val
    + */
    +
    + function pushEncodedKeyValuePair(pairs, key, val) {
    + if (val === undefined) return
    +
    + if (val === null) {
    + pairs.push(encodeURIComponent(key))
    + return
    + }
    +
    + if (Array.isArray(val)) {
    + val.forEach(function (v) {
    + pushEncodedKeyValuePair(pairs, key, v)
    + })
    + } else if (isObject(val)) {
    + for (var subkey in val) {
    + if (Object.prototype.hasOwnProperty.call(val, subkey)) pushEncodedKeyValuePair(pairs, "".concat(key, "[").concat(subkey, "]"), val[subkey])
    + }
    + } else {
    + pairs.push(encodeURIComponent(key) + "=" + encodeURIComponent(val))
    + }
    + }
    + /**
    + * Expose serialization method.
    + */
    +
    + request.serializeObject = serialize
    + /**
    + * Parse the given x-www-form-urlencoded `str`.
    + *
    + * @param {String} str
    + * @return {Object}
    + * @api private
    + */
    +
    + function parseString(str) {
    + var obj = {}
    + var pairs = str.split("&")
    + var pair
    + var pos
    +
    + for (var i = 0, len = pairs.length; i < len; ++i) {
    + pair = pairs[i]
    + pos = pair.indexOf("=")
    +
    + if (pos === -1) {
    + obj[decodeURIComponent(pair)] = ""
    + } else {
    + obj[decodeURIComponent(pair.slice(0, pos))] = decodeURIComponent(pair.slice(pos + 1))
    + }
    + }
    +
    + return obj
    + }
    + /**
    + * Expose parser.
    + */
    +
    + request.parseString = parseString
    + /**
    + * Default MIME type map.
    + *
    + * superagent.types.xml = 'application/xml';
    + *
    + */
    +
    + request.types = {
    + html: "text/html",
    + json: "application/json",
    + xml: "text/xml",
    + urlencoded: "application/x-www-form-urlencoded",
    + form: "application/x-www-form-urlencoded",
    + "form-data": "application/x-www-form-urlencoded",
    + }
    + /**
    + * Default serialization map.
    + *
    + * superagent.serialize['application/xml'] = function(obj){
    + * return 'generated xml here';
    + * };
    + *
    + */
    +
    + request.serialize = {
    + "application/x-www-form-urlencoded": serialize,
    + "application/json": safeStringify,
    + }
    + /**
    + * Default parsers.
    + *
    + * superagent.parse['application/xml'] = function(str){
    + * return { object parsed from str };
    + * };
    + *
    + */
    +
    + request.parse = {
    + "application/x-www-form-urlencoded": parseString,
    + "application/json": JSON.parse,
    + }
    + /**
    + * Parse the given header `str` into
    + * an object containing the mapped fields.
    + *
    + * @param {String} str
    + * @return {Object}
    + * @api private
    + */
    +
    + function parseHeader(str) {
    + var lines = str.split(/\r?\n/)
    + var fields = {}
    + var index
    + var line
    + var field
    + var val
    +
    + for (var i = 0, len = lines.length; i < len; ++i) {
    + line = lines[i]
    + index = line.indexOf(":")
    +
    + if (index === -1) {
    + // could be empty line, just skip it
    + continue
    + }
    +
    + field = line.slice(0, index).toLowerCase()
    + val = trim(line.slice(index + 1))
    + fields[field] = val
    + }
    +
    + return fields
    + }
    + /**
    + * Check if `mime` is json or has +json structured syntax suffix.
    + *
    + * @param {String} mime
    + * @return {Boolean}
    + * @api private
    + */
    +
    + function isJSON(mime) {
    + // should match /json or +json
    + // but not /json-seq
    + return /[/+]json($|[^-\w])/.test(mime)
    + }
    + /**
    + * Initialize a new `Response` with the given `xhr`.
    + *
    + * - set flags (.ok, .error, etc)
    + * - parse header
    + *
    + * Examples:
    + *
    + * Aliasing `superagent` as `request` is nice:
    + *
    + * request = superagent;
    + *
    + * We can use the promise-like API, or pass callbacks:
    + *
    + * request.get('/').end(function(res){});
    + * request.get('/', function(res){});
    + *
    + * Sending data can be chained:
    + *
    + * request
    + * .post('/user')
    + * .send({ name: 'tj' })
    + * .end(function(res){});
    + *
    + * Or passed to `.send()`:
    + *
    + * request
    + * .post('/user')
    + * .send({ name: 'tj' }, function(res){});
    + *
    + * Or passed to `.post()`:
    + *
    + * request
    + * .post('/user', { name: 'tj' })
    + * .end(function(res){});
    + *
    + * Or further reduced to a single call for simple cases:
    + *
    + * request
    + * .post('/user', { name: 'tj' }, function(res){});
    + *
    + * @param {XMLHTTPRequest} xhr
    + * @param {Object} options
    + * @api private
    + */
    +
    + function Response(req) {
    + this.req = req
    + this.xhr = this.req.xhr // responseText is accessible only if responseType is '' or 'text' and on older browsers
    +
    + this.text =
    + (this.req.method !== "HEAD" && (this.xhr.responseType === "" || this.xhr.responseType === "text")) || typeof this.xhr.responseType === "undefined"
    + ? this.xhr.responseText
    + : null
    + this.statusText = this.req.xhr.statusText
    + var status = this.xhr.status // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request
    +
    + if (status === 1223) {
    + status = 204
    + }
    +
    + this._setStatusProperties(status)
    +
    + this.headers = parseHeader(this.xhr.getAllResponseHeaders())
    + this.header = this.headers // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but
    + // getResponseHeader still works. so we get content-type even if getting
    + // other headers fails.
    +
    + this.header["content-type"] = this.xhr.getResponseHeader("content-type")
    +
    + this._setHeaderProperties(this.header)
    +
    + if (this.text === null && req._responseType) {
    + this.body = this.xhr.response
    + } else {
    + this.body = this.req.method === "HEAD" ? null : this._parseBody(this.text ? this.text : this.xhr.response)
    + }
    + } // eslint-disable-next-line new-cap
    +
    + ResponseBase(Response.prototype)
    + /**
    + * Parse the given body `str`.
    + *
    + * Used for auto-parsing of bodies. Parsers
    + * are defined on the `superagent.parse` object.
    + *
    + * @param {String} str
    + * @return {Mixed}
    + * @api private
    + */
    +
    + Response.prototype._parseBody = function (str) {
    + var parse = request.parse[this.type]
    +
    + if (this.req._parser) {
    + return this.req._parser(this, str)
    + }
    +
    + if (!parse && isJSON(this.type)) {
    + parse = request.parse["application/json"]
    + }
    +
    + return parse && str && (str.length > 0 || str instanceof Object) ? parse(str) : null
    + }
    + /**
    + * Return an `Error` representative of this response.
    + *
    + * @return {Error}
    + * @api public
    + */
    +
    + Response.prototype.toError = function () {
    + var req = this.req
    + var method = req.method
    + var url = req.url
    + var msg = "cannot ".concat(method, " ").concat(url, " (").concat(this.status, ")")
    + var err = new Error(msg)
    + err.status = this.status
    + err.method = method
    + err.url = url
    + return err
    + }
    + /**
    + * Expose `Response`.
    + */
    +
    + request.Response = Response
    + /**
    + * Initialize a new `Request` with the given `method` and `url`.
    + *
    + * @param {String} method
    + * @param {String} url
    + * @api public
    + */
    +
    + function Request(method, url) {
    + var self = this
    + this._query = this._query || []
    + this.method = method
    + this.url = url
    + this.header = {} // preserves header name case
    +
    + this._header = {} // coerces header names to lowercase
    +
    + this.on("end", function () {
    + var err = null
    + var res = null
    +
    + try {
    + res = new Response(self)
    + } catch (err2) {
    + err = new Error("Parser is unable to parse the response")
    + err.parse = true
    + err.original = err2 // issue #675: return the raw response if the response parsing fails
    +
    + if (self.xhr) {
    + // ie9 doesn't have 'response' property
    + err.rawResponse = typeof self.xhr.responseType === "undefined" ? self.xhr.responseText : self.xhr.response // issue #876: return the http status code if the response parsing fails
    +
    + err.status = self.xhr.status ? self.xhr.status : null
    + err.statusCode = err.status // backwards-compat only
    + } else {
    + err.rawResponse = null
    + err.status = null
    + }
    +
    + return self.callback(err)
    + }
    +
    + self.emit("response", res)
    + var new_err
    +
    + try {
    + if (!self._isResponseOK(res)) {
    + new_err = new Error(res.statusText || "Unsuccessful HTTP response")
    + }
    + } catch (err2) {
    + new_err = err2 // ok() callback can throw
    + } // #1000 don't catch errors from the callback to avoid double calling it
    +
    + if (new_err) {
    + new_err.original = err
    + new_err.response = res
    + new_err.status = res.status
    + self.callback(new_err, res)
    + } else {
    + self.callback(null, res)
    + }
    + })
    + }
    + /**
    + * Mixin `Emitter` and `RequestBase`.
    + */
    + // eslint-disable-next-line new-cap
    +
    + Emitter(Request.prototype) // eslint-disable-next-line new-cap
    +
    + RequestBase(Request.prototype)
    + /**
    + * Set Content-Type to `type`, mapping values from `request.types`.
    + *
    + * Examples:
    + *
    + * superagent.types.xml = 'application/xml';
    + *
    + * request.post('/')
    + * .type('xml')
    + * .send(xmlstring)
    + * .end(callback);
    + *
    + * request.post('/')
    + * .type('application/xml')
    + * .send(xmlstring)
    + * .end(callback);
    + *
    + * @param {String} type
    + * @return {Request} for chaining
    + * @api public
    + */
    +
    + Request.prototype.type = function (type) {
    + this.set("Content-Type", request.types[type] || type)
    + return this
    + }
    + /**
    + * Set Accept to `type`, mapping values from `request.types`.
    + *
    + * Examples:
    + *
    + * superagent.types.json = 'application/json';
    + *
    + * request.get('/agent')
    + * .accept('json')
    + * .end(callback);
    + *
    + * request.get('/agent')
    + * .accept('application/json')
    + * .end(callback);
    + *
    + * @param {String} accept
    + * @return {Request} for chaining
    + * @api public
    + */
    +
    + Request.prototype.accept = function (type) {
    + this.set("Accept", request.types[type] || type)
    + return this
    + }
    + /**
    + * Set Authorization field value with `user` and `pass`.
    + *
    + * @param {String} user
    + * @param {String} [pass] optional in case of using 'bearer' as type
    + * @param {Object} options with 'type' property 'auto', 'basic' or 'bearer' (default 'basic')
    + * @return {Request} for chaining
    + * @api public
    + */
    +
    + Request.prototype.auth = function (user, pass, options) {
    + if (arguments.length === 1) pass = ""
    +
    + if (_typeof(pass) === "object" && pass !== null) {
    + // pass is optional and can be replaced with options
    + options = pass
    + pass = ""
    + }
    +
    + if (!options) {
    + options = {
    + type: typeof btoa === "function" ? "basic" : "auto",
    + }
    + }
    +
    + var encoder = function encoder(string) {
    + if (typeof btoa === "function") {
    + return btoa(string)
    + }
    +
    + throw new Error("Cannot use basic auth, btoa is not a function")
    + }
    +
    + return this._auth(user, pass, options, encoder)
    + }
    + /**
    + * Add query-string `val`.
    + *
    + * Examples:
    + *
    + * request.get('/shoes')
    + * .query('size=10')
    + * .query({ color: 'blue' })
    + *
    + * @param {Object|String} val
    + * @return {Request} for chaining
    + * @api public
    + */
    +
    + Request.prototype.query = function (val) {
    + if (typeof val !== "string") val = serialize(val)
    + if (val) this._query.push(val)
    + return this
    + }
    + /**
    + * Queue the given `file` as an attachment to the specified `field`,
    + * with optional `options` (or filename).
    + *
    + * ``` js
    + * request.post('/upload')
    + * .attach('content', new Blob(['hey!'], { type: "text/html"}))
    + * .end(callback);
    + * ```
    + *
    + * @param {String} field
    + * @param {Blob|File} file
    + * @param {String|Object} options
    + * @return {Request} for chaining
    + * @api public
    + */
    +
    + Request.prototype.attach = function (field, file, options) {
    + if (file) {
    + if (this._data) {
    + throw new Error("superagent can't mix .send() and .attach()")
    + }
    +
    + this._getFormData().append(field, file, options || file.name)
    + }
    +
    + return this
    + }
    +
    + Request.prototype._getFormData = function () {
    + if (!this._formData) {
    + this._formData = new root.FormData()
    + }
    +
    + return this._formData
    + }
    + /**
    + * Invoke the callback with `err` and `res`
    + * and handle arity check.
    + *
    + * @param {Error} err
    + * @param {Response} res
    + * @api private
    + */
    +
    + Request.prototype.callback = function (err, res) {
    + if (this._shouldRetry(err, res)) {
    + return this._retry()
    + }
    +
    + var fn = this._callback
    + this.clearTimeout()
    +
    + if (err) {
    + if (this._maxRetries) err.retries = this._retries - 1
    + this.emit("error", err)
    + }
    +
    + fn(err, res)
    + }
    + /**
    + * Invoke callback with x-domain error.
    + *
    + * @api private
    + */
    +
    + Request.prototype.crossDomainError = function () {
    + var err = new Error(
    + "Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc."
    + )
    + err.crossDomain = true
    + err.status = this.status
    + err.method = this.method
    + err.url = this.url
    + this.callback(err)
    + } // This only warns, because the request is still likely to work
    +
    + Request.prototype.agent = function () {
    + console.warn("This is not supported in browser version of superagent")
    + return this
    + }
    +
    + Request.prototype.buffer = Request.prototype.ca
    + Request.prototype.ca = Request.prototype.agent // This throws, because it can't send/receive data as expected
    +
    + Request.prototype.write = function () {
    + throw new Error("Streaming is not supported in browser version of superagent")
    + }
    +
    + Request.prototype.pipe = Request.prototype.write
    + /**
    + * Check if `obj` is a host object,
    + * we don't want to serialize these :)
    + *
    + * @param {Object} obj host object
    + * @return {Boolean} is a host object
    + * @api private
    + */
    +
    + Request.prototype._isHost = function (obj) {
    + // Native objects stringify to [object File], [object Blob], [object FormData], etc.
    + return obj && _typeof(obj) === "object" && !Array.isArray(obj) && Object.prototype.toString.call(obj) !== "[object Object]"
    + }
    + /**
    + * Initiate request, invoking callback `fn(res)`
    + * with an instanceof `Response`.
    + *
    + * @param {Function} fn
    + * @return {Request} for chaining
    + * @api public
    + */
    +
    + Request.prototype.end = function (fn) {
    + if (this._endCalled) {
    + console.warn("Warning: .end() was called twice. This is not supported in superagent")
    + }
    +
    + this._endCalled = true // store callback
    +
    + this._callback = fn || noop // querystring
    +
    + this._finalizeQueryString()
    +
    + this._end()
    + }
    +
    + Request.prototype._setUploadTimeout = function () {
    + var self = this // upload timeout it's wokrs only if deadline timeout is off
    +
    + if (this._uploadTimeout && !this._uploadTimeoutTimer) {
    + this._uploadTimeoutTimer = setTimeout(function () {
    + self._timeoutError("Upload timeout of ", self._uploadTimeout, "ETIMEDOUT")
    + }, this._uploadTimeout)
    + }
    + } // eslint-disable-next-line complexity
    +
    + Request.prototype._end = function () {
    + if (this._aborted) return this.callback(new Error("The request has been aborted even before .end() was called"))
    + var self = this
    + this.xhr = request.getXHR()
    + var xhr = this.xhr
    + var data = this._formData || this._data
    +
    + this._setTimeouts() // state change
    +
    + xhr.onreadystatechange = function () {
    + var readyState = xhr.readyState
    +
    + if (readyState >= 2 && self._responseTimeoutTimer) {
    + clearTimeout(self._responseTimeoutTimer)
    + }
    +
    + if (readyState !== 4) {
    + return
    + } // In IE9, reads to any property (e.g. status) off of an aborted XHR will
    + // result in the error "Could not complete the operation due to error c00c023f"
    +
    + var status
    +
    + try {
    + status = xhr.status
    + } catch (err) {
    + status = 0
    + }
    +
    + if (!status) {
    + if (self.timedout || self._aborted) return
    + return self.crossDomainError()
    + }
    +
    + self.emit("end")
    + } // progress
    +
    + var handleProgress = function handleProgress(direction, e) {
    + if (e.total > 0) {
    + e.percent = (e.loaded / e.total) * 100
    +
    + if (e.percent === 100) {
    + clearTimeout(self._uploadTimeoutTimer)
    + }
    + }
    +
    + e.direction = direction
    + self.emit("progress", e)
    + }
    +
    + if (this.hasListeners("progress")) {
    + try {
    + xhr.addEventListener("progress", handleProgress.bind(null, "download"))
    +
    + if (xhr.upload) {
    + xhr.upload.addEventListener("progress", handleProgress.bind(null, "upload"))
    + }
    + } catch (err) {
    + // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.
    + // Reported here:
    + // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context
    + }
    + }
    +
    + if (xhr.upload) {
    + this._setUploadTimeout()
    + } // initiate request
    +
    + try {
    + if (this.username && this.password) {
    + xhr.open(this.method, this.url, true, this.username, this.password)
    + } else {
    + xhr.open(this.method, this.url, true)
    + }
    + } catch (err) {
    + // see #1149
    + return this.callback(err)
    + } // CORS
    +
    + if (this._withCredentials) xhr.withCredentials = true // body
    +
    + if (!this._formData && this.method !== "GET" && this.method !== "HEAD" && typeof data !== "string" && !this._isHost(data)) {
    + // serialize stuff
    + var contentType = this._header["content-type"]
    +
    + var _serialize = this._serializer || request.serialize[contentType ? contentType.split(";")[0] : ""]
    +
    + if (!_serialize && isJSON(contentType)) {
    + _serialize = request.serialize["application/json"]
    + }
    +
    + if (_serialize) data = _serialize(data)
    + } // set header fields
    +
    + for (var field in this.header) {
    + if (this.header[field] === null) continue
    + if (Object.prototype.hasOwnProperty.call(this.header, field)) xhr.setRequestHeader(field, this.header[field])
    + }
    +
    + if (this._responseType) {
    + xhr.responseType = this._responseType
    + } // send stuff
    +
    + this.emit("request", this) // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)
    + // We need null here if data is undefined
    +
    + xhr.send(typeof data === "undefined" ? null : data)
    + }
    +
    + request.agent = function () {
    + return new Agent()
    + }
    + ;["GET", "POST", "OPTIONS", "PATCH", "PUT", "DELETE"].forEach(function (method) {
    + Agent.prototypeethod.toLowerCase()] = function (url, fn) {
    + var req = new request.Request(method, url)
    +
    + this._setDefaults(req)
    +
    + if (fn) {
    + req.end(fn)
    + }
    +
    + return req
    + }
    + })
    + Agent.prototype.del = Agent.prototype.delete
    + /**
    + * GET `url` with optional callback `fn(res)`.
    + *
    + * @param {String} url
    + * @param {Mixed|Function} [data] or fn
    + * @param {Function} [fn]
    + * @return {Request}
    + * @api public
    + */
    +
    + request.get = function (url, data, fn) {
    + var req = request("GET", url)
    +
    + if (typeof data === "function") {
    + fn = data
    + data = null
    + }
    +
    + if (data) req.query(data)
    + if (fn) req.end(fn)
    + return req
    + }
    + /**
    + * HEAD `url` with optional callback `fn(res)`.
    + *
    + * @param {String} url
    + * @param {Mixed|Function} [data] or fn
    + * @param {Function} [fn]
    + * @return {Request}
    + * @api public
    + */
    +
    + request.head = function (url, data, fn) {
    + var req = request("HEAD", url)
    +
    + if (typeof data === "function") {
    + fn = data
    + data = null
    + }
    +
    + if (data) req.query(data)
    + if (fn) req.end(fn)
    + return req
    + }
    + /**
    + * OPTIONS query to `url` with optional callback `fn(res)`.
    + *
    + * @param {String} url
    + * @param {Mixed|Function} [data] or fn
    + * @param {Function} [fn]
    + * @return {Request}
    + * @api public
    + */
    +
    + request.options = function (url, data, fn) {
    + var req = request("OPTIONS", url)
    +
    + if (typeof data === "function") {
    + fn = data
    + data = null
    + }
    +
    + if (data) req.send(data)
    + if (fn) req.end(fn)
    + return req
    + }
    + /**
    + * DELETE `url` with optional `data` and callback `fn(res)`.
    + *
    + * @param {String} url
    + * @param {Mixed} [data]
    + * @param {Function} [fn]
    + * @return {Request}
    + * @api public
    + */
    +
    + function del(url, data, fn) {
    + var req = request("DELETE", url)
    +
    + if (typeof data === "function") {
    + fn = data
    + data = null
    + }
    +
    + if (data) req.send(data)
    + if (fn) req.end(fn)
    + return req
    + }
    +
    + request.del = del
    + request.delete = del
    + /**
    + * PATCH `url` with optional `data` and callback `fn(res)`.
    + *
    + * @param {String} url
    + * @param {Mixed} [data]
    + * @param {Function} [fn]
    + * @return {Request}
    + * @api public
    + */
    +
    + request.patch = function (url, data, fn) {
    + var req = request("PATCH", url)
    +
    + if (typeof data === "function") {
    + fn = data
    + data = null
    + }
    +
    + if (data) req.send(data)
    + if (fn) req.end(fn)
    + return req
    + }
    + /**
    + * POST `url` with optional `data` and callback `fn(res)`.
    + *
    + * @param {String} url
    + * @param {Mixed} [data]
    + * @param {Function} [fn]
    + * @return {Request}
    + * @api public
    + */
    +
    + request.post = function (url, data, fn) {
    + var req = request("POST", url)
    +
    + if (typeof data === "function") {
    + fn = data
    + data = null
    + }
    +
    + if (data) req.send(data)
    + if (fn) req.end(fn)
    + return req
    + }
    + /**
    + * PUT `url` with optional `data` and callback `fn(res)`.
    + *
    + * @param {String} url
    + * @param {Mixed|Function} [data] or fn
    + * @param {Function} [fn]
    + * @return {Request}
    + * @api public
    + */
    +
    + request.put = function (url, data, fn) {
    + var req = request("PUT", url)
    +
    + if (typeof data === "function") {
    + fn = data
    + data = null
    + }
    +
    + if (data) req.send(data)
    + if (fn) req.end(fn)
    + return req
    + }
    + },
    + { "./agent-base": 3, "./is-object": 4, "./request-base": 6, "./response-base": 7, "component-emitter": 1, "fast-safe-stringify": 2 },
    + ],
    + 6: [
    + function (require, module, exports) {
    + "use strict"
    +
    + function _typeof(obj) {
    + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    + _typeof = function _typeof(obj) {
    + return typeof obj
    + }
    + } else {
    + _typeof = function _typeof(obj) {
    + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj
    + }
    + }
    + return _typeof(obj)
    + }
    +
    + /**
    + * Module of mixed-in functions shared between node and client code
    + */
    + var isObject = require("./is-object")
    + /**
    + * Expose `RequestBase`.
    + */
    +
    + module.exports = RequestBase
    + /**
    + * Initialize a new `RequestBase`.
    + *
    + * @api public
    + */
    +
    + function RequestBase(obj) {
    + if (obj) return mixin(obj)
    + }
    + /**
    + * Mixin the prototype properties.
    + *
    + * @param {Object} obj
    + * @return {Object}
    + * @api private
    + */
    +
    + function mixin(obj) {
    + for (var key in RequestBase.prototype) {
    + if (Object.prototype.hasOwnProperty.call(RequestBase.prototype, key)) obj[key] = RequestBase.prototype[key]
    + }
    +
    + return obj
    + }
    + /**
    + * Clear previous timeout.
    + *
    + * @return {Request} for chaining
    + * @api public
    + */
    +
    + RequestBase.prototype.clearTimeout = function () {
    + clearTimeout(this._timer)
    + clearTimeout(this._responseTimeoutTimer)
    + clearTimeout(this._uploadTimeoutTimer)
    + delete this._timer
    + delete this._responseTimeoutTimer
    + delete this._uploadTimeoutTimer
    + return this
    + }
    + /**
    + * Override default response body parser
    + *
    + * This function will be called to convert incoming data into request.body
    + *
    + * @param {Function}
    + * @api public
    + */
    +
    + RequestBase.prototype.parse = function (fn) {
    + this._parser = fn
    + return this
    + }
    + /**
    + * Set format of binary response body.
    + * In browser valid formats are 'blob' and 'arraybuffer',
    + * which return Blob and ArrayBuffer, respectively.
    + *
    + * In Node all values result in Buffer.
    + *
    + * Examples:
    + *
    + * req.get('/')
    + * .responseType('blob')
    + * .end(callback);
    + *
    + * @param {String} val
    + * @return {Request} for chaining
    + * @api public
    + */
    +
    + RequestBase.prototype.responseType = function (val) {
    + this._responseType = val
    + return this
    + }
    + /**
    + * Override default request body serializer
    + *
    + * This function will be called to convert data set via .send or .attach into payload to send
    + *
    + * @param {Function}
    + * @api public
    + */
    +
    + RequestBase.prototype.serialize = function (fn) {
    + this._serializer = fn
    + return this
    + }
    + /**
    + * Set timeouts.
    + *
    + * - response timeout is time between sending request and receiving the first byte of the response. Includes DNS and connection time.
    + * - deadline is the time from start of the request to receiving response body in full. If the deadline is too short large files may not load at all on slow connections.
    + * - upload is the time since last bit of data was sent or received. This timeout works only if deadline timeout is off
    + *
    + * Value of 0 or false means no timeout.
    + *
    + * @param {Number|Object} ms or {response, deadline}
    + * @return {Request} for chaining
    + * @api public
    + */
    +
    + RequestBase.prototype.timeout = function (options) {
    + if (!options || _typeof(options) !== "object") {
    + this._timeout = options
    + this._responseTimeout = 0
    + this._uploadTimeout = 0
    + return this
    + }
    +
    + for (var option in options) {
    + if (Object.prototype.hasOwnProperty.call(options, option)) {
    + switch (option) {
    + case "deadline":
    + this._timeout = options.deadline
    + break
    +
    + case "response":
    + this._responseTimeout = options.response
    + break
    +
    + case "upload":
    + this._uploadTimeout = options.upload
    + break
    +
    + default:
    + console.warn("Unknown timeout option", option)
    + }
    + }
    + }
    +
    + return this
    + }
    + /**
    + * Set number of retry attempts on error.
    + *
    + * Failed requests will be retried 'count' times if timeout or err.code >= 500.
    + *
    + * @param {Number} count
    + * @param {Function} [fn]
    + * @return {Request} for chaining
    + * @api public
    + */
    +
    + RequestBase.prototype.retry = function (count, fn) {
    + // Default to 1 if no count passed or true
    + if (arguments.length === 0 || count === true) count = 1
    + if (count <= 0) count = 0
    + this._maxRetries = count
    + this._retries = 0
    + this._retryCallback = fn
    + return this
    + }
    +
    + var ERROR_CODES = ["ECONNRESET", "ETIMEDOUT", "EADDRINFO", "ESOCKETTIMEDOUT"]
    + /**
    + * Determine if a request should be retried.
    + * (Borrowed from segmentio/superagent-retry)
    + *
    + * @param {Error} err an error
    + * @param {Response} [res] response
    + * @returns {Boolean} if segment should be retried
    + */
    +
    + RequestBase.prototype._shouldRetry = function (err, res) {
    + if (!this._maxRetries || this._retries++ >= this._maxRetries) {
    + return false
    + }
    +
    + if (this._retryCallback) {
    + try {
    + var override = this._retryCallback(err, res)
    +
    + if (override === true) return true
    + if (override === false) return false // undefined falls back to defaults
    + } catch (err2) {
    + console.error(err2)
    + }
    + }
    +
    + if (res && res.status && res.status >= 500 && res.status !== 501) return true
    +
    + if (err) {
    + if (err.code && ERROR_CODES.indexOf(err.code) !== -1) return true // Superagent timeout
    +
    + if (err.timeout && err.code === "ECONNABORTED") return true
    + if (err.crossDomain) return true
    + }
    +
    + return false
    + }
    + /**
    + * Retry request
    + *
    + * @return {Request} for chaining
    + * @api private
    + */
    +
    + RequestBase.prototype._retry = function () {
    + this.clearTimeout() // node
    +
    + if (this.req) {
    + this.req = null
    + this.req = this.request()
    + }
    +
    + this._aborted = false
    + this.timedout = false
    + return this._end()
    + }
    + /**
    + * Promise support
    + *
    + * @param {Function} resolve
    + * @param {Function} [reject]
    + * @return {Request}
    + */
    +
    + RequestBase.prototype.then = function (resolve, reject) {
    + var _this = this
    +
    + if (!this._fullfilledPromise) {
    + var self = this
    +
    + if (this._endCalled) {
    + console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises")
    + }
    +
    + this._fullfilledPromise = new Promise(function (resolve, reject) {
    + self.on("abort", function () {
    + var err = new Error("Aborted")
    + err.code = "ABORTED"
    + err.status = _this.status
    + err.method = _this.method
    + err.url = _this.url
    + reject(err)
    + })
    + self.end(function (err, res) {
    + if (err) reject(err)
    + else resolve(res)
    + })
    + })
    + }
    +
    + return this._fullfilledPromise.then(resolve, reject)
    + }
    +
    + RequestBase.prototype.catch = function (cb) {
    + return this.then(undefined, cb)
    + }
    + /**
    + * Allow for extension
    + */
    +
    + RequestBase.prototype.use = function (fn) {
    + fn(this)
    + return this
    + }
    +
    + RequestBase.prototype.ok = function (cb) {
    + if (typeof cb !== "function") throw new Error("Callback required")
    + this._okCallback = cb
    + return this
    + }
    +
    + RequestBase.prototype._isResponseOK = function (res) {
    + if (!res) {
    + return false
    + }
    +
    + if (this._okCallback) {
    + return this._okCallback(res)
    + }
    +
    + return res.status >= 200 && res.status < 300
    + }
    + /**
    + * Get request header `field`.
    + * Case-insensitive.
    + *
    + * @param {String} field
    + * @return {String}
    + * @api public
    + */
    +
    + RequestBase.prototype.get = function (field) {
    + return this._header[field.toLowerCase()]
    + }
    + /**
    + * Get case-insensitive header `field` value.
    + * This is a deprecated internal API. Use `.get(field)` instead.
    + *
    + * (getHeader is no longer used internally by the superagent code base)
    + *
    + * @param {String} field
    + * @return {String}
    + * @api private
    + * @deprecated
    + */
    +
    + RequestBase.prototype.getHeader = RequestBase.prototype.get
    + /**
    + * Set header `field` to `val`, or multiple fields with one object.
    + * Case-insensitive.
    + *
    + * Examples:
    + *
    + * req.get('/')
    + * .set('Accept', 'application/json')
    + * .set('X-API-Key', 'foobar')
    + * .end(callback);
    + *
    + * req.get('/')
    + * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })
    + * .end(callback);
    + *
    + * @param {String|Object} field
    + * @param {String} val
    + * @return {Request} for chaining
    + * @api public
    + */
    +
    + RequestBase.prototype.set = function (field, val) {
    + if (isObject(field)) {
    + for (var key in field) {
    + if (Object.prototype.hasOwnProperty.call(field, key)) this.set(key, field[key])
    + }
    +
    + return this
    + }
    +
    + this._header[field.toLowerCase()] = val
    + this.header[field] = val
    + return this
    + } // eslint-disable-next-line valid-jsdoc
    +
    + /**
    + * Remove header `field`.
    + * Case-insensitive.
    + *
    + * Example:
    + *
    + * req.get('/')
    + * .unset('User-Agent')
    + * .end(callback);
    + *
    + * @param {String} field field name
    + */
    +
    + RequestBase.prototype.unset = function (field) {
    + delete this._header[field.toLowerCase()]
    + delete this.header[field]
    + return this
    + }
    + /**
    + * Write the field `name` and `val`, or multiple fields with one object
    + * for "multipart/form-data" request bodies.
    + *
    + * ``` js
    + * request.post('/upload')
    + * .field('foo', 'bar')
    + * .end(callback);
    + *
    + * request.post('/upload')
    + * .field({ foo: 'bar', baz: 'qux' })
    + * .end(callback);
    + * ```
    + *
    + * @param {String|Object} name name of field
    + * @param {String|Blob|File|Buffer|fs.ReadStream} val value of field
    + * @return {Request} for chaining
    + * @api public
    + */
    +
    + RequestBase.prototype.field = function (name, val) {
    + // name should be either a string or an object.
    + if (name === null || undefined === name) {
    + throw new Error(".field(name, val) name can not be empty")
    + }
    +
    + if (this._data) {
    + throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()")
    + }
    +
    + if (isObject(name)) {
    + for (var key in name) {
    + if (Object.prototype.hasOwnProperty.call(name, key)) this.field(key, name[key])
    + }
    +
    + return this
    + }
    +
    + if (Array.isArray(val)) {
    + for (var i in val) {
    + if (Object.prototype.hasOwnProperty.call(val, i)) this.field(name, val[i])
    + }
    +
    + return this
    + } // val should be defined now
    +
    + if (val === null || undefined === val) {
    + throw new Error(".field(name, val) val can not be empty")
    + }
    +
    + if (typeof val === "boolean") {
    + val = String(val)
    + }
    +
    + this._getFormData().append(name, val)
    +
    + return this
    + }
    + /**
    + * Abort the request, and clear potential timeout.
    + *
    + * @return {Request} request
    + * @api public
    + */
    +
    + RequestBase.prototype.abort = function () {
    + if (this._aborted) {
    + return this
    + }
    +
    + this._aborted = true
    + if (this.xhr) this.xhr.abort() // browser
    +
    + if (this.req) this.req.abort() // node
    +
    + this.clearTimeout()
    + this.emit("abort")
    + return this
    + }
    +
    + RequestBase.prototype._auth = function (user, pass, options, base64Encoder) {
    + switch (options.type) {
    + case "basic":
    + this.set("Authorization", "Basic ".concat(base64Encoder("".concat(user, ":").concat(pass))))
    + break
    +
    + case "auto":
    + this.username = user
    + this.password = pass
    + break
    +
    + case "bearer":
    + // usage would be .auth(accessToken, { type: 'bearer' })
    + this.set("Authorization", "Bearer ".concat(user))
    + break
    +
    + default:
    + break
    + }
    +
    + return this
    + }
    + /**
    + * Enable transmission of cookies with x-domain requests.
    + *
    + * Note that for this to work the origin must not be
    + * using "Access-Control-Allow-Origin" with a wildcard,
    + * and also must set "Access-Control-Allow-Credentials"
    + * to "true".
    + *
    + * @api public
    + */
    +
    + RequestBase.prototype.withCredentials = function (on) {
    + // This is browser-only functionality. Node side is no-op.
    + if (on === undefined) on = true
    + this._withCredentials = on
    + return this
    + }
    + /**
    + * Set the max redirects to `n`. Does nothing in browser XHR implementation.
    + *
    + * @param {Number} n
    + * @return {Request} for chaining
    + * @api public
    + */
    +
    + RequestBase.prototype.redirects = function (n) {
    + this._maxRedirects = n
    + return this
    + }
    + /**
    + * Maximum size of buffered response body, in bytes. Counts uncompressed size.
    + * Default 200MB.
    + *
    + * @param {Number} n number of bytes
    + * @return {Request} for chaining
    + */
    +
    + RequestBase.prototype.maxResponseSize = function (n) {
    + if (typeof n !== "number") {
    + throw new TypeError("Invalid argument")
    + }
    +
    + this._maxResponseSize = n
    + return this
    + }
    + /**
    + * Convert to a plain javascript object (not JSON string) of scalar properties.
    + * Note as this method is designed to return a useful non-this value,
    + * it cannot be chained.
    + *
    + * @return {Object} describing method, url, and data of this request
    + * @api public
    + */
    +
    + RequestBase.prototype.toJSON = function () {
    + return {
    + method: this.method,
    + url: this.url,
    + data: this._data,
    + headers: this._header,
    + }
    + }
    + /**
    + * Send `data` as the request body, defaulting the `.type()` to "json" when
    + * an object is given.
    + *
    + * Examples:
    + *
    + * // manual json
    + * request.post('/user')
    + * .type('json')
    + * .send('{"name":"tj"}')
    + * .end(callback)
    + *
    + * // auto json
    + * request.post('/user')
    + * .send({ name: 'tj' })
    + * .end(callback)
    + *
    + * // manual x-www-form-urlencoded
    + * request.post('/user')
    + * .type('form')
    + * .send('name=tj')
    + * .end(callback)
    + *
    + * // auto x-www-form-urlencoded
    + * request.post('/user')
    + * .type('form')
    + * .send({ name: 'tj' })
    + * .end(callback)
    + *
    + * // defaults to x-www-form-urlencoded
    + * request.post('/user')
    + * .send('name=tobi')
    + * .send('species=ferret')
    + * .end(callback)
    + *
    + * @param {String|Object} data
    + * @return {Request} for chaining
    + * @api public
    + */
    + // eslint-disable-next-line complexity
    +
    + RequestBase.prototype.send = function (data) {
    + var isObj = isObject(data)
    + var type = this._header["content-type"]
    +
    + if (this._formData) {
    + throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()")
    + }
    +
    + if (isObj && !this._data) {
    + if (Array.isArray(data)) {
    + this._data = []
    + } else if (!this._isHost(data)) {
    + this._data = {}
    + }
    + } else if (data && this._data && this._isHost(this._data)) {
    + throw new Error("Can't merge these send calls")
    + } // merge
    +
    + if (isObj && isObject(this._data)) {
    + for (var key in data) {
    + if (Object.prototype.hasOwnProperty.call(data, key)) this._data[key] = data[key]
    + }
    + } else if (typeof data === "string") {
    + // default to x-www-form-urlencoded
    + if (!type) this.type("form")
    + type = this._header["content-type"]
    +
    + if (type === "application/x-www-form-urlencoded") {
    + this._data = this._data ? "".concat(this._data, "&").concat(data) : data
    + } else {
    + this._data = (this._data || "") + data
    + }
    + } else {
    + this._data = data
    + }
    +
    + if (!isObj || this._isHost(data)) {
    + return this
    + } // default to json
    +
    + if (!type) this.type("json")
    + return this
    + }
    + /**
    + * Sort `querystring` by the sort function
    + *
    + *
    + * Examples:
    + *
    + * // default order
    + * request.get('/user')
    + * .query('name=Nick')
    + * .query('search=Manny')
    + * .sortQuery()
    + * .end(callback)
    + *
    + * // customized sort function
    + * request.get('/user')
    + * .query('name=Nick')
    + * .query('search=Manny')
    + * .sortQuery(function(a, b){
    + * return a.length - b.length;
    + * })
    + * .end(callback)
    + *
    + *
    + * @param {Function} sort
    + * @return {Request} for chaining
    + * @api public
    + */
    +
    + RequestBase.prototype.sortQuery = function (sort) {
    + // _sort default to true but otherwise can be a function or boolean
    + this._sort = typeof sort === "undefined" ? true : sort
    + return this
    + }
    + /**
    + * Compose querystring to append to req.url
    + *
    + * @api private
    + */
    +
    + RequestBase.prototype._finalizeQueryString = function () {
    + var query = this._query.join("&")
    +
    + if (query) {
    + this.url += (this.url.indexOf("?") >= 0 ? "&" : "?") + query
    + }
    +
    + this._query.length = 0 // Makes the call idempotent
    +
    + if (this._sort) {
    + var index = this.url.indexOf("?")
    +
    + if (index >= 0) {
    + var queryArr = this.url.substring(index + 1).split("&")
    +
    + if (typeof this._sort === "function") {
    + queryArr.sort(this._sort)
    + } else {
    + queryArr.sort()
    + }
    +
    + this.url = this.url.substring(0, index) + "?" + queryArr.join("&")
    + }
    + }
    + } // For backwards compat only
    +
    + RequestBase.prototype._appendQueryString = function () {
    + console.warn("Unsupported")
    + }
    + /**
    + * Invoke callback with timeout error.
    + *
    + * @api private
    + */
    +
    + RequestBase.prototype._timeoutError = function (reason, timeout, errno) {
    + if (this._aborted) {
    + return
    + }
    +
    + var err = new Error("".concat(reason + timeout, "ms exceeded"))
    + err.timeout = timeout
    + err.code = "ECONNABORTED"
    + err.errno = errno
    + this.timedout = true
    + this.abort()
    + this.callback(err)
    + }
    +
    + RequestBase.prototype._setTimeouts = function () {
    + var self = this // deadline
    +
    + if (this._timeout && !this._timer) {
    + this._timer = setTimeout(function () {
    + self._timeoutError("Timeout of ", self._timeout, "ETIME")
    + }, this._timeout)
    + } // response timeout
    +
    + if (this._responseTimeout && !this._responseTimeoutTimer) {
    + this._responseTimeoutTimer = setTimeout(function () {
    + self._timeoutError("Response timeout of ", self._responseTimeout, "ETIMEDOUT")
    + }, this._responseTimeout)
    + }
    + }
    + },
    + { "./is-object": 4 },
    + ],
    + 7: [
    + function (require, module, exports) {
    + "use strict"
    +
    + /**
    + * Module dependencies.
    + */
    + var utils = require("./utils")
    + /**
    + * Expose `ResponseBase`.
    + */
    +
    + module.exports = ResponseBase
    + /**
    + * Initialize a new `ResponseBase`.
    + *
    + * @api public
    + */
    +
    + function ResponseBase(obj) {
    + if (obj) return mixin(obj)
    + }
    + /**
    + * Mixin the prototype properties.
    + *
    + * @param {Object} obj
    + * @return {Object}
    + * @api private
    + */
    +
    + function mixin(obj) {
    + for (var key in ResponseBase.prototype) {
    + if (Object.prototype.hasOwnProperty.call(ResponseBase.prototype, key)) obj[key] = ResponseBase.prototype[key]
    + }
    +
    + return obj
    + }
    + /**
    + * Get case-insensitive `field` value.
    + *
    + * @param {String} field
    + * @return {String}
    + * @api public
    + */
    +
    + ResponseBase.prototype.get = function (field) {
    + return this.header[field.toLowerCase()]
    + }
    + /**
    + * Set header related properties:
    + *
    + * - `.type` the content type without params
    + *
    + * A response of "Content-Type: text/plain; charset=utf-8"
    + * will provide you with a `.type` of "text/plain".
    + *
    + * @param {Object} header
    + * @api private
    + */
    +
    + ResponseBase.prototype._setHeaderProperties = function (header) {
    + // TODO: moar!
    + // TODO: make this a util
    + // content-type
    + var ct = header["content-type"] || ""
    + this.type = utils.type(ct) // params
    +
    + var params = utils.params(ct)
    +
    + for (var key in params) {
    + if (Object.prototype.hasOwnProperty.call(params, key)) this[key] = params[key]
    + }
    +
    + this.links = {} // links
    +
    + try {
    + if (header.link) {
    + this.links = utils.parseLinks(header.link)
    + }
    + } catch (err) {
    + // ignore
    + }
    + }
    + /**
    + * Set flags such as `.ok` based on `status`.
    + *
    + * For example a 2xx response will give you a `.ok` of __true__
    + * whereas 5xx will be __false__ and `.error` will be __true__. The
    + * `.clientError` and `.serverError` are also available to be more
    + * specific, and `.statusType` is the class of error ranging from 1..5
    + * sometimes useful for mapping respond colors etc.
    + *
    + * "sugar" properties are also defined for common cases. Currently providing:
    + *
    + * - .noContent
    + * - .badRequest
    + * - .unauthorized
    + * - .notAcceptable
    + * - .notFound
    + *
    + * @param {Number} status
    + * @api private
    + */
    +
    + ResponseBase.prototype._setStatusProperties = function (status) {
    + var type = (status / 100) | 0 // status / class
    +
    + this.statusCode = status
    + this.status = this.statusCode
    + this.statusType = type // basics
    +
    + this.info = type === 1
    + this.ok = type === 2
    + this.redirect = type === 3
    + this.clientError = type === 4
    + this.serverError = type === 5
    + this.error = type === 4 || type === 5 ? this.toError() : false // sugar
    +
    + this.created = status === 201
    + this.accepted = status === 202
    + this.noContent = status === 204
    + this.badRequest = status === 400
    + this.unauthorized = status === 401
    + this.notAcceptable = status === 406
    + this.forbidden = status === 403
    + this.notFound = status === 404
    + this.unprocessableEntity = status === 422
    + }
    + },
    + { "./utils": 8 },
    + ],
    + 8: [
    + function (require, module, exports) {
    + "use strict"
    +
    + /**
    + * Return the mime type for the given `str`.
    + *
    + * @param {String} str
    + * @return {String}
    + * @api private
    + */
    + exports.type = function (str) {
    + return str.split(/ *; */).shift()
    + }
    + /**
    + * Return header field parameters.
    + *
    + * @param {String} str
    + * @return {Object}
    + * @api private
    + */
    +
    + exports.params = function (str) {
    + return str.split(/ *; */).reduce(function (obj, str) {
    + var parts = str.split(/ *= */)
    + var key = parts.shift()
    + var val = parts.shift()
    + if (key && val) obj[key] = val
    + return obj
    + }, {})
    + }
    + /**
    + * Parse Link header fields.
    + *
    + * @param {String} str
    + * @return {Object}
    + * @api private
    + */
    +
    + exports.parseLinks = function (str) {
    + return str.split(/ *, */).reduce(function (obj, str) {
    + var parts = str.split(/ *; */)
    + var url = parts[0].slice(1, -1)
    + var rel = parts[1].split(/ *= */)[1].slice(1, -1)
    + obj[rel] = url
    + return obj
    + }, {})
    + }
    + /**
    + * Strip content related fields from `header`.
    + *
    + * @param {Object} header
    + * @return {Object} header
    + * @api private
    + */
    +
    + exports.cleanHeader = function (header, changesOrigin) {
    + delete header["content-type"]
    + delete header["content-length"]
    + delete header["transfer-encoding"]
    + delete header.host // secuirty
    +
    + if (changesOrigin) {
    + delete header.authorization
    + delete header.cookie
    + }
    +
    + return header
    + }
    + },
    + {},
    + ],
    + },
    + {},
    + [5]
    + )(5)
    + })
    + /* mousetrap v1.6.3 craig.is/killing/mice */
    + ;(function (q, u, c) {
    + function v(a, b, g) {
    + a.addEventListener ? a.addEventListener(b, g, !1) : a.attachEvent("on" + b, g)
    + }
    + function z(a) {
    + if ("keypress" == a.type) {
    + var b = String.fromCharCode(a.which)
    + a.shiftKey || (b = b.toLowerCase())
    + return b
    + }
    + return n[a.which] ? n[a.which] : r[a.which] ? r[a.which] : String.fromCharCode(a.which).toLowerCase()
    + }
    + function F(a) {
    + var b = []
    + a.shiftKey && b.push("shift")
    + a.altKey && b.push("alt")
    + a.ctrlKey && b.push("ctrl")
    + a.metaKey && b.push("meta")
    + return b
    + }
    + function w(a) {
    + return "shift" == a || "ctrl" == a || "alt" == a || "meta" == a
    + }
    + function A(a, b) {
    + var g,
    + d = []
    + var e = a
    + "+" === e ? (e = ["+"]) : ((e = e.replace(/\+{2}/g, "+plus")), (e = e.split("+")))
    + for (g = 0; g < e.length; ++g) {
    + var m = e[g]
    + B] && (m = B])
    + b && "keypress" != b && C] && ((m = C]), d.push("shift"))
    + w(m) && d.push(m)
    + }
    + e = m
    + g = b
    + if (!g) {
    + if (!p) {
    + p = {}
    + for (var c in n) (95 < c && 112 > c) || (n.hasOwnProperty(c) && (p[n[c]] = c))
    + }
    + g = p[e] ? "keydown" : "keypress"
    + }
    + "keypress" == g && d.length && (g = "keydown")
    + return { key: m, modifiers: d, action: g }
    + }
    + function D(a, b) {
    + return null === a || a === u ? !1 : a === b ? !0 : D(a.parentNode, b)
    + }
    + function d(a) {
    + function b(a) {
    + a = a || {}
    + var b = !1,
    + l
    + for (l in p) a[l] ? (b = !0) : (p[l] = 0)
    + b || (x = !1)
    + }
    + function g(a, b, t, f, g, d) {
    + var l,
    + E = [],
    + h = t.type
    + if (!k._callbacks[a]) return []
    + "keyup" == h && w(a) && (b = [a])
    + for (l = 0; l < k._callbacks[a].length; ++l) {
    + var c = k._callbacks[a][l]
    + if ((f || !c.seq || p[c.seq] == c.level) && h == c.action) {
    + var e
    + ;(e = "keypress" == h && !t.metaKey && !t.ctrlKey) || ((e = c.modifiers), (e = b.sort().join(",") === e.sort().join(",")))
    + e && ((e = f && c.seq == f && c.level == d), ((!f && c.combo == g) || e) && k._callbacks[a].splice(l, 1), E.push(c))
    + }
    + }
    + return E
    + }
    + function c(a, b, c, f) {
    + k.stopCallback(b, b.target || b.srcElement, c, f) ||
    + !1 !== a(b, c) ||
    + (b.preventDefault ? b.preventDefault() : (b.returnValue = !1), b.stopPropagation ? b.stopPropagation() : (b.cancelBubble = !0))
    + }
    + function e(a) {
    + "number" !== typeof a.which && (a.which = a.keyCode)
    + var b = z(a)
    + b && ("keyup" == a.type && y === b ? (y = !1) : k.handleKey(b, F(a), a))
    + }
    + function m(a, g, t, f) {
    + function h(c) {
    + return function () {
    + x = c
    + ++p[a]
    + clearTimeout(q)
    + q = setTimeout(b, 1e3)
    + }
    + }
    + function l(g) {
    + c(t, g, a)
    + "keyup" !== f && (y = z(g))
    + setTimeout(b, 10)
    + }
    + for (var d = (p[a] = 0); d < g.length; ++d) {
    + var e = d + 1 === g.length ? l : h(f || A(g[d + 1]).action)
    + n(g[d], e, f, a, d)
    + }
    + }
    + function n(a, b, c, f, d) {
    + k._directMap[a + ":" + c] = b
    + a = a.replace(/\s+/g, " ")
    + var e = a.split(" ")
    + 1 < e.length
    + ? m(a, e, b, c)
    + : ((c = A(a, c)),
    + (k._callbacks[c.key] = k._callbacks[c.key] || []),
    + g(c.key, c.modifiers, { type: c.action }, f, a, d),
    + k._callbacks[c.key][f ? "unshift" : "push"]({ callback: b, modifiers: c.modifiers, action: c.action, seq: f, level: d, combo: a }))
    + }
    + var k = this
    + a = a || u
    + if (!(k instanceof d)) return new d(a)
    + k.target = a
    + k._callbacks = {}
    + k._directMap = {}
    + var p = {},
    + q,
    + y = !1,
    + r = !1,
    + x = !1
    + k._handleKey = function (a, d, e) {
    + var f = g(a, d, e),
    + h
    + d = {}
    + var k = 0,
    + l = !1
    + for (h = 0; h < f.length; ++h) f[h].seq && (k = Math.max(k, f[h].level))
    + for (h = 0; h < f.length; ++h) f[h].seq ? f[h].level == k && ((l = !0), (d[f[h].seq] = 1), c(f[h].callback, e, f[h].combo, f[h].seq)) : l || c(f[h].callback, e, f[h].combo)
    + f = "keypress" == e.type && r
    + e.type != x || w(a) || f || b(d)
    + r = l && "keydown" == e.type
    + }
    + k._bindMultiple = function (a, b, c) {
    + for (var d = 0; d < a.length; ++d) n(a[d], b, c)
    + }
    + v(a, "keypress", e)
    + v(a, "keydown", e)
    + v(a, "keyup", e)
    + }
    + if (q) {
    + var n = {
    + 8: "backspace",
    + 9: "tab",
    + 13: "enter",
    + 16: "shift",
    + 17: "ctrl",
    + 18: "alt",
    + 20: "capslock",
    + 27: "esc",
    + 32: "space",
    + 33: "pageup",
    + 34: "pagedown",
    + 35: "end",
    + 36: "home",
    + 37: "left",
    + 38: "up",
    + 39: "right",
    + 40: "down",
    + 45: "ins",
    + 46: "del",
    + 91: "meta",
    + 93: "meta",
    + 224: "meta",
    + },
    + r = { 106: "*", 107: "+", 109: "-", 110: ".", 111: "/", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", 221: "]", 222: "'" },
    + C = {
    + "~": "`",
    + "!": "1",
    + "@": "2",
    + "#": "3",
    + $: "4",
    + "%": "5",
    + "^": "6",
    + "&": "7",
    + "*": "8",
    + "(": "9",
    + ")": "0",
    + _: "-",
    + "+": "=",
    + ":": ";",
    + '"': "'",
    + "<": ",",
    + ">": ".",
    + "?": "/",
    + "|": "\\",
    + },
    + B = { option: "alt", command: "meta", return: "enter", escape: "esc", plus: "+", mod: /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? "meta" : "ctrl" },
    + p
    + for (c = 1; 20 > c; ++c) n[111 + c] = "f" + c
    + for (c = 0; 9 >= c; ++c) n[c + 96] = c.toString()
    + d.prototype.bind = function (a, b, c) {
    + a = a instanceof Array ? a : [a]
    + this._bindMultiple.call(this, a, b, c)
    + return this
    + }
    + d.prototype.unbind = function (a, b) {
    + return this.bind.call(this, a, function () {}, b)
    + }
    + d.prototype.trigger = function (a, b) {
    + if (this._directMap[a + ":" + b]) this._directMap[a + ":" + b]({}, a)
    + return this
    + }
    + d.prototype.reset = function () {
    + this._callbacks = {}
    + this._directMap = {}
    + return this
    + }
    + d.prototype.stopCallback = function (a, b) {
    + if (-1 < (" " + b.className + " ").indexOf(" mousetrap ") || D(b, this.target)) return !1
    + if ("composedPath" in a && "function" === typeof a.composedPath) {
    + var c = a.composedPath()[0]
    + c !== a.target && (b = c)
    + }
    + return "INPUT" == b.tagName || "SELECT" == b.tagName || "TEXTAREA" == b.tagName || b.isContentEditable
    + }
    + d.prototype.handleKey = function () {
    + return this._handleKey.apply(this, arguments)
    + }
    + d.addKeycodes = function (a) {
    + for (var b in a) a.hasOwnProperty(b) && (n[b] = a[b])
    + p = null
    + }
    + d.init = function () {
    + var a = d(u),
    + b
    + for (b in a)
    + "_" !== b.charAt(0) &&
    + (d[b] = (function (b) {
    + return function () {
    + return a[b].apply(a, arguments)
    + }
    + })(b))
    + }
    + d.init()
    + q.Mousetrap = d
    + "undefined" !== typeof module && module.exports && (module.exports = d)
    + "function" === typeof define &&
    + define.amd &&
    + define(function () {
    + return d
    + })
    + }
    + })("undefined" !== typeof window ? window : null, "undefined" !== typeof window ? document : null)
    + /*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */
    + !(function (e, t) {
    + "use strict"
    + "object" == typeof module && "object" == typeof module.exports
    + ? (module.exports = e.document
    + ? t(e, !0)
    + : function (e) {
    + if (!e.document) throw new Error("jQuery requires a window with a document")
    + return t(e)
    + })
    + : t(e)
    + })("undefined" != typeof window ? window : this, function (C, e) {
    + "use strict"
    + var t = [],
    + E = C.document,
    + r = Object.getPrototypeOf,
    + s = t.slice,
    + g = t.concat,
    + u = t.push,
    + i = t.indexOf,
    + n = {},
    + o = n.toString,
    + v = n.hasOwnProperty,
    + a = v.toString,
    + l = a.call(Object),
    + y = {},
    + m = function (e) {
    + return "function" == typeof e && "number" != typeof e.nodeType
    + },
    + x = function (e) {
    + return null != e && e === e.window
    + },
    + c = { type: !0, src: !0, nonce: !0, noModule: !0 }
    + function b(e, t, n) {
    + var r,
    + i,
    + o = (n = n || E).createElement("script")
    + if (((o.text = e), t)) for (r in c) (i = t[r] || (t.getAttribute && t.getAttribute(r))) && o.setAttribute(r, i)
    + n.head.appendChild(o).parentNode.removeChild(o)
    + }
    + function w(e) {
    + return null == e ? e + "" : "object" == typeof e || "function" == typeof e ? n[o.call(e)] || "object" : typeof e
    + }
    + var f = "3.4.1",
    + k = function (e, t) {
    + return new k.fn.init(e, t)
    + },
    + p = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g
    + function d(e) {
    + var t = !!e && "length" in e && e.length,
    + n = w(e)
    + return !m(e) && !x(e) && ("array" === n || 0 === t || ("number" == typeof t && 0 < t && t - 1 in e))
    + }
    + ;(k.fn = k.prototype =
    + {
    + jquery: f,
    + constructor: k,
    + length: 0,
    + toArray: function () {
    + return s.call(this)
    + },
    + get: function (e) {
    + return null == e ? s.call(this) : e < 0 ? this[e + this.length] : this[e]
    + },
    + pushStack: function (e) {
    + var t = k.merge(this.constructor(), e)
    + return (t.prevObject = this), t
    + },
    + each: function (e) {
    + return k.each(this, e)
    + },
    + map: function (n) {
    + return this.pushStack(
    + k.map(this, function (e, t) {
    + return n.call(e, t, e)
    + })
    + )
    + },
    + slice: function () {
    + return this.pushStack(s.apply(this, arguments))
    + },
    + first: function () {
    + return this.eq(0)
    + },
    + last: function () {
    + return this.eq(-1)
    + },
    + eq: function (e) {
    + var t = this.length,
    + n = +e + (e < 0 ? t : 0)
    + return this.pushStack(0 <= n && n < t ? [this[n]] : [])
    + },
    + end: function () {
    + return this.prevObject || this.constructor()
    + },
    + push: u,
    + sort: t.sort,
    + splice: t.splice,
    + }),
    + (k.extend = k.fn.extend =
    + function () {
    + var e,
    + t,
    + n,
    + r,
    + i,
    + o,
    + a = arguments[0] || {},
    + s = 1,
    + u = arguments.length,
    + l = !1
    + for ("boolean" == typeof a && ((l = a), (a = arguments[s] || {}), s++), "object" == typeof a || m(a) || (a = {}), s === u && ((a = this), s--); s < u; s++)
    + if (null != (e = arguments[s]))
    + for (t in e)
    + (r = e[t]),
    + "__proto__" !== t &&
    + a !== r &&
    + (l && r && (k.isPlainObject(r) || (i = Array.isArray(r)))
    + ? ((n = a[t]), (o = i && !Array.isArray(n) ? [] : i || k.isPlainObject(n) ? n : {}), (i = !1), (a[t] = k.extend(l, o, r)))
    + : void 0 !== r && (a[t] = r))
    + return a
    + }),
    + k.extend({
    + expando: "jQuery" + (f + Math.random()).replace(/\D/g, ""),
    + isReady: !0,
    + error: function (e) {
    + throw new Error(e)
    + },
    + noop: function () {},
    + isPlainObject: function (e) {
    + var t, n
    + return !(!e || "[object Object]" !== o.call(e)) && (!(t = r(e)) || ("function" == typeof (n = v.call(t, "constructor") && t.constructor) && a.call(n) === l))
    + },
    + isEmptyObject: function (e) {
    + var t
    + for (t in e) return !1
    + return !0
    + },
    + globalEval: function (e, t) {
    + b(e, { nonce: t && t.nonce })
    + },
    + each: function (e, t) {
    + var n,
    + r = 0
    + if (d(e)) {
    + for (n = e.length; r < n; r++) if (!1 === t.call(e[r], r, e[r])) break
    + } else for (r in e) if (!1 === t.call(e[r], r, e[r])) break
    + return e
    + },
    + trim: function (e) {
    + return null == e ? "" : (e + "").replace(p, "")
    + },
    + makeArray: function (e, t) {
    + var n = t || []
    + return null != e && (d(Object(e)) ? k.merge(n, "string" == typeof e ? [e] : e) : u.call(n, e)), n
    + },
    + inArray: function (e, t, n) {
    + return null == t ? -1 : i.call(t, e, n)
    + },
    + merge: function (e, t) {
    + for (var n = +t.length, r = 0, i = e.length; r < n; r++) e[i++] = t[r]
    + return (e.length = i), e
    + },
    + grep: function (e, t, n) {
    + for (var r = [], i = 0, o = e.length, a = !n; i < o; i++) !t(e[i], i) !== a && r.push(e[i])
    + return r
    + },
    + map: function (e, t, n) {
    + var r,
    + i,
    + o = 0,
    + a = []
    + if (d(e)) for (r = e.length; o < r; o++) null != (i = t(e[o], o, n)) && a.push(i)
    + else for (o in e) null != (i = t(e[o], o, n)) && a.push(i)
    + return g.apply([], a)
    + },
    + guid: 1,
    + support: y,
    + }),
    + "function" == typeof Symbol && (k.fn[Symbol.iterator] = t[Symbol.iterator]),
    + k.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (e, t) {
    + n["[object " + t + "]"] = t.toLowerCase()
    + })
    + var h = (function (n) {
    + var e,
    + d,
    + b,
    + o,
    + i,
    + h,
    + f,
    + g,
    + w,
    + u,
    + l,
    + T,
    + C,
    + a,
    + E,
    + v,
    + s,
    + c,
    + y,
    + k = "sizzle" + 1 * new Date(),
    + m = n.document,
    + S = 0,
    + r = 0,
    + p = ue(),
    + x = ue(),
    + N = ue(),
    + A = ue(),
    + D = function (e, t) {
    + return e === t && (l = !0), 0
    + },
    + j = {}.hasOwnProperty,
    + t = [],
    + q = t.pop,
    + L = t.push,
    + H = t.push,
    + O = t.slice,
    + P = function (e, t) {
    + for (var n = 0, r = e.length; n < r; n++) if (e[n] === t) return n
    + return -1
    + },
    + R = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
    + M = "[\\x20\\t\\r\\n\\f]",
    + I = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
    + W = "\\[" + M + "*(" + I + ")(?:" + M + "*([*^$|!~]?=)" + M + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + I + "))|)" + M + "*\\]",
    + $ = ":(" + I + ")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|" + W + ")*)|.*)\\)|)",
    + F = new RegExp(M + "+", "g"),
    + B = new RegExp("^" + M + "+|((?:^|[^\\\\])(?:\\\\.)*)" + M + "+$", "g"),
    + _ = new RegExp("^" + M + "*," + M + "*"),
    + z = new RegExp("^" + M + "*([>+~]|" + M + ")" + M + "*"),
    + U = new RegExp(M + "|>"),
    + X = new RegExp($),
    + V = new RegExp("^" + I + "$"),
    + G = {
    + ID: new RegExp("^#(" + I + ")"),
    + CLASS: new RegExp("^\\.(" + I + ")"),
    + TAG: new RegExp("^(" + I + "|[*])"),
    + ATTR: new RegExp("^" + W),
    + PSEUDO: new RegExp("^" + $),
    + CHILD: new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + M + "*(even|odd|(([+-]|)(\\d*)n|)" + M + "*(?:([+-]|)" + M + "*(\\d+)|))" + M + "*\\)|)", "i"),
    + bool: new RegExp("^(?:" + R + ")$", "i"),
    + needsContext: new RegExp("^" + M + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + M + "*((?:-\\d)?\\d*)" + M + "*\\)|)(?=[^-]|$)", "i"),
    + },
    + Y = /HTML$/i,
    + Q = /^(?:input|select|textarea|button)$/i,
    + J = /^h\d$/i,
    + K = /^[^{]+\{\s*\[native \w/,
    + Z = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
    + ee = /[+~]/,
    + te = new RegExp("\\\\([\\da-f]{1,6}" + M + "?|(" + M + ")|.)", "ig"),
    + ne = function (e, t, n) {
    + var r = "0x" + t - 65536
    + return r != r || n ? t : r < 0 ? String.fromCharCode(r + 65536) : String.fromCharCode((r >> 10) | 55296, (1023 & r) | 56320)
    + },
    + re = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
    + ie = function (e, t) {
    + return t ? ("\0" === e ? "\ufffd" : e.slice(0, -1) + "\\" + e.charCodeAt(e.length - 1).toString(16) + " ") : "\\" + e
    + },
    + oe = function () {
    + T()
    + },
    + ae = be(
    + function (e) {
    + return !0 === e.disabled && "fieldset" === e.nodeName.toLowerCase()
    + },
    + { dir: "parentNode", next: "legend" }
    + )
    + try {
    + H.apply((t = O.call(m.childNodes)), m.childNodes), t.childNodes.length].nodeType
    + } catch (e) {
    + H = {
    + apply: t.length
    + ? function (e, t) {
    + L.apply(e, O.call(t))
    + }
    + : function (e, t) {
    + var n = e.length,
    + r = 0
    + while ((e[n++] = t[r++]));
    + e.length = n - 1
    + },
    + }
    + }
    + function se(t, e, n, r) {
    + var i,
    + o,
    + a,
    + s,
    + u,
    + l,
    + c,
    + f = e && e.ownerDocument,
    + p = e ? e.nodeType : 9
    + if (((n = n || []), "string" != typeof t || !t || (1 !== p && 9 !== p && 11 !== p))) return n
    + if (!r && ((e ? e.ownerDocument || e : m) !== C && T(e), (e = e || C), E)) {
    + if (11 !== p && (u = Z.exec(t)))
    + if ((i = u[1])) {
    + if (9 === p) {
    + if (!(a = e.getElementById(i))) return n
    + if (a.id === i) return n.push(a), n
    + } else if (f && (a = f.getElementById(i)) && y(e, a) && a.id === i) return n.push(a), n
    + } else {
    + if (u[2]) return H.apply(n, e.getElementsByTagName(t)), n
    + if ((i = u[3]) && d.getElementsByClassName && e.getElementsByClassName) return H.apply(n, e.getElementsByClassName(i)), n
    + }
    + if (d.qsa && !A[t + " "] && (!v || !v.test(t)) && (1 !== p || "object" !== e.nodeName.toLowerCase())) {
    + if (((c = t), (f = e), 1 === p && U.test(t))) {
    + ;(s = e.getAttribute("id")) ? (s = s.replace(re, ie)) : e.setAttribute("id", (s = k)), (o = (l = h(t)).length)
    + while (o--) l[o] = "#" + s + " " + xe(l[o])
    + ;(c = l.join(",")), (f = (ee.test(t) && ye(e.parentNode)) || e)
    + }
    + try {
    + return H.apply(n, f.querySelectorAll(c)), n
    + } catch (e) {
    + A(t, !0)
    + } finally {
    + s === k && e.removeAttribute("id")
    + }
    + }
    + }
    + return g(t.replace(B, "$1"), e, n, r)
    + }
    + function ue() {
    + var r = []
    + return function e(t, n) {
    + return r.push(t + " ") > b.cacheLength && delete e[r.shift()], (e[t + " "] = n)
    + }
    + }
    + function le(e) {
    + return (e[k] = !0), e
    + }
    + function ce(e) {
    + var t = C.createElement("fieldset")
    + try {
    + return !!e(t)
    + } catch (e) {
    + return !1
    + } finally {
    + t.parentNode && t.parentNode.removeChild(t), (t = null)
    + }
    + }
    + function fe(e, t) {
    + var n = e.split("|"),
    + r = n.length
    + while (r--) b.attrHandle[n[r]] = t
    + }
    + function pe(e, t) {
    + var n = t && e,
    + r = n && 1 === e.nodeType && 1 === t.nodeType && e.sourceIndex - t.sourceIndex
    + if (r) return r
    + if (n) while ((n = n.nextSibling)) if (n === t) return -1
    + return e ? 1 : -1
    + }
    + function de(t) {
    + return function (e) {
    + return "input" === e.nodeName.toLowerCase() && e.type === t
    + }
    + }
    + function he(n) {
    + return function (e) {
    + var t = e.nodeName.toLowerCase()
    + return ("input" === t || "button" === t) && e.type === n
    + }
    + }
    + function ge(t) {
    + return function (e) {
    + return "form" in e
    + ? e.parentNode && !1 === e.disabled
    + ? "label" in e
    + ? "label" in e.parentNode
    + ? e.parentNode.disabled === t
    + : e.disabled === t
    + : e.isDisabled === t || (e.isDisabled !== !t && ae(e) === t)
    + : e.disabled === t
    + : "label" in e && e.disabled === t
    + }
    + }
    + function ve(a) {
    + return le(function (o) {
    + return (
    + (o = +o),
    + le(function (e, t) {
    + var n,
    + r = a([], e.length, o),
    + i = r.length
    + while (i--) e[(n = r[i])] && (e[n] = !(t[n] = e[n]))
    + })
    + )
    + })
    + }
    + function ye(e) {
    + return e && "undefined" != typeof e.getElementsByTagName && e
    + }
    + for (e in ((d = se.support = {}),
    + (i = se.isXML =
    + function (e) {
    + var t = e.namespaceURI,
    + n = (e.ownerDocument || e).documentElement
    + return !Y.test(t || (n && n.nodeName) || "HTML")
    + }),
    + (T = se.setDocument =
    + function (e) {
    + var t,
    + n,
    + r = e ? e.ownerDocument || e : m
    + return (
    + r !== C &&
    + 9 === r.nodeType &&
    + r.documentElement &&
    + ((a = (C = r).documentElement),
    + (E = !i(C)),
    + m !== C && (n = C.defaultView) && n.top !== n && (n.addEventListener ? n.addEventListener("unload", oe, !1) : n.attachEvent && n.attachEvent("onunload", oe)),
    + (d.attributes = ce(function (e) {
    + return (e.className = "i"), !e.getAttribute("className")
    + })),
    + (d.getElementsByTagName = ce(function (e) {
    + return e.appendChild(C.createComment("")), !e.getElementsByTagName("*").length
    + })),
    + (d.getElementsByClassName = K.test(C.getElementsByClassName)),
    + (d.getById = ce(function (e) {
    + return (a.appendChild(e).id = k), !C.getElementsByName || !C.getElementsByName(k).length
    + })),
    + d.getById
    + ? ((b.filter.ID = function (e) {
    + var t = e.replace(te, ne)
    + return function (e) {
    + return e.getAttribute("id") === t
    + }
    + }),
    + (b.find.ID = function (e, t) {
    + if ("undefined" != typeof t.getElementById && E) {
    + var n = t.getElementById(e)
    + return n ? [n] : []
    + }
    + }))
    + : ((b.filter.ID = function (e) {
    + var n = e.replace(te, ne)
    + return function (e) {
    + var t = "undefined" != typeof e.getAttributeNode && e.getAttributeNode("id")
    + return t && t.value === n
    + }
    + }),
    + (b.find.ID = function (e, t) {
    + if ("undefined" != typeof t.getElementById && E) {
    + var n,
    + r,
    + i,
    + o = t.getElementById(e)
    + if (o) {
    + if ((n = o.getAttributeNode("id")) && n.value === e) return [o]
    + ;(i = t.getElementsByName(e)), (r = 0)
    + while ((o = i[r++])) if ((n = o.getAttributeNode("id")) && n.value === e) return [o]
    + }
    + return []
    + }
    + })),
    + (b.find.TAG = d.getElementsByTagName
    + ? function (e, t) {
    + return "undefined" != typeof t.getElementsByTagName ? t.getElementsByTagName(e) : d.qsa ? t.querySelectorAll(e) : void 0
    + }
    + : function (e, t) {
    + var n,
    + r = [],
    + i = 0,
    + o = t.getElementsByTagName(e)
    + if ("*" === e) {
    + while ((n = o[i++])) 1 === n.nodeType && r.push(n)
    + return r
    + }
    + return o
    + }),
    + (b.find.CLASS =
    + d.getElementsByClassName &&
    + function (e, t) {
    + if ("undefined" != typeof t.getElementsByClassName && E) return t.getElementsByClassName(e)
    + }),
    + (s = []),
    + (v = []),
    + (d.qsa = K.test(C.querySelectorAll)) &&
    + (ce(function (e) {
    + ;(a.appendChild(e).innerHTML = ""),
    + e.querySelectorAll("sallowcapture^='']").length && v.push("[*^$]=" + M + "*(?:''|\"\")"),
    + e.querySelectorAll("[selected]").length || v.push("\\[" + M + "*(?:value|" + R + ")"),
    + e.querySelectorAll("[id~=" + k + "-]").length || v.push("~="),
    + e.querySelectorAll(":checked").length || v.push(":checked"),
    + e.querySelectorAll("a#" + k + "+*").length || v.push(".#.+[+~]")
    + }),
    + ce(function (e) {
    + e.innerHTML = ""
    + var t = C.createElement("input")
    + t.setAttribute("type", "hidden"),
    + e.appendChild(t).setAttribute("name", "D"),
    + e.querySelectorAll("[name=d]").length && v.push("name" + M + "*[*^$|!~]?="),
    + 2 !== e.querySelectorAll(":enabled").length && v.push(":enabled", ":disabled"),
    + (a.appendChild(e).disabled = !0),
    + 2 !== e.querySelectorAll(":disabled").length && v.push(":enabled", ":disabled"),
    + e.querySelectorAll("*,:x"),
    + v.push(",.*:")
    + })),
    + (d.matchesSelector = K.test((c = a.matches || a.webkitMatchesSelector || a.mozMatchesSelector || a.oMatchesSelector || a.msMatchesSelector))) &&
    + ce(function (e) {
    + ;(d.disconnectedMatch = c.call(e, "*")), c.call(e, "[s!='']:x"), s.push("!=", $)
    + }),
    + (v = v.length && new RegExp(v.join("|"))),
    + (s = s.length && new RegExp(s.join("|"))),
    + (t = K.test(a.compareDocumentPosition)),
    + (y =
    + t || K.test(a.contains)
    + ? function (e, t) {
    + var n = 9 === e.nodeType ? e.documentElement : e,
    + r = t && t.parentNode
    + return e === r || !(!r || 1 !== r.nodeType || !(n.contains ? n.contains(r) : e.compareDocumentPosition && 16 & e.compareDocumentPosition(r)))
    + }
    + : function (e, t) {
    + if (t) while ((t = t.parentNode)) if (t === e) return !0
    + return !1
    + }),
    + (D = t
    + ? function (e, t) {
    + if (e === t) return (l = !0), 0
    + var n = !e.compareDocumentPosition - !t.compareDocumentPosition
    + return (
    + n ||
    + (1 & (n = (e.ownerDocument || e) === (t.ownerDocument || t) ? e.compareDocumentPosition(t) : 1) || (!d.sortDetached && t.compareDocumentPosition(e) === n)
    + ? e === C || (e.ownerDocument === m && y(m, e))
    + ? -1
    + : t === C || (t.ownerDocument === m && y(m, t))
    + ? 1
    + : u
    + ? P(u, e) - P(u, t)
    + : 0
    + : 4 & n
    + ? -1
    + : 1)
    + )
    + }
    + : function (e, t) {
    + if (e === t) return (l = !0), 0
    + var n,
    + r = 0,
    + i = e.parentNode,
    + o = t.parentNode,
    + a = [e],
    + s = [t]
    + if (!i || !o) return e === C ? -1 : t === C ? 1 : i ? -1 : o ? 1 : u ? P(u, e) - P(u, t) : 0
    + if (i === o) return pe(e, t)
    + n = e
    + while ((n = n.parentNode)) a.unshift(n)
    + n = t
    + while ((n = n.parentNode)) s.unshift(n)
    + while (a[r] === s[r]) r++
    + return r ? pe(a[r], s[r]) : a[r] === m ? -1 : s[r] === m ? 1 : 0
    + })),
    + C
    + )
    + }),
    + (se.matches = function (e, t) {
    + return se(e, null, null, t)
    + }),
    + (se.matchesSelector = function (e, t) {
    + if (((e.ownerDocument || e) !== C && T(e), d.matchesSelector && E && !A[t + " "] && (!s || !s.test(t)) && (!v || !v.test(t))))
    + try {
    + var n = c.call(e, t)
    + if (n || d.disconnectedMatch || (e.document && 11 !== e.document.nodeType)) return n
    + } catch (e) {
    + A(t, !0)
    + }
    + return 0 < se(t, C, null, [e]).length
    + }),
    + (se.contains = function (e, t) {
    + return (e.ownerDocument || e) !== C && T(e), y(e, t)
    + }),
    + (se.attr = function (e, t) {
    + ;(e.ownerDocument || e) !== C && T(e)
    + var n = b.attrHandle[t.toLowerCase()],
    + r = n && j.call(b.attrHandle, t.toLowerCase()) ? n(e, t, !E) : void 0
    + return void 0 !== r ? r : d.attributes || !E ? e.getAttribute(t) : (r = e.getAttributeNode(t)) && r.specified ? r.value : null
    + }),
    + (se.escape = function (e) {
    + return (e + "").replace(re, ie)
    + }),
    + (se.error = function (e) {
    + throw new Error("Syntax error, unrecognized expression: " + e)
    + }),
    + (se.uniqueSort = function (e) {
    + var t,
    + n = [],
    + r = 0,
    + i = 0
    + if (((l = !d.detectDuplicates), (u = !d.sortStable && e.slice(0)), e.sort(D), l)) {
    + while ((t = e[i++])) t === e[i] && (r = n.push(i))
    + while (r--) e.splice(n[r], 1)
    + }
    + return (u = null), e
    + }),
    + (o = se.getText =
    + function (e) {
    + var t,
    + n = "",
    + r = 0,
    + i = e.nodeType
    + if (i) {
    + if (1 === i || 9 === i || 11 === i) {
    + if ("string" == typeof e.textContent) return e.textContent
    + for (e = e.firstChild; e; e = e.nextSibling) n += o(e)
    + } else if (3 === i || 4 === i) return e.nodeValue
    + } else while ((t = e[r++])) n += o(t)
    + return n
    + }),
    + ((b = se.selectors =
    + {
    + cacheLength: 50,
    + createPseudo: le,
    + match: G,
    + attrHandle: {},
    + find: {},
    + relative: { ">": { dir: "parentNode", first: !0 }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: !0 }, "~": { dir: "previousSibling" } },
    + preFilter: {
    + ATTR: function (e) {
    + return (e[1] = e[1].replace(te, ne)), (e[3] = (e[3] || e[4] || e[5] || "").replace(te, ne)), "~=" === e[2] && (e[3] = " " + e[3] + " "), e.slice(0, 4)
    + },
    + CHILD: function (e) {
    + return (
    + (e[1] = e[1].toLowerCase()),
    + "nth" === e[1].slice(0, 3)
    + ? (e[3] || se.error(e[0]), (e[4] = +(e[4] ? e[5] + (e[6] || 1) : 2 * ("even" === e[3] || "odd" === e[3]))), (e[5] = +(e[7] + e[8] || "odd" === e[3])))
    + : e[3] && se.error(e[0]),
    + e
    + )
    + },
    + PSEUDO: function (e) {
    + var t,
    + n = !e[6] && e[2]
    + return G.CHILD.test(e[0])
    + ? null
    + : (e[3]
    + ? (e[2] = e[4] || e[5] || "")
    + : n && X.test(n) && (t = h(n, !0)) && (t = n.indexOf(")", n.length - t) - n.length) && ((e[0] = e[0].slice(0, t)), (e[2] = n.slice(0, t))),
    + e.slice(0, 3))
    + },
    + },
    + filter: {
    + TAG: function (e) {
    + var t = e.replace(te, ne).toLowerCase()
    + return "*" === e
    + ? function () {
    + return !0
    + }
    + : function (e) {
    + return e.nodeName && e.nodeName.toLowerCase() === t
    + }
    + },
    + CLASS: function (e) {
    + var t = p[e + " "]
    + return (
    + t ||
    + ((t = new RegExp("(^|" + M + ")" + e + "(" + M + "|$)")) &&
    + p(e, function (e) {
    + return t.test(("string" == typeof e.className && e.className) || ("undefined" != typeof e.getAttribute && e.getAttribute("class")) || "")
    + }))
    + )
    + },
    + ATTR: function (n, r, i) {
    + return function (e) {
    + var t = se.attr(e, n)
    + return null == t
    + ? "!=" === r
    + : !r ||
    + ((t += ""),
    + "=" === r
    + ? t === i
    + : "!=" === r
    + ? t !== i
    + : "^=" === r
    + ? i && 0 === t.indexOf(i)
    + : "*=" === r
    + ? i && -1 < t.indexOf(i)
    + : "$=" === r
    + ? i && t.slice(-i.length) === i
    + : "~=" === r
    + ? -1 < (" " + t.replace(F, " ") + " ").indexOf(i)
    + : "|=" === r && (t === i || t.slice(0, i.length + 1) === i + "-"))
    + }
    + },
    + CHILD: function (h, e, t, g, v) {
    + var y = "nth" !== h.slice(0, 3),
    + m = "last" !== h.slice(-4),
    + x = "of-type" === e
    + return 1 === g && 0 === v
    + ? function (e) {
    + return !!e.parentNode
    + }
    + : function (e, t, n) {
    + var r,
    + i,
    + o,
    + a,
    + s,
    + u,
    + l = y !== m ? "nextSibling" : "previousSibling",
    + c = e.parentNode,
    + f = x && e.nodeName.toLowerCase(),
    + p = !n && !x,
    + d = !1
    + if (c) {
    + if (y) {
    + while (l) {
    + a = e
    + while ((a = a[l])) if (x ? a.nodeName.toLowerCase() === f : 1 === a.nodeType) return !1
    + u = l = "only" === h && !u && "nextSibling"
    + }
    + return !0
    + }
    + if (((u = ? c.firstChild : c.lastChild]), m && p)) {
    + ;(d = (s = (r = (i = (o = (a = c)[k] || (a[k] = {}))[a.uniqueID] || (o[a.uniqueID] = {}))[h] || [])[0] === S && r[1]) && r[2]), (a = s && c.childNodes[s])
    + while ((a = (++s && a && a[l]) || (d = s = 0) || u.pop()))
    + if (1 === a.nodeType && ++d && a === e) {
    + i[h] = [S, s, d]
    + break
    + }
    + } else if ((p && (d = s = (r = (i = (o = (a = e)[k] || (a[k] = {}))[a.uniqueID] || (o[a.uniqueID] = {}))[h] || [])[0] === S && r[1]), !1 === d))
    + while ((a = (++s && a && a[l]) || (d = s = 0) || u.pop()))
    + if (
    + (x ? a.nodeName.toLowerCase() === f : 1 === a.nodeType) &&
    + ++d &&
    + (p && ((i = (o = a[k] || (a[k] = {}))[a.uniqueID] || (o[a.uniqueID] = {}))[h] = [S, d]), a === e)
    + )
    + break
    + return (d -= v) === g || (d % g == 0 && 0 <= d / g)
    + }
    + }
    + },
    + PSEUDO: function (e, o) {
    + var t,
    + a = b.pseudos[e] || b.setFilters[e.toLowerCase()] || se.error("unsupported pseudo: " + e)
    + return a[k]
    + ? a(o)
    + : 1 < a.length
    + ? ((t = [e, e, "", o]),
    + b.setFilters.hasOwnProperty(e.toLowerCase())
    + ? le(function (e, t) {
    + var n,
    + r = a(e, o),
    + i = r.length
    + while (i--) e[(n = P(e, r[i]))] = !(t[n] = r[i])
    + })
    + : function (e) {
    + return a(e, 0, t)
    + })
    + : a
    + },
    + },
    + pseudos: {
    + not: le(function (e) {
    + var r = [],
    + i = [],
    + s = f(e.replace(B, "$1"))
    + return s[k]
    + ? le(function (e, t, n, r) {
    + var i,
    + o = s(e, null, r, []),
    + a = e.length
    + while (a--) (i = o[a]) && (e[a] = !(t[a] = i))
    + })
    + : function (e, t, n) {
    + return (r[0] = e), s(r, null, n, i), (r[0] = null), !i.pop()
    + }
    + }),
    + has: le(function (t) {
    + return function (e) {
    + return 0 < se(t, e).length
    + }
    + }),
    + contains: le(function (t) {
    + return (
    + (t = t.replace(te, ne)),
    + function (e) {
    + return -1 < (e.textContent || o(e)).indexOf(t)
    + }
    + )
    + }),
    + lang: le(function (n) {
    + return (
    + V.test(n || "") || se.error("unsupported lang: " + n),
    + (n = n.replace(te, ne).toLowerCase()),
    + function (e) {
    + var t
    + do {
    + if ((t = E ? e.lang : e.getAttribute("xml:lang") || e.getAttribute("lang"))) return (t = t.toLowerCase()) === n || 0 === t.indexOf(n + "-")
    + } while ((e = e.parentNode) && 1 === e.nodeType)
    + return !1
    + }
    + )
    + }),
    + target: function (e) {
    + var t = n.location && n.location.hash
    + return t && t.slice(1) === e.id
    + },
    + root: function (e) {
    + return e === a
    + },
    + focus: function (e) {
    + return e === C.activeElement && (!C.hasFocus || C.hasFocus()) && !!(e.type || e.href || ~e.tabIndex)
    + },
    + enabled: ge(!1),
    + disabled: ge(!0),
    + checked: function (e) {
    + var t = e.nodeName.toLowerCase()
    + return ("input" === t && !!e.checked) || ("option" === t && !!e.selected)
    + },
    + selected: function (e) {
    + return e.parentNode && e.parentNode.selectedIndex, !0 === e.selected
    + },
    + empty: function (e) {
    + for (e = e.firstChild; e; e = e.nextSibling) if (e.nodeType < 6) return !1
    + return !0
    + },
    + parent: function (e) {
    + return !b.pseudos.empty(e)
    + },
    + header: function (e) {
    + return J.test(e.nodeName)
    + },
    + input: function (e) {
    + return Q.test(e.nodeName)
    + },
    + button: function (e) {
    + var t = e.nodeName.toLowerCase()
    + return ("input" === t && "button" === e.type) || "button" === t
    + },
    + text: function (e) {
    + var t
    + return "input" === e.nodeName.toLowerCase() && "text" === e.type && (null == (t = e.getAttribute("type")) || "text" === t.toLowerCase())
    + },
    + first: ve(function () {
    + return [0]
    + }),
    + last: ve(function (e, t) {
    + return [t - 1]
    + }),
    + eq: ve(function (e, t, n) {
    + return [n < 0 ? n + t : n]
    + }),
    + even: ve(function (e, t) {
    + for (var n = 0; n < t; n += 2) e.push(n)
    + return e
    + }),
    + odd: ve(function (e, t) {
    + for (var n = 1; n < t; n += 2) e.push(n)
    + return e
    + }),
    + lt: ve(function (e, t, n) {
    + for (var r = n < 0 ? n + t : t < n ? t : n; 0 <= --r; ) e.push(r)
    + return e
    + }),
    + gt: ve(function (e, t, n) {
    + for (var r = n < 0 ? n + t : n; ++r < t; ) e.push(r)
    + return e
    + }),
    + },
    + }).pseudos.nth = b.pseudos.eq),
    + { radio: !0, checkbox: !0, file: !0, password: !0, image: !0 }))
    + b.pseudos[e] = de(e)
    + for (e in { submit: !0, reset: !0 }) b.pseudos[e] = he(e)
    + function me() {}
    + function xe(e) {
    + for (var t = 0, n = e.length, r = ""; t < n; t++) r += e[t].value
    + return r
    + }
    + function be(s, e, t) {
    + var u = e.dir,
    + l = e.next,
    + c = l || u,
    + f = t && "parentNode" === c,
    + p = r++
    + return e.first
    + ? function (e, t, n) {
    + while ((e = e[u])) if (1 === e.nodeType || f) return s(e, t, n)
    + return !1
    + }
    + : function (e, t, n) {
    + var r,
    + i,
    + o,
    + a = [S, p]
    + if (n) {
    + while ((e = e[u])) if ((1 === e.nodeType || f) && s(e, t, n)) return !0
    + } else
    + while ((e = e[u]))
    + if (1 === e.nodeType || f)
    + if (((i = (o = e[k] || (e[k] = {}))[e.uniqueID] || (o[e.uniqueID] = {})), l && l === e.nodeName.toLowerCase())) e = e[u] || e
    + else {
    + if ((r = i[c]) && r[0] === S && r[1] === p) return (a[2] = r[2])
    + if (((i[c] = a)[2] = s(e, t, n))) return !0
    + }
    + return !1
    + }
    + }
    + function we(i) {
    + return 1 < i.length
    + ? function (e, t, n) {
    + var r = i.length
    + while (r--) if (!i[r](e, t, n)) return !1
    + return !0
    + }
    + : i[0]
    + }
    + function Te(e, t, n, r, i) {
    + for (var o, a = [], s = 0, u = e.length, l = null != t; s < u; s++) (o = e[s]) && ((n && !n(o, r, i)) || (a.push(o), l && t.push(s)))
    + return a
    + }
    + function Ce(d, h, g, v, y, e) {
    + return (
    + v && !v[k] && (v = Ce(v)),
    + y && !y[k] && (y = Ce(y, e)),
    + le(function (e, t, n, r) {
    + var i,
    + o,
    + a,
    + s = [],
    + u = [],
    + l = t.length,
    + c =
    + e ||
    + (function (e, t, n) {
    + for (var r = 0, i = t.length; r < i; r++) se(e, t[r], n)
    + return n
    + })(h || "*", n.nodeType ? [n] : n, []),
    + f = !d || (!e && h) ? c : Te(c, s, d, n, r),
    + p = g ? (y || (e ? d : l || v) ? [] : t) : f
    + if ((g && g(f, p, n, r), v)) {
    + ;(i = Te(p, u)), v(i, [], n, r), (o = i.length)
    + while (o--) (a = i[o]) && (p[u[o]] = !(f[u[o]] = a))
    + }
    + if (e) {
    + if (y || d) {
    + if (y) {
    + ;(i = []), (o = p.length)
    + while (o--) (a = p[o]) && i.push((f[o] = a))
    + y(null, (p = []), i, r)
    + }
    + o = p.length
    + while (o--) (a = p[o]) && -1 < (i = y ? P(e, a) : s[o]) && (e[i] = !(t[i] = a))
    + }
    + } else (p = Te(p === t ? p.splice(l, p.length) : p)), y ? y(null, t, p, r) : H.apply(t, p)
    + })
    + )
    + }
    + function Ee(e) {
    + for (
    + var i,
    + t,
    + n,
    + r = e.length,
    + o = b.relative[e[0].type],
    + a = o || b.relative[" "],
    + s = o ? 1 : 0,
    + u = be(
    + function (e) {
    + return e === i
    + },
    + a,
    + !0
    + ),
    + l = be(
    + function (e) {
    + return -1 < P(i, e)
    + },
    + a,
    + !0
    + ),
    + c = [
    + function (e, t, n) {
    + var r = (!o && (n || t !== w)) || ((i = t).nodeType ? u(e, t, n) : l(e, t, n))
    + return (i = null), r
    + },
    + ];
    + s < r;
    + s++
    + )
    + if ((t = b.relative[e[s].type])) c = [be(we(c), t)]
    + else {
    + if ((t = b.filter[e[s].type].apply(null, e[s].matches))[k]) {
    + for (n = ++s; n < r; n++) if (b.relative[e[n].type]) break
    + return Ce(
    + 1 < s && we(c),
    + 1 < s && xe(e.slice(0, s - 1).concat({ value: " " === e[s - 2].type ? "*" : "" })).replace(B, "$1"),
    + t,
    + s < n && Ee(e.slice(s, n)),
    + n < r && Ee((e = e.slice(n))),
    + n < r && xe(e)
    + )
    + }
    + c.push(t)
    + }
    + return we(c)
    + }
    + return (
    + (me.prototype = b.filters = b.pseudos),
    + (b.setFilters = new me()),
    + (h = se.tokenize =
    + function (e, t) {
    + var n,
    + r,
    + i,
    + o,
    + a,
    + s,
    + u,
    + l = x[e + " "]
    + if (l) return t ? 0 : l.slice(0)
    + ;(a = e), (s = []), (u = b.preFilter)
    + while (a) {
    + for (o in ((n && !(r = _.exec(a))) || (r && (a = a.slice(r[0].length) || a), s.push((i = []))),
    + (n = !1),
    + (r = z.exec(a)) && ((n = r.shift()), i.push({ value: n, type: r[0].replace(B, " ") }), (a = a.slice(n.length))),
    + b.filter))
    + !(r = G[o].exec(a)) || (u[o] && !(r = u[o](r))) || ((n = r.shift()), i.push({ value: n, type: o, matches: r }), (a = a.slice(n.length)))
    + if (!n) break
    + }
    + return t ? a.length : a ? se.error(e) : x(e, s).slice(0)
    + }),
    + (f = se.compile =
    + function (e, t) {
    + var n,
    + v,
    + y,
    + m,
    + x,
    + r,
    + i = [],
    + o = [],
    + a = N[e + " "]
    + if (!a) {
    + t || (t = h(e)), (n = t.length)
    + while (n--) (a = Ee(t[n]))[k] ? i.push(a) : o.push(a)
    + ;(a = N(
    + e,
    + ((v = o),
    + (m = 0 < (y = i).length),
    + (x = 0 < v.length),
    + (r = function (e, t, n, r, i) {
    + var o,
    + a,
    + s,
    + u = 0,
    + l = "0",
    + c = e && [],
    + f = [],
    + p = w,
    + d = e || (x && b.find.TAG("*", i)),
    + h = (S += null == p ? 1 : Math.random() || 0.1),
    + g = d.length
    + for (i && (w = t === C || t || i); l !== g && null != (o = d[l]); l++) {
    + if (x && o) {
    + ;(a = 0), t || o.ownerDocument === C || (T(o), (n = !E))
    + while ((s = v[a++]))
    + if (s(o, t || C, n)) {
    + r.push(o)
    + break
    + }
    + i && (S = h)
    + }
    + m && ((o = !s && o) && u--, e && c.push(o))
    + }
    + if (((u += l), m && l !== u)) {
    + a = 0
    + while ((s = y[a++])) s(c, f, t, n)
    + if (e) {
    + if (0 < u) while (l--) c[l] || f[l] || (f[l] = q.call(r))
    + f = Te(f)
    + }
    + H.apply(r, f), i && !e && 0 < f.length && 1 < u + y.length && se.uniqueSort(r)
    + }
    + return i && ((S = h), (w = p)), c
    + }),
    + m ? le(r) : r)
    + )).selector = e
    + }
    + return a
    + }),
    + (g = se.select =
    + function (e, t, n, r) {
    + var i,
    + o,
    + a,
    + s,
    + u,
    + l = "function" == typeof e && e,
    + c = !r && h((e = l.selector || e))
    + if (((n = n || []), 1 === c.length)) {
    + if (2 < (o = c[0] = c[0].slice(0)).length && "ID" === (a = o[0]).type && 9 === t.nodeType && E && b.relative[o[1].type]) {
    + if (!(t = (b.find.ID(a.matches[0].replace(te, ne), t) || [])[0])) return n
    + l && (t = t.parentNode), (e = e.slice(o.shift().value.length))
    + }
    + i = G.needsContext.test(e) ? 0 : o.length
    + while (i--) {
    + if (((a = o[i]), b.relative[(s = a.type)])) break
    + if ((u = b.find[s]) && (r = u(a.matches[0].replace(te, ne), (ee.test(o[0].type) && ye(t.parentNode)) || t))) {
    + if ((o.splice(i, 1), !(e = r.length && xe(o)))) return H.apply(n, r), n
    + break
    + }
    + }
    + }
    + return (l || f(e, c))(r, t, !E, n, !t || (ee.test(e) && ye(t.parentNode)) || t), n
    + }),
    + (d.sortStable = k.split("").sort(D).join("") === k),
    + (d.detectDuplicates = !!l),
    + T(),
    + (d.sortDetached = ce(function (e) {
    + return 1 & e.compareDocumentPosition(C.createElement("fieldset"))
    + })),
    + ce(function (e) {
    + return (e.innerHTML = ""), "#" === e.firstChild.getAttribute("href")
    + }) ||
    + fe("type|href|height|width", function (e, t, n) {
    + if (!n) return e.getAttribute(t, "type" === t.toLowerCase() ? 1 : 2)
    + }),
    + (d.attributes &&
    + ce(function (e) {
    + return (e.innerHTML = ""), e.firstChild.setAttribute("value", ""), "" === e.firstChild.getAttribute("value")
    + })) ||
    + fe("value", function (e, t, n) {
    + if (!n && "input" === e.nodeName.toLowerCase()) return e.defaultValue
    + }),
    + ce(function (e) {
    + return null == e.getAttribute("disabled")
    + }) ||
    + fe(R, function (e, t, n) {
    + var r
    + if (!n) return !0 === e[t] ? t.toLowerCase() : (r = e.getAttributeNode(t)) && r.specified ? r.value : null
    + }),
    + se
    + )
    + })(C)
    + ;(k.find = h),
    + (k.expr = h.selectors),
    + (k.expr[":"] = k.expr.pseudos),
    + (k.uniqueSort = k.unique = h.uniqueSort),
    + (k.text = h.getText),
    + (k.isXMLDoc = h.isXML),
    + (k.contains = h.contains),
    + (k.escapeSelector = h.escape)
    + var T = function (e, t, n) {
    + var r = [],
    + i = void 0 !== n
    + while ((e = e[t]) && 9 !== e.nodeType)
    + if (1 === e.nodeType) {
    + if (i && k(e).is(n)) break
    + r.push(e)
    + }
    + return r
    + },
    + S = function (e, t) {
    + for (var n = []; e; e = e.nextSibling) 1 === e.nodeType && e !== t && n.push(e)
    + return n
    + },
    + N = k.expr.match.needsContext
    + function A(e, t) {
    + return e.nodeName && e.nodeName.toLowerCase() === t.toLowerCase()
    + }
    + var D = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i
    + function j(e, n, r) {
    + return m(n)
    + ? k.grep(e, function (e, t) {
    + return !!n.call(e, t, e) !== r
    + })
    + : n.nodeType
    + ? k.grep(e, function (e) {
    + return (e === n) !== r
    + })
    + : "string" != typeof n
    + ? k.grep(e, function (e) {
    + return -1 < i.call(n, e) !== r
    + })
    + : k.filter(n, e, r)
    + }
    + ;(k.filter = function (e, t, n) {
    + var r = t[0]
    + return (
    + n && (e = ":not(" + e + ")"),
    + 1 === t.length && 1 === r.nodeType
    + ? k.find.matchesSelector(r, e)
    + ? [r]
    + : []
    + : k.find.matches(
    + e,
    + k.grep(t, function (e) {
    + return 1 === e.nodeType
    + })
    + )
    + )
    + }),
    + k.fn.extend({
    + find: function (e) {
    + var t,
    + n,
    + r = this.length,
    + i = this
    + if ("string" != typeof e)
    + return this.pushStack(
    + k(e).filter(function () {
    + for (t = 0; t < r; t++) if (k.contains(i[t], this)) return !0
    + })
    + )
    + for (n = this.pushStack([]), t = 0; t < r; t++) k.find(e, i[t], n)
    + return 1 < r ? k.uniqueSort(n) : n
    + },
    + filter: function (e) {
    + return this.pushStack(j(this, e || [], !1))
    + },
    + not: function (e) {
    + return this.pushStack(j(this, e || [], !0))
    + },
    + is: function (e) {
    + return !!j(this, "string" == typeof e && N.test(e) ? k(e) : e || [], !1).length
    + },
    + })
    + var q,
    + L = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/
    + ;((k.fn.init = function (e, t, n) {
    + var r, i
    + if (!e) return this
    + if (((n = n || q), "string" == typeof e)) {
    + if (!(r = "<" === e[0] && ">" === e[e.length - 1] && 3 <= e.length ? [null, e, null] : L.exec(e)) || (!r[1] && t))
    + return !t || t.jquery ? (t || n).find(e) : this.constructor(t).find(e)
    + if (r[1]) {
    + if (((t = t instanceof k ? t[0] : t), k.merge(this, k.parseHTML(r[1], t && t.nodeType ? t.ownerDocument || t : E, !0)), D.test(r[1]) && k.isPlainObject(t)))
    + for (r in t) m(this[r]) ? this[r](t[r]) : this.attr(r, t[r])
    + return this
    + }
    + return (i = E.getElementById(r[2])) && ((this[0] = i), (this.length = 1)), this
    + }
    + return e.nodeType ? ((this[0] = e), (this.length = 1), this) : m(e) ? (void 0 !== n.ready ? n.ready(e) : e(k)) : k.makeArray(e, this)
    + }).prototype = k.fn),
    + (q = k(E))
    + var H = /^(?:parents|prev(?:Until|All))/,
    + O = { children: !0, contents: !0, next: !0, prev: !0 }
    + function P(e, t) {
    + while ((e = e[t]) && 1 !== e.nodeType);
    + return e
    + }
    + k.fn.extend({
    + has: function (e) {
    + var t = k(e, this),
    + n = t.length
    + return this.filter(function () {
    + for (var e = 0; e < n; e++) if (k.contains(this, t[e])) return !0
    + })
    + },
    + closest: function (e, t) {
    + var n,
    + r = 0,
    + i = this.length,
    + o = [],
    + a = "string" != typeof e && k(e)
    + if (!N.test(e))
    + for (; r < i; r++)
    + for (n = this[r]; n && n !== t; n = n.parentNode)
    + if (n.nodeType < 11 && (a ? -1 < a.index(n) : 1 === n.nodeType && k.find.matchesSelector(n, e))) {
    + o.push(n)
    + break
    + }
    + return this.pushStack(1 < o.length ? k.uniqueSort(o) : o)
    + },
    + index: function (e) {
    + return e ? ("string" == typeof e ? i.call(k(e), this[0]) : i.call(this, e.jquery ? e[0] : e)) : this[0] && this[0].parentNode ? this.first().prevAll().length : -1
    + },
    + add: function (e, t) {
    + return this.pushStack(k.uniqueSort(k.merge(this.get(), k(e, t))))
    + },
    + addBack: function (e) {
    + return this.add(null == e ? this.prevObject : this.prevObject.filter(e))
    + },
    + }),
    + k.each(
    + {
    + parent: function (e) {
    + var t = e.parentNode
    + return t && 11 !== t.nodeType ? t : null
    + },
    + parents: function (e) {
    + return T(e, "parentNode")
    + },
    + parentsUntil: function (e, t, n) {
    + return T(e, "parentNode", n)
    + },
    + next: function (e) {
    + return P(e, "nextSibling")
    + },
    + prev: function (e) {
    + return P(e, "previousSibling")
    + },
    + nextAll: function (e) {
    + return T(e, "nextSibling")
    + },
    + prevAll: function (e) {
    + return T(e, "previousSibling")
    + },
    + nextUntil: function (e, t, n) {
    + return T(e, "nextSibling", n)
    + },
    + prevUntil: function (e, t, n) {
    + return T(e, "previousSibling", n)
    + },
    + siblings: function (e) {
    + return S((e.parentNode || {}).firstChild, e)
    + },
    + children: function (e) {
    + return S(e.firstChild)
    + },
    + contents: function (e) {
    + return "undefined" != typeof e.contentDocument ? e.contentDocument : (A(e, "template") && (e = e.content || e), k.merge([], e.childNodes))
    + },
    + },
    + function (r, i) {
    + k.fn[r] = function (e, t) {
    + var n = k.map(this, i, e)
    + return (
    + "Until" !== r.slice(-5) && (t = e),
    + t && "string" == typeof t && (n = k.filter(t, n)),
    + 1 < this.length && (O[r] || k.uniqueSort(n), H.test(r) && n.reverse()),
    + this.pushStack(n)
    + )
    + }
    + }
    + )
    + var R = /[^\x20\t\r\n\f]+/g
    + function M(e) {
    + return e
    + }
    + function I(e) {
    + throw e
    + }
    + function W(e, t, n, r) {
    + var i
    + try {
    + e && m((i = e.promise)) ? i.call(e).done(t).fail(n) : e && m((i = e.then)) ? i.call(e, t, n) : t.apply(void 0, [e].slice(r))
    + } catch (e) {
    + n.apply(void 0, [e])
    + }
    + }
    + ;(k.Callbacks = function (r) {
    + var e, n
    + r =
    + "string" == typeof r
    + ? ((e = r),
    + (n = {}),
    + k.each(e.match(R) || [], function (e, t) {
    + n[t] = !0
    + }),
    + n)
    + : k.extend({}, r)
    + var i,
    + t,
    + o,
    + a,
    + s = [],
    + u = [],
    + l = -1,
    + c = function () {
    + for (a = a || r.once, o = i = !0; u.length; l = -1) {
    + t = u.shift()
    + while (++l < s.length) !1 === s[l].apply(t[0], t[1]) && r.stopOnFalse && ((l = s.length), (t = !1))
    + }
    + r.memory || (t = !1), (i = !1), a && (s = t ? [] : "")
    + },
    + f = {
    + add: function () {
    + return (
    + s &&
    + (t && !i && ((l = s.length - 1), u.push(t)),
    + (function n(e) {
    + k.each(e, function (e, t) {
    + m(t) ? (r.unique && f.has(t)) || s.push(t) : t && t.length && "string" !== w(t) && n(t)
    + })
    + })(arguments),
    + t && !i && c()),
    + this
    + )
    + },
    + remove: function () {
    + return (
    + k.each(arguments, function (e, t) {
    + var n
    + while (-1 < (n = k.inArray(t, s, n))) s.splice(n, 1), n <= l && l--
    + }),
    + this
    + )
    + },
    + has: function (e) {
    + return e ? -1 < k.inArray(e, s) : 0 < s.length
    + },
    + empty: function () {
    + return s && (s = []), this
    + },
    + disable: function () {
    + return (a = u = []), (s = t = ""), this
    + },
    + disabled: function () {
    + return !s
    + },
    + lock: function () {
    + return (a = u = []), t || i || (s = t = ""), this
    + },
    + locked: function () {
    + return !!a
    + },
    + fireWith: function (e, t) {
    + return a || ((t = [e, (t = t || []).slice ? t.slice() : t]), u.push(t), i || c()), this
    + },
    + fire: function () {
    + return f.fireWith(this, arguments), this
    + },
    + fired: function () {
    + return !!o
    + },
    + }
    + return f
    + }),
    + k.extend({
    + Deferred: function (e) {
    + var o = [
    + ["notify", "progress", k.Callbacks("memory"), k.Callbacks("memory"), 2],
    + ["resolve", "done", k.Callbacks("once memory"), k.Callbacks("once memory"), 0, "resolved"],
    + ["reject", "fail", k.Callbacks("once memory"), k.Callbacks("once memory"), 1, "rejected"],
    + ],
    + i = "pending",
    + a = {
    + state: function () {
    + return i
    + },
    + always: function () {
    + return s.done(arguments).fail(arguments), this
    + },
    + catch: function (e) {
    + return a.then(null, e)
    + },
    + pipe: function () {
    + var i = arguments
    + return k
    + .Deferred(function (r) {
    + k.each(o, function (e, t) {
    + var n = m(i[t[4]]) && i[t[4]]
    + s[t[1]](function () {
    + var e = n && n.apply(this, arguments)
    + e && m(e.promise) ? e.promise().progress(r.notify).done(r.resolve).fail(r.reject) : r[t[0] + "With"](this, n ? [e] : arguments)
    + })
    + }),
    + (i = null)
    + })
    + .promise()
    + },
    + then: function (t, n, r) {
    + var u = 0
    + function l(i, o, a, s) {
    + return function () {
    + var n = this,
    + r = arguments,
    + e = function () {
    + var e, t
    + if (!(i < u)) {
    + if ((e = a.apply(n, r)) === o.promise()) throw new TypeError("Thenable self-resolution")
    + ;(t = e && ("object" == typeof e || "function" == typeof e) && e.then),
    + m(t)
    + ? s
    + ? t.call(e, l(u, o, M, s), l(u, o, I, s))
    + : (u++, t.call(e, l(u, o, M, s), l(u, o, I, s), l(u, o, M, o.notifyWith)))
    + : (a !== M && ((n = void 0), (r = [e])), (s || o.resolveWith)(n, r))
    + }
    + },
    + t = s
    + ? e
    + : function () {
    + try {
    + e()
    + } catch (e) {
    + k.Deferred.exceptionHook && k.Deferred.exceptionHook(e, t.stackTrace), u <= i + 1 && (a !== I && ((n = void 0), (r = [e])), o.rejectWith(n, r))
    + }
    + }
    + i ? t() : (k.Deferred.getStackHook && (t.stackTrace = k.Deferred.getStackHook()), C.setTimeout(t))
    + }
    + }
    + return k
    + .Deferred(function (e) {
    + o[0][3].add(l(0, e, m(r) ? r : M, e.notifyWith)), o[1][3].add(l(0, e, m(t) ? t : M)), o[2][3].add(l(0, e, m(n) ? n : I))
    + })
    + .promise()
    + },
    + promise: function (e) {
    + return null != e ? k.extend(e, a) : a
    + },
    + },
    + s = {}
    + return (
    + k.each(o, function (e, t) {
    + var n = t[2],
    + r = t[5]
    + ;(a[t[1]] = n.add),
    + r &&
    + n.add(
    + function () {
    + i = r
    + },
    + o[3 - e][2].disable,
    + o[3 - e][3].disable,
    + o[0][2].lock,
    + o[0][3].lock
    + ),
    + n.add(t[3].fire),
    + (s[t[0]] = function () {
    + return s[t[0] + "With"](this === s ? void 0 : this, arguments), this
    + }),
    + (s[t[0] + "With"] = n.fireWith)
    + }),
    + a.promise(s),
    + e && e.call(s, s),
    + s
    + )
    + },
    + when: function (e) {
    + var n = arguments.length,
    + t = n,
    + r = Array(t),
    + i = s.call(arguments),
    + o = k.Deferred(),
    + a = function (t) {
    + return function (e) {
    + ;(r[t] = this), (i[t] = 1 < arguments.length ? s.call(arguments) : e), --n || o.resolveWith(r, i)
    + }
    + }
    + if (n <= 1 && (W(e, o.done(a(t)).resolve, o.reject, !n), "pending" === o.state() || m(i[t] && i[t].then))) return o.then()
    + while (t--) W(i[t], a(t), o.reject)
    + return o.promise()
    + },
    + })
    + var $ = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/
    + ;(k.Deferred.exceptionHook = function (e, t) {
    + C.console && C.console.warn && e && $.test(e.name) && C.console.warn("jQuery.Deferred exception: " + e.message, e.stack, t)
    + }),
    + (k.readyException = function (e) {
    + C.setTimeout(function () {
    + throw e
    + })
    + })
    + var F = k.Deferred()
    + function B() {
    + E.removeEventListener("DOMContentLoaded", B), C.removeEventListener("load", B), k.ready()
    + }
    + ;(k.fn.ready = function (e) {
    + return (
    + F.then(e)["catch"](function (e) {
    + k.readyException(e)
    + }),
    + this
    + )
    + }),
    + k.extend({
    + isReady: !1,
    + readyWait: 1,
    + ready: function (e) {
    + ;(!0 === e ? --k.readyWait : k.isReady) || ((k.isReady = !0) !== e && 0 < --k.readyWait) || F.resolveWith(E, [k])
    + },
    + }),
    + (k.ready.then = F.then),
    + "complete" === E.readyState || ("loading" !== E.readyState && !E.documentElement.doScroll)
    + ? C.setTimeout(k.ready)
    + : (E.addEventListener("DOMContentLoaded", B), C.addEventListener("load", B))
    + var _ = function (e, t, n, r, i, o, a) {
    + var s = 0,
    + u = e.length,
    + l = null == n
    + if ("object" === w(n)) for (s in ((i = !0), n)) _(e, t, s, n[s], !0, o, a)
    + else if (
    + void 0 !== r &&
    + ((i = !0),
    + m(r) || (a = !0),
    + l &&
    + (a
    + ? (t.call(e, r), (t = null))
    + : ((l = t),
    + (t = function (e, t, n) {
    + return l.call(k(e), n)
    + }))),
    + t)
    + )
    + for (; s < u; s++) t(e[s], n, a ? r : r.call(e[s], s, t(e[s], n)))
    + return i ? e : l ? t.call(e) : u ? t(e[0], n) : o
    + },
    + z = /^-ms-/,
    + U = /-([a-z])/g
    + function X(e, t) {
    + return t.toUpperCase()
    + }
    + function V(e) {
    + return e.replace(z, "ms-").replace(U, X)
    + }
    + var G = function (e) {
    + return 1 === e.nodeType || 9 === e.nodeType || !+e.nodeType
    + }
    + function Y() {
    + this.expando = k.expando + Y.uid++
    + }
    + ;(Y.uid = 1),
    + (Y.prototype = {
    + cache: function (e) {
    + var t = e[this.expando]
    + return t || ((t = {}), G(e) && (e.nodeType ? (e[this.expando] = t) : Object.defineProperty(e, this.expando, { value: t, configurable: !0 }))), t
    + },
    + set: function (e, t, n) {
    + var r,
    + i = this.cache(e)
    + if ("string" == typeof t) i[V(t)] = n
    + else for (r in t) i[V(r)] = t[r]
    + return i
    + },
    + get: function (e, t) {
    + return void 0 === t ? this.cache(e) : e[this.expando] && e[this.expando][V(t)]
    + },
    + access: function (e, t, n) {
    + return void 0 === t || (t && "string" == typeof t && void 0 === n) ? this.get(e, t) : (this.set(e, t, n), void 0 !== n ? n : t)
    + },
    + remove: function (e, t) {
    + var n,
    + r = e[this.expando]
    + if (void 0 !== r) {
    + if (void 0 !== t) {
    + n = (t = Array.isArray(t) ? t.map(V) : (t = V(t)) in r ? [t] : t.match(R) || []).length
    + while (n--) delete r[t[n]]
    + }
    + ;(void 0 === t || k.isEmptyObject(r)) && (e.nodeType ? (e[this.expando] = void 0) : delete e[this.expando])
    + }
    + },
    + hasData: function (e) {
    + var t = e[this.expando]
    + return void 0 !== t && !k.isEmptyObject(t)
    + },
    + })
    + var Q = new Y(),
    + J = new Y(),
    + K = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
    + Z = /[A-Z]/g
    + function ee(e, t, n) {
    + var r, i
    + if (void 0 === n && 1 === e.nodeType)
    + if (((r = "data-" + t.replace(Z, "-$&").toLowerCase()), "string" == typeof (n = e.getAttribute(r)))) {
    + try {
    + n = "true" === (i = n) || ("false" !== i && ("null" === i ? null : i === +i + "" ? +i : K.test(i) ? JSON.parse(i) : i))
    + } catch (e) {}
    + J.set(e, t, n)
    + } else n = void 0
    + return n
    + }
    + k.extend({
    + hasData: function (e) {
    + return J.hasData(e) || Q.hasData(e)
    + },
    + data: function (e, t, n) {
    + return J.access(e, t, n)
    + },
    + removeData: function (e, t) {
    + J.remove(e, t)
    + },
    + _data: function (e, t, n) {
    + return Q.access(e, t, n)
    + },
    + _removeData: function (e, t) {
    + Q.remove(e, t)
    + },
    + }),
    + k.fn.extend({
    + data: function (n, e) {
    + var t,
    + r,
    + i,
    + o = this[0],
    + a = o && o.attributes
    + if (void 0 === n) {
    + if (this.length && ((i = J.get(o)), 1 === o.nodeType && !Q.get(o, "hasDataAttrs"))) {
    + t = a.length
    + while (t--) a[t] && 0 === (r = a[t].name).indexOf("data-") && ((r = V(r.slice(5))), ee(o, r, i[r]))
    + Q.set(o, "hasDataAttrs", !0)
    + }
    + return i
    + }
    + return "object" == typeof n
    + ? this.each(function () {
    + J.set(this, n)
    + })
    + : _(
    + this,
    + function (e) {
    + var t
    + if (o && void 0 === e) return void 0 !== (t = J.get(o, n)) ? t : void 0 !== (t = ee(o, n)) ? t : void 0
    + this.each(function () {
    + J.set(this, n, e)
    + })
    + },
    + null,
    + e,
    + 1 < arguments.length,
    + null,
    + !0
    + )
    + },
    + removeData: function (e) {
    + return this.each(function () {
    + J.remove(this, e)
    + })
    + },
    + }),
    + k.extend({
    + queue: function (e, t, n) {
    + var r
    + if (e) return (t = (t || "fx") + "queue"), (r = Q.get(e, t)), n && (!r || Array.isArray(n) ? (r = Q.access(e, t, k.makeArray(n))) : r.push(n)), r || []
    + },
    + dequeue: function (e, t) {
    + t = t || "fx"
    + var n = k.queue(e, t),
    + r = n.length,
    + i = n.shift(),
    + o = k._queueHooks(e, t)
    + "inprogress" === i && ((i = n.shift()), r--),
    + i &&
    + ("fx" === t && n.unshift("inprogress"),
    + delete o.stop,
    + i.call(
    + e,
    + function () {
    + k.dequeue(e, t)
    + },
    + o
    + )),
    + !r && o && o.empty.fire()
    + },
    + _queueHooks: function (e, t) {
    + var n = t + "queueHooks"
    + return (
    + Q.get(e, n) ||
    + Q.access(e, n, {
    + empty: k.Callbacks("once memory").add(function () {
    + Q.remove(e, [t + "queue", n])
    + }),
    + })
    + )
    + },
    + }),
    + k.fn.extend({
    + queue: function (t, n) {
    + var e = 2
    + return (
    + "string" != typeof t && ((n = t), (t = "fx"), e--),
    + arguments.length < e
    + ? k.queue(this[0], t)
    + : void 0 === n
    + ? this
    + : this.each(function () {
    + var e = k.queue(this, t, n)
    + k._queueHooks(this, t), "fx" === t && "inprogress" !== e[0] && k.dequeue(this, t)
    + })
    + )
    + },
    + dequeue: function (e) {
    + return this.each(function () {
    + k.dequeue(this, e)
    + })
    + },
    + clearQueue: function (e) {
    + return this.queue(e || "fx", [])
    + },
    + promise: function (e, t) {
    + var n,
    + r = 1,
    + i = k.Deferred(),
    + o = this,
    + a = this.length,
    + s = function () {
    + --r || i.resolveWith(o, [o])
    + }
    + "string" != typeof e && ((t = e), (e = void 0)), (e = e || "fx")
    + while (a--) (n = Q.get(o[a], e + "queueHooks")) && n.empty && (r++, n.empty.add(s))
    + return s(), i.promise(t)
    + },
    + })
    + var te = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
    + ne = new RegExp("^(?:([+-])=|)(" + te + ")([a-z%]*)$", "i"),
    + re = ["Top", "Right", "Bottom", "Left"],
    + ie = E.documentElement,
    + oe = function (e) {
    + return k.contains(e.ownerDocument, e)
    + },
    + ae = { composed: !0 }
    + ie.getRootNode &&
    + (oe = function (e) {
    + return k.contains(e.ownerDocument, e) || e.getRootNode(ae) === e.ownerDocument
    + })
    + var se = function (e, t) {
    + return "none" === (e = t || e).style.display || ("" === e.style.display && oe(e) && "none" === k.css(e, "display"))
    + },
    + ue = function (e, t, n, r) {
    + var i,
    + o,
    + a = {}
    + for (o in t) (a[o] = e.style[o]), (e.style[o] = t[o])
    + for (o in ((i = n.apply(e, r || [])), t)) e.style[o] = a[o]
    + return i
    + }
    + function le(e, t, n, r) {
    + var i,
    + o,
    + a = 20,
    + s = r
    + ? function () {
    + return r.cur()
    + }
    + : function () {
    + return k.css(e, t, "")
    + },
    + u = s(),
    + l = (n && n[3]) || (k.cssNumber[t] ? "" : "px"),
    + c = e.nodeType && (k.cssNumber[t] || ("px" !== l && +u)) && ne.exec(k.css(e, t))
    + if (c && c[3] !== l) {
    + ;(u /= 2), (l = l || c[3]), (c = +u || 1)
    + while (a--) k.style(e, t, c + l), (1 - o) * (1 - (o = s() / u || 0.5)) <= 0 && (a = 0), (c /= o)
    + ;(c *= 2), k.style(e, t, c + l), (n = n || [])
    + }
    + return n && ((c = +c || +u || 0), (i = n[1] ? c + (n[1] + 1) * n[2] : +n[2]), r && ((r.unit = l), (r.start = c), (r.end = i))), i
    + }
    + var ce = {}
    + function fe(e, t) {
    + for (var n, r, i, o, a, s, u, l = [], c = 0, f = e.length; c < f; c++)
    + (r = e[c]).style &&
    + ((n = r.style.display),
    + t
    + ? ("none" === n && ((l[c] = Q.get(r, "display") || null), l[c] || (r.style.display = "")),
    + "" === r.style.display &&
    + se(r) &&
    + (l[c] =
    + ((u = a = o = void 0),
    + (a = (i = r).ownerDocument),
    + (s = i.nodeName),
    + (u = ce[s]) || ((o = a.body.appendChild(a.createElement(s))), (u = k.css(o, "display")), o.parentNode.removeChild(o), "none" === u && (u = "block"), (ce[s] = u)))))
    + : "none" !== n && ((l[c] = "none"), Q.set(r, "display", n)))
    + for (c = 0; c < f; c++) null != l[c] && (e[c].style.display = l[c])
    + return e
    + }
    + k.fn.extend({
    + show: function () {
    + return fe(this, !0)
    + },
    + hide: function () {
    + return fe(this)
    + },
    + toggle: function (e) {
    + return "boolean" == typeof e
    + ? e
    + ? this.show()
    + : this.hide()
    + : this.each(function () {
    + se(this) ? k(this).show() : k(this).hide()
    + })
    + },
    + })
    + var pe = /^(?:checkbox|radio)$/i,
    + de = /<([a-z][^\/\0>\x20\t\r\n\f]*)/i,
    + he = /^$|^module$|\/(?:java|ecma)script/i,
    + ge = {
    + option: [1, ""],
    + thead: [1, "", "
    "],
    + col: [2, "", "
    "],
    + tr: [2, "", "
    "],
    + td: [3, "", "
    "],
    + _default: [0, "", ""],
    + }
    + function ve(e, t) {
    + var n
    + return (
    + (n = "undefined" != typeof e.getElementsByTagName ? e.getElementsByTagName(t || "*") : "undefined" != typeof e.querySelectorAll ? e.querySelectorAll(t || "*") : []),
    + void 0 === t || (t && A(e, t)) ? k.merge([e], n) : n
    + )
    + }
    + function ye(e, t) {
    + for (var n = 0, r = e.length; n < r; n++) Q.set(e[n], "globalEval", !t || Q.get(t[n], "globalEval"))
    + }
    + ;(ge.optgroup = ge.option), (ge.tbody = ge.tfoot = ge.colgroup = ge.caption = ge.thead), (ge.th = ge.td)
    + var me,
    + xe,
    + be = /<|&#?\w+;/
    + function we(e, t, n, r, i) {
    + for (var o, a, s, u, l, c, f = t.createDocumentFragment(), p = [], d = 0, h = e.length; d < h; d++)
    + if ((o = e[d]) || 0 === o)
    + if ("object" === w(o)) k.merge(p, o.nodeType ? [o] : o)
    + else if (be.test(o)) {
    + ;(a = a || f.appendChild(t.createElement("div"))),
    + (s = (de.exec(o) || ["", ""])[1].toLowerCase()),
    + (u = ge[s] || ge._default),
    + (a.innerHTML = u[1] + k.htmlPrefilter(o) + u[2]),
    + (c = u[0])
    + while (c--) a = a.lastChild
    + k.merge(p, a.childNodes), ((a = f.firstChild).textContent = "")
    + } else p.push(t.createTextNode(o))
    + ;(f.textContent = ""), (d = 0)
    + while ((o = p[d++]))
    + if (r && -1 < k.inArray(o, r)) i && i.push(o)
    + else if (((l = oe(o)), (a = ve(f.appendChild(o), "script")), l && ye(a), n)) {
    + c = 0
    + while ((o = a[c++])) he.test(o.type || "") && n.push(o)
    + }
    + return f
    + }
    + ;(me = E.createDocumentFragment().appendChild(E.createElement("div"))),
    + (xe = E.createElement("input")).setAttribute("type", "radio"),
    + xe.setAttribute("checked", "checked"),
    + xe.setAttribute("name", "t"),
    + me.appendChild(xe),
    + (y.checkClone = me.cloneNode(!0).cloneNode(!0).lastChild.checked),
    + (me.innerHTML = ""),
    + (y.noCloneChecked = !!me.cloneNode(!0).lastChild.defaultValue)
    + var Te = /^key/,
    + Ce = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
    + Ee = /^([^.]*)(?:\.(.+)|)/
    + function ke() {
    + return !0
    + }
    + function Se() {
    + return !1
    + }
    + function Ne(e, t) {
    + return (
    + (e ===
    + (function () {
    + try {
    + return E.activeElement
    + } catch (e) {}
    + })()) ==
    + ("focus" === t)
    + )
    + }
    + function Ae(e, t, n, r, i, o) {
    + var a, s
    + if ("object" == typeof t) {
    + for (s in ("string" != typeof n && ((r = r || n), (n = void 0)), t)) Ae(e, s, n, r, t[s], o)
    + return e
    + }
    + if ((null == r && null == i ? ((i = n), (r = n = void 0)) : null == i && ("string" == typeof n ? ((i = r), (r = void 0)) : ((i = r), (r = n), (n = void 0))), !1 === i)) i = Se
    + else if (!i) return e
    + return (
    + 1 === o &&
    + ((a = i),
    + ((i = function (e) {
    + return k().off(e), a.apply(this, arguments)
    + }).guid = a.guid || (a.guid = k.guid++))),
    + e.each(function () {
    + k.event.add(this, t, i, r, n)
    + })
    + )
    + }
    + function De(e, i, o) {
    + o
    + ? (Q.set(e, i, !1),
    + k.event.add(e, i, {
    + namespace: !1,
    + handler: function (e) {
    + var t,
    + n,
    + r = Q.get(this, i)
    + if (1 & e.isTrigger && this[i]) {
    + if (r.length) (k.event.special[i] || {}).delegateType && e.stopPropagation()
    + else if (((r = s.call(arguments)), Q.set(this, i, r), (t = o(this, i)), this[i](), r !== (n = Q.get(this, i)) || t ? Q.set(this, i, !1) : (n = {}), r !== n))
    + return e.stopImmediatePropagation(), e.preventDefault(), n.value
    + } else r.length && (Q.set(this, i, { value: k.event.trigger(k.extend(r[0], k.Event.prototype), r.slice(1), this) }), e.stopImmediatePropagation())
    + },
    + }))
    + : void 0 === Q.get(e, i) && k.event.add(e, i, ke)
    + }
    + ;(k.event = {
    + global: {},
    + add: function (t, e, n, r, i) {
    + var o,
    + a,
    + s,
    + u,
    + l,
    + c,
    + f,
    + p,
    + d,
    + h,
    + g,
    + v = Q.get(t)
    + if (v) {
    + n.handler && ((n = (o = n).handler), (i = o.selector)),
    + i && k.find.matchesSelector(ie, i),
    + n.guid || (n.guid = k.guid++),
    + (u = v.events) || (u = v.events = {}),
    + (a = v.handle) ||
    + (a = v.handle =
    + function (e) {
    + return "undefined" != typeof k && k.event.triggered !== e.type ? k.event.dispatch.apply(t, arguments) : void 0
    + }),
    + (l = (e = (e || "").match(R) || [""]).length)
    + while (l--)
    + (d = g = (s = Ee.exec(e[l]) || [])[1]),
    + (h = (s[2] || "").split(".").sort()),
    + d &&
    + ((f = k.event.special[d] || {}),
    + (d = (i ? f.delegateType : f.bindType) || d),
    + (f = k.event.special[d] || {}),
    + (c = k.extend(
    + { type: d, origType: g, data: r, handler: n, guid: n.guid, selector: i, needsContext: i && k.expr.match.needsContext.test(i), namespace: h.join(".") },
    + o
    + )),
    + (p = u[d]) || (((p = u[d] = []).delegateCount = 0), (f.setup && !1 !== f.setup.call(t, r, h, a)) || (t.addEventListener && t.addEventListener(d, a))),
    + f.add && (f.add.call(t, c), c.handler.guid || (c.handler.guid = n.guid)),
    + i ? p.splice(p.delegateCount++, 0, c) : p.push(c),
    + (k.event.global[d] = !0))
    + }
    + },
    + remove: function (e, t, n, r, i) {
    + var o,
    + a,
    + s,
    + u,
    + l,
    + c,
    + f,
    + p,
    + d,
    + h,
    + g,
    + v = Q.hasData(e) && Q.get(e)
    + if (v && (u = v.events)) {
    + l = (t = (t || "").match(R) || [""]).length
    + while (l--)
    + if (((d = g = (s = Ee.exec(t[l]) || [])[1]), (h = (s[2] || "").split(".").sort()), d)) {
    + ;(f = k.event.special[d] || {}),
    + (p = u[(d = (r ? f.delegateType : f.bindType) || d)] || []),
    + (s = s[2] && new RegExp("(^|\\.)" + h.join("\\.(?:.*\\.|)") + "(\\.|$)")),
    + (a = o = p.length)
    + while (o--)
    + (c = p[o]),
    + (!i && g !== c.origType) ||
    + (n && n.guid !== c.guid) ||
    + (s && !s.test(c.namespace)) ||
    + (r && r !== c.selector && ("**" !== r || !c.selector)) ||
    + (p.splice(o, 1), c.selector && p.delegateCount--, f.remove && f.remove.call(e, c))
    + a && !p.length && ((f.teardown && !1 !== f.teardown.call(e, h, v.handle)) || k.removeEvent(e, d, v.handle), delete u[d])
    + } else for (d in u) k.event.remove(e, d + t[l], n, r, !0)
    + k.isEmptyObject(u) && Q.remove(e, "handle events")
    + }
    + },
    + dispatch: function (e) {
    + var t,
    + n,
    + r,
    + i,
    + o,
    + a,
    + s = k.event.fix(e),
    + u = new Array(arguments.length),
    + l = (Q.get(this, "events") || {})[s.type] || [],
    + c = k.event.special[s.type] || {}
    + for (u[0] = s, t = 1; t < arguments.length; t++) u[t] = arguments[t]
    + if (((s.delegateTarget = this), !c.preDispatch || !1 !== c.preDispatch.call(this, s))) {
    + ;(a = k.event.handlers.call(this, s, l)), (t = 0)
    + while ((i = a[t++]) && !s.isPropagationStopped()) {
    + ;(s.currentTarget = i.elem), (n = 0)
    + while ((o = i.handlers[n++]) && !s.isImmediatePropagationStopped())
    + (s.rnamespace && !1 !== o.namespace && !s.rnamespace.test(o.namespace)) ||
    + ((s.handleObj = o),
    + (s.data = o.data),
    + void 0 !== (r = ((k.event.special[o.origType] || {}).handle || o.handler).apply(i.elem, u)) && !1 === (s.result = r) && (s.preventDefault(), s.stopPropagation()))
    + }
    + return c.postDispatch && c.postDispatch.call(this, s), s.result
    + }
    + },
    + handlers: function (e, t) {
    + var n,
    + r,
    + i,
    + o,
    + a,
    + s = [],
    + u = t.delegateCount,
    + l = e.target
    + if (u && l.nodeType && !("click" === e.type && 1 <= e.button))
    + for (; l !== this; l = l.parentNode || this)
    + if (1 === l.nodeType && ("click" !== e.type || !0 !== l.disabled)) {
    + for (o = [], a = {}, n = 0; n < u; n++)
    + void 0 === a[(i = (r = t[n]).selector + " ")] && (a[i] = r.needsContext ? -1 < k(i, this).index(l) : k.find(i, this, null, [l]).length), a[i] && o.push(r)
    + o.length && s.push({ elem: l, handlers: o })
    + }
    + return (l = this), u < t.length && s.push({ elem: l, handlers: t.slice(u) }), s
    + },
    + addProp: function (t, e) {
    + Object.defineProperty(k.Event.prototype, t, {
    + enumerable: !0,
    + configurable: !0,
    + get: m(e)
    + ? function () {
    + if (this.originalEvent) return e(this.originalEvent)
    + }
    + : function () {
    + if (this.originalEvent) return this.originalEvent[t]
    + },
    + set: function (e) {
    + Object.defineProperty(this, t, { enumerable: !0, configurable: !0, writable: !0, value: e })
    + },
    + })
    + },
    + fix: function (e) {
    + return e[k.expando] ? e : new k.Event(e)
    + },
    + special: {
    + load: { noBubble: !0 },
    + click: {
    + setup: function (e) {
    + var t = this || e
    + return pe.test(t.type) && t.click && A(t, "input") && De(t, "click", ke), !1
    + },
    + trigger: function (e) {
    + var t = this || e
    + return pe.test(t.type) && t.click && A(t, "input") && De(t, "click"), !0
    + },
    + _default: function (e) {
    + var t = e.target
    + return (pe.test(t.type) && t.click && A(t, "input") && Q.get(t, "click")) || A(t, "a")
    + },
    + },
    + beforeunload: {
    + postDispatch: function (e) {
    + void 0 !== e.result && e.originalEvent && (e.originalEvent.returnValue = e.result)
    + },
    + },
    + },
    + }),
    + (k.removeEvent = function (e, t, n) {
    + e.removeEventListener && e.removeEventListener(t, n)
    + }),
    + (k.Event = function (e, t) {
    + if (!(this instanceof k.Event)) return new k.Event(e, t)
    + e && e.type
    + ? ((this.originalEvent = e),
    + (this.type = e.type),
    + (this.isDefaultPrevented = e.defaultPrevented || (void 0 === e.defaultPrevented && !1 === e.returnValue) ? ke : Se),
    + (this.target = e.target && 3 === e.target.nodeType ? e.target.parentNode : e.target),
    + (this.currentTarget = e.currentTarget),
    + (this.relatedTarget = e.relatedTarget))
    + : (this.type = e),
    + t && k.extend(this, t),
    + (this.timeStamp = (e && e.timeStamp) || Date.now()),
    + (this[k.expando] = !0)
    + }),
    + (k.Event.prototype = {
    + constructor: k.Event,
    + isDefaultPrevented: Se,
    + isPropagationStopped: Se,
    + isImmediatePropagationStopped: Se,
    + isSimulated: !1,
    + preventDefault: function () {
    + var e = this.originalEvent
    + ;(this.isDefaultPrevented = ke), e && !this.isSimulated && e.preventDefault()
    + },
    + stopPropagation: function () {
    + var e = this.originalEvent
    + ;(this.isPropagationStopped = ke), e && !this.isSimulated && e.stopPropagation()
    + },
    + stopImmediatePropagation: function () {
    + var e = this.originalEvent
    + ;(this.isImmediatePropagationStopped = ke), e && !this.isSimulated && e.stopImmediatePropagation(), this.stopPropagation()
    + },
    + }),
    + k.each(
    + {
    + altKey: !0,
    + bubbles: !0,
    + cancelable: !0,
    + changedTouches: !0,
    + ctrlKey: !0,
    + detail: !0,
    + eventPhase: !0,
    + metaKey: !0,
    + pageX: !0,
    + pageY: !0,
    + shiftKey: !0,
    + view: !0,
    + char: !0,
    + code: !0,
    + charCode: !0,
    + key: !0,
    + keyCode: !0,
    + button: !0,
    + buttons: !0,
    + clientX: !0,
    + clientY: !0,
    + offsetX: !0,
    + offsetY: !0,
    + pointerId: !0,
    + pointerType: !0,
    + screenX: !0,
    + screenY: !0,
    + targetTouches: !0,
    + toElement: !0,
    + touches: !0,
    + which: function (e) {
    + var t = e.button
    + return null == e.which && Te.test(e.type)
    + ? null != e.charCode
    + ? e.charCode
    + : e.keyCode
    + : !e.which && void 0 !== t && Ce.test(e.type)
    + ? 1 & t
    + ? 1
    + : 2 & t
    + ? 3
    + : 4 & t
    + ? 2
    + : 0
    + : e.which
    + },
    + },
    + k.event.addProp
    + ),
    + k.each({ focus: "focusin", blur: "focusout" }, function (e, t) {
    + k.event.special[e] = {
    + setup: function () {
    + return De(this, e, Ne), !1
    + },
    + trigger: function () {
    + return De(this, e), !0
    + },
    + delegateType: t,
    + }
    + }),
    + k.each({ mouseenter: "mouseover", mouseleave: "mouseout", pointerenter: "pointerover", pointerleave: "pointerout" }, function (e, i) {
    + k.event.special[e] = {
    + delegateType: i,
    + bindType: i,
    + handle: function (e) {
    + var t,
    + n = e.relatedTarget,
    + r = e.handleObj
    + return (n && (n === this || k.contains(this, n))) || ((e.type = r.origType), (t = r.handler.apply(this, arguments)), (e.type = i)), t
    + },
    + }
    + }),
    + k.fn.extend({
    + on: function (e, t, n, r) {
    + return Ae(this, e, t, n, r)
    + },
    + one: function (e, t, n, r) {
    + return Ae(this, e, t, n, r, 1)
    + },
    + off: function (e, t, n) {
    + var r, i
    + if (e && e.preventDefault && e.handleObj)
    + return (r = e.handleObj), k(e.delegateTarget).off(r.namespace ? r.origType + "." + r.namespace : r.origType, r.selector, r.handler), this
    + if ("object" == typeof e) {
    + for (i in e) this.off(i, t, e[i])
    + return this
    + }
    + return (
    + (!1 !== t && "function" != typeof t) || ((n = t), (t = void 0)),
    + !1 === n && (n = Se),
    + this.each(function () {
    + k.event.remove(this, e, n, t)
    + })
    + )
    + },
    + })
    + var je = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
    + qe = /
    + Le = /checked\s*(?:[^=]|=\s*.checked.)/i,
    + He = /^\s*\s*$/g
    + function Oe(e, t) {
    + return (A(e, "table") && A(11 !== t.nodeType ? t : t.firstChild, "tr") && k(e).children("tbody")[0]) || e
    + }
    + function Pe(e) {
    + return (e.type = (null !== e.getAttribute("type")) + "/" + e.type), e
    + }
    + function Re(e) {
    + return "true/" === (e.type || "").slice(0, 5) ? (e.type = e.type.slice(5)) : e.removeAttribute("type"), e
    + }
    + function Me(e, t) {
    + var n, r, i, o, a, s, u, l
    + if (1 === t.nodeType) {
    + if (Q.hasData(e) && ((o = Q.access(e)), (a = Q.set(t, o)), (l = o.events)))
    + for (i in (delete a.handle, (a.events = {}), l)) for (n = 0, r = l[i].length; n < r; n++) k.event.add(t, i, l[i][n])
    + J.hasData(e) && ((s = J.access(e)), (u = k.extend({}, s)), J.set(t, u))
    + }
    + }
    + function Ie(n, r, i, o) {
    + r = g.apply([], r)
    + var e,
    + t,
    + a,
    + s,
    + u,
    + l,
    + c = 0,
    + f = n.length,
    + p = f - 1,
    + d = r[0],
    + h = m(d)
    + if (h || (1 < f && "string" == typeof d && !y.checkClone && Le.test(d)))
    + return n.each(function (e) {
    + var t = n.eq(e)
    + h && (r[0] = d.call(this, e, t.html())), Ie(t, r, i, o)
    + })
    + if (f && ((t = (e = we(r, n[0].ownerDocument, !1, n, o)).firstChild), 1 === e.childNodes.length && (e = t), t || o)) {
    + for (s = (a = k.map(ve(e, "script"), Pe)).length; c < f; c++) (u = e), c !== p && ((u = k.clone(u, !0, !0)), s && k.merge(a, ve(u, "script"))), i.call(n[c], u, c)
    + if (s)
    + for (l = a[a.length - 1].ownerDocument, k.map(a, Re), c = 0; c < s; c++)
    + (u = a[c]),
    + he.test(u.type || "") &&
    + !Q.access(u, "globalEval") &&
    + k.contains(l, u) &&
    + (u.src && "module" !== (u.type || "").toLowerCase()
    + ? k._evalUrl && !u.noModule && k._evalUrl(u.src, { nonce: u.nonce || u.getAttribute("nonce") })
    + : b(u.textContent.replace(He, ""), u, l))
    + }
    + return n
    + }
    + function We(e, t, n) {
    + for (var r, i = t ? k.filter(t, e) : e, o = 0; null != (r = i[o]); o++)
    + n || 1 !== r.nodeType || k.cleanData(ve(r)), r.parentNode && (n && oe(r) && ye(ve(r, "script")), r.parentNode.removeChild(r))
    + return e
    + }
    + k.extend({
    + htmlPrefilter: function (e) {
    + return e.replace(je, "<$1>")
    + },
    + clone: function (e, t, n) {
    + var r,
    + i,
    + o,
    + a,
    + s,
    + u,
    + l,
    + c = e.cloneNode(!0),
    + f = oe(e)
    + if (!(y.noCloneChecked || (1 !== e.nodeType && 11 !== e.nodeType) || k.isXMLDoc(e)))
    + for (a = ve(c), r = 0, i = (o = ve(e)).length; r < i; r++)
    + (s = o[r]),
    + (u = a[r]),
    + void 0,
    + "input" === (l = u.nodeName.toLowerCase()) && pe.test(s.type) ? (u.checked = s.checked) : ("input" !== l && "textarea" !== l) || (u.defaultValue = s.defaultValue)
    + if (t)
    + if (n) for (o = o || ve(e), a = a || ve(c), r = 0, i = o.length; r < i; r++) Me(o[r], a[r])
    + else Me(e, c)
    + return 0 < (a = ve(c, "script")).length && ye(a, !f && ve(e, "script")), c
    + },
    + cleanData: function (e) {
    + for (var t, n, r, i = k.event.special, o = 0; void 0 !== (n = e[o]); o++)
    + if (G(n)) {
    + if ((t = n[Q.expando])) {
    + if (t.events) for (r in t.events) i[r] ? k.event.remove(n, r) : k.removeEvent(n, r, t.handle)
    + n[Q.expando] = void 0
    + }
    + n[J.expando] && (n[J.expando] = void 0)
    + }
    + },
    + }),
    + k.fn.extend({
    + detach: function (e) {
    + return We(this, e, !0)
    + },
    + remove: function (e) {
    + return We(this, e)
    + },
    + text: function (e) {
    + return _(
    + this,
    + function (e) {
    + return void 0 === e
    + ? k.text(this)
    + : this.empty().each(function () {
    + ;(1 !== this.nodeType && 11 !== this.nodeType && 9 !== this.nodeType) || (this.textContent = e)
    + })
    + },
    + null,
    + e,
    + arguments.length
    + )
    + },
    + append: function () {
    + return Ie(this, arguments, function (e) {
    + ;(1 !== this.nodeType && 11 !== this.nodeType && 9 !== this.nodeType) || Oe(this, e).appendChild(e)
    + })
    + },
    + prepend: function () {
    + return Ie(this, arguments, function (e) {
    + if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) {
    + var t = Oe(this, e)
    + t.insertBefore(e, t.firstChild)
    + }
    + })
    + },
    + before: function () {
    + return Ie(this, arguments, function (e) {
    + this.parentNode && this.parentNode.insertBefore(e, this)
    + })
    + },
    + after: function () {
    + return Ie(this, arguments, function (e) {
    + this.parentNode && this.parentNode.insertBefore(e, this.nextSibling)
    + })
    + },
    + empty: function () {
    + for (var e, t = 0; null != (e = this[t]); t++) 1 === e.nodeType && (k.cleanData(ve(e, !1)), (e.textContent = ""))
    + return this
    + },
    + clone: function (e, t) {
    + return (
    + (e = null != e && e),
    + (t = null == t ? e : t),
    + this.map(function () {
    + return k.clone(this, e, t)
    + })
    + )
    + },
    + html: function (e) {
    + return _(
    + this,
    + function (e) {
    + var t = this[0] || {},
    + n = 0,
    + r = this.length
    + if (void 0 === e && 1 === t.nodeType) return t.innerHTML
    + if ("string" == typeof e && !qe.test(e) && !ge[(de.exec(e) || ["", ""])[1].toLowerCase()]) {
    + e = k.htmlPrefilter(e)
    + try {
    + for (; n < r; n++) 1 === (t = this[n] || {}).nodeType && (k.cleanData(ve(t, !1)), (t.innerHTML = e))
    + t = 0
    + } catch (e) {}
    + }
    + t && this.empty().append(e)
    + },
    + null,
    + e,
    + arguments.length
    + )
    + },
    + replaceWith: function () {
    + var n = []
    + return Ie(
    + this,
    + arguments,
    + function (e) {
    + var t = this.parentNode
    + k.inArray(this, n) < 0 && (k.cleanData(ve(this)), t && t.replaceChild(e, this))
    + },
    + n
    + )
    + },
    + }),
    + k.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function (e, a) {
    + k.fn[e] = function (e) {
    + for (var t, n = [], r = k(e), i = r.length - 1, o = 0; o <= i; o++) (t = o === i ? this : this.clone(!0)), k(r[o])[a](t), u.apply(n, t.get())
    + return this.pushStack(n)
    + }
    + })
    + var $e = new RegExp("^(" + te + ")(?!px)[a-z%]+$", "i"),
    + Fe = function (e) {
    + var t = e.ownerDocument.defaultView
    + return (t && t.opener) || (t = C), t.getComputedStyle(e)
    + },
    + Be = new RegExp(re.join("|"), "i")
    + function _e(e, t, n) {
    + var r,
    + i,
    + o,
    + a,
    + s = e.style
    + return (
    + (n = n || Fe(e)) &&
    + ("" !== (a = n.getPropertyValue(t) || n[t]) || oe(e) || (a = k.style(e, t)),
    + !y.pixelBoxStyles() &&
    + $e.test(a) &&
    + Be.test(t) &&
    + ((r = s.width), (i = s.minWidth), (o = s.maxWidth), (s.minWidth = s.maxWidth = s.width = a), (a = n.width), (s.width = r), (s.minWidth = i), (s.maxWidth = o))),
    + void 0 !== a ? a + "" : a
    + )
    + }
    + function ze(e, t) {
    + return {
    + get: function () {
    + if (!e()) return (this.get = t).apply(this, arguments)
    + delete this.get
    + },
    + }
    + }
    + !(function () {
    + function e() {
    + if (u) {
    + ;(s.style.cssText = "position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0"),
    + (u.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%"),
    + ie.appendChild(s).appendChild(u)
    + var e = C.getComputedStyle(u)
    + ;(n = "1%" !== e.top),
    + (a = 12 === t(e.marginLeft)),
    + (u.style.right = "60%"),
    + (o = 36 === t(e.right)),
    + (r = 36 === t(e.width)),
    + (u.style.position = "absolute"),
    + (i = 12 === t(u.offsetWidth / 3)),
    + ie.removeChild(s),
    + (u = null)
    + }
    + }
    + function t(e) {
    + return Math.round(parseFloat(e))
    + }
    + var n,
    + r,
    + i,
    + o,
    + a,
    + s = E.createElement("div"),
    + u = E.createElement("div")
    + u.style &&
    + ((u.style.backgroundClip = "content-box"),
    + (u.cloneNode(!0).style.backgroundClip = ""),
    + (y.clearCloneStyle = "content-box" === u.style.backgroundClip),
    + k.extend(y, {
    + boxSizingReliable: function () {
    + return e(), r
    + },
    + pixelBoxStyles: function () {
    + return e(), o
    + },
    + pixelPosition: function () {
    + return e(), n
    + },
    + reliableMarginLeft: function () {
    + return e(), a
    + },
    + scrollboxSize: function () {
    + return e(), i
    + },
    + }))
    + })()
    + var Ue = ["Webkit", "Moz", "ms"],
    + Xe = E.createElement("div").style,
    + Ve = {}
    + function Ge(e) {
    + var t = k.cssProps[e] || Ve[e]
    + return (
    + t ||
    + (e in Xe
    + ? e
    + : (Ve[e] =
    + (function (e) {
    + var t = e[0].toUpperCase() + e.slice(1),
    + n = Ue.length
    + while (n--) if ((e = Ue[n] + t) in Xe) return e
    + })(e) || e))
    + )
    + }
    + var Ye = /^(none|table(?!-c[ea]).+)/,
    + Qe = /^--/,
    + Je = { position: "absolute", visibility: "hidden", display: "block" },
    + Ke = { letterSpacing: "0", fontWeight: "400" }
    + function Ze(e, t, n) {
    + var r = ne.exec(t)
    + return r ? Math.max(0, r[2] - (n || 0)) + (r[3] || "px") : t
    + }
    + function et(e, t, n, r, i, o) {
    + var a = "width" === t ? 1 : 0,
    + s = 0,
    + u = 0
    + if (n === (r ? "border" : "content")) return 0
    + for (; a < 4; a += 2)
    + "margin" === n && (u += k.css(e, n + re[a], !0, i)),
    + r
    + ? ("content" === n && (u -= k.css(e, "padding" + re[a], !0, i)), "margin" !== n && (u -= k.css(e, "border" + re[a] + "Width", !0, i)))
    + : ((u += k.css(e, "padding" + re[a], !0, i)), "padding" !== n ? (u += k.css(e, "border" + re[a] + "Width", !0, i)) : (s += k.css(e, "border" + re[a] + "Width", !0, i)))
    + return !r && 0 <= o && (u += Math.max(0, Math.ceil(e["offset" + t[0].toUpperCase() + t.slice(1)] - o - u - s - 0.5)) || 0), u
    + }
    + function tt(e, t, n) {
    + var r = Fe(e),
    + i = (!y.boxSizingReliable() || n) && "border-box" === k.css(e, "boxSizing", !1, r),
    + o = i,
    + a = _e(e, t, r),
    + s = "offset" + t[0].toUpperCase() + t.slice(1)
    + if ($e.test(a)) {
    + if (!n) return a
    + a = "auto"
    + }
    + return (
    + ((!y.boxSizingReliable() && i) || "auto" === a || (!parseFloat(a) && "inline" === k.css(e, "display", !1, r))) &&
    + e.getClientRects().length &&
    + ((i = "border-box" === k.css(e, "boxSizing", !1, r)), (o = s in e) && (a = e[s])),
    + (a = parseFloat(a) || 0) + et(e, t, n || (i ? "border" : "content"), o, r, a) + "px"
    + )
    + }
    + function nt(e, t, n, r, i) {
    + return new nt.prototype.init(e, t, n, r, i)
    + }
    + k.extend({
    + cssHooks: {
    + opacity: {
    + get: function (e, t) {
    + if (t) {
    + var n = _e(e, "opacity")
    + return "" === n ? "1" : n
    + }
    + },
    + },
    + },
    + cssNumber: {
    + animationIterationCount: !0,
    + columnCount: !0,
    + fillOpacity: !0,
    + flexGrow: !0,
    + flexShrink: !0,
    + fontWeight: !0,
    + gridArea: !0,
    + gridColumn: !0,
    + gridColumnEnd: !0,
    + gridColumnStart: !0,
    + gridRow: !0,
    + gridRowEnd: !0,
    + gridRowStart: !0,
    + lineHeight: !0,
    + opacity: !0,
    + order: !0,
    + orphans: !0,
    + widows: !0,
    + zIndex: !0,
    + zoom: !0,
    + },
    + cssProps: {},
    + style: function (e, t, n, r) {
    + if (e && 3 !== e.nodeType && 8 !== e.nodeType && e.style) {
    + var i,
    + o,
    + a,
    + s = V(t),
    + u = Qe.test(t),
    + l = e.style
    + if ((u || (t = Ge(s)), (a = k.cssHooks[t] || k.cssHooks[s]), void 0 === n)) return a && "get" in a && void 0 !== (i = a.get(e, !1, r)) ? i : l[t]
    + "string" === (o = typeof n) && (i = ne.exec(n)) && i[1] && ((n = le(e, t, i)), (o = "number")),
    + null != n &&
    + n == n &&
    + ("number" !== o || u || (n += (i && i[3]) || (k.cssNumber[s] ? "" : "px")),
    + y.clearCloneStyle || "" !== n || 0 !== t.indexOf("background") || (l[t] = "inherit"),
    + (a && "set" in a && void 0 === (n = a.set(e, n, r))) || (u ? l.setProperty(t, n) : (l[t] = n)))
    + }
    + },
    + css: function (e, t, n, r) {
    + var i,
    + o,
    + a,
    + s = V(t)
    + return (
    + Qe.test(t) || (t = Ge(s)),
    + (a = k.cssHooks[t] || k.cssHooks[s]) && "get" in a && (i = a.get(e, !0, n)),
    + void 0 === i && (i = _e(e, t, r)),
    + "normal" === i && t in Ke && (i = Ke[t]),
    + "" === n || n ? ((o = parseFloat(i)), !0 === n || isFinite(o) ? o || 0 : i) : i
    + )
    + },
    + }),
    + k.each(["height", "width"], function (e, u) {
    + k.cssHooks[u] = {
    + get: function (e, t, n) {
    + if (t)
    + return !Ye.test(k.css(e, "display")) || (e.getClientRects().length && e.getBoundingClientRect().width)
    + ? tt(e, u, n)
    + : ue(e, Je, function () {
    + return tt(e, u, n)
    + })
    + },
    + set: function (e, t, n) {
    + var r,
    + i = Fe(e),
    + o = !y.scrollboxSize() && "absolute" === i.position,
    + a = (o || n) && "border-box" === k.css(e, "boxSizing", !1, i),
    + s = n ? et(e, u, n, a, i) : 0
    + return (
    + a && o && (s -= Math.ceil(e["offset" + u[0].toUpperCase() + u.slice(1)] - parseFloat(i[u]) - et(e, u, "border", !1, i) - 0.5)),
    + s && (r = ne.exec(t)) && "px" !== (r[3] || "px") && ((e.style[u] = t), (t = k.css(e, u))),
    + Ze(0, t, s)
    + )
    + },
    + }
    + }),
    + (k.cssHooks.marginLeft = ze(y.reliableMarginLeft, function (e, t) {
    + if (t)
    + return (
    + (parseFloat(_e(e, "marginLeft")) ||
    + e.getBoundingClientRect().left -
    + ue(e, { marginLeft: 0 }, function () {
    + return e.getBoundingClientRect().left
    + })) + "px"
    + )
    + })),
    + k.each({ margin: "", padding: "", border: "Width" }, function (i, o) {
    + ;(k.cssHooks[i + o] = {
    + expand: function (e) {
    + for (var t = 0, n = {}, r = "string" == typeof e ? e.split(" ") : [e]; t < 4; t++) n[i + re[t] + o] = r[t] || r[t - 2] || r[0]
    + return n
    + },
    + }),
    + "margin" !== i && (k.cssHooks[i + o].set = Ze)
    + }),
    + k.fn.extend({
    + css: function (e, t) {
    + return _(
    + this,
    + function (e, t, n) {
    + var r,
    + i,
    + o = {},
    + a = 0
    + if (Array.isArray(t)) {
    + for (r = Fe(e), i = t.length; a < i; a++) o[t[a]] = k.css(e, t[a], !1, r)
    + return o
    + }
    + return void 0 !== n ? k.style(e, t, n) : k.css(e, t)
    + },
    + e,
    + t,
    + 1 < arguments.length
    + )
    + },
    + }),
    + (((k.Tween = nt).prototype = {
    + constructor: nt,
    + init: function (e, t, n, r, i, o) {
    + ;(this.elem = e),
    + (this.prop = n),
    + (this.easing = i || k.easing._default),
    + (this.options = t),
    + (this.start = this.now = this.cur()),
    + (this.end = r),
    + (this.unit = o || (k.cssNumber[n] ? "" : "px"))
    + },
    + cur: function () {
    + var e = nt.propHooks[this.prop]
    + return e && e.get ? e.get(this) : nt.propHooks._default.get(this)
    + },
    + run: function (e) {
    + var t,
    + n = nt.propHooks[this.prop]
    + return (
    + this.options.duration ? (this.pos = t = k.easing[this.easing](e, this.options.duration * e, 0, 1, this.options.duration)) : (this.pos = t = e),
    + (this.now = (this.end - this.start) * t + this.start),
    + this.options.step && this.options.step.call(this.elem, this.now, this),
    + n && n.set ? n.set(this) : nt.propHooks._default.set(this),
    + this
    + )
    + },
    + }).init.prototype = nt.prototype),
    + ((nt.propHooks = {
    + _default: {
    + get: function (e) {
    + var t
    + return 1 !== e.elem.nodeType || (null != e.elem[e.prop] && null == e.elem.style[e.prop]) ? e.elem[e.prop] : (t = k.css(e.elem, e.prop, "")) && "auto" !== t ? t : 0
    + },
    + set: function (e) {
    + k.fx.step[e.prop]
    + ? k.fx.step[e.prop](e)
    + : 1 !== e.elem.nodeType || (!k.cssHooks[e.prop] && null == e.elem.style[Ge(e.prop)])
    + ? (e.elem[e.prop] = e.now)
    + : k.style(e.elem, e.prop, e.now + e.unit)
    + },
    + },
    + }).scrollTop = nt.propHooks.scrollLeft =
    + {
    + set: function (e) {
    + e.elem.nodeType && e.elem.parentNode && (e.elem[e.prop] = e.now)
    + },
    + }),
    + (k.easing = {
    + linear: function (e) {
    + return e
    + },
    + swing: function (e) {
    + return 0.5 - Math.cos(e * Math.PI) / 2
    + },
    + _default: "swing",
    + }),
    + (k.fx = nt.prototype.init),
    + (k.fx.step = {})
    + var rt,
    + it,
    + ot,
    + at,
    + st = /^(?:toggle|show|hide)$/,
    + ut = /queueHooks$/
    + function lt() {
    + it && (!1 === E.hidden && C.requestAnimationFrame ? C.requestAnimationFrame(lt) : C.setTimeout(lt, k.fx.interval), k.fx.tick())
    + }
    + function ct() {
    + return (
    + C.setTimeout(function () {
    + rt = void 0
    + }),
    + (rt = Date.now())
    + )
    + }
    + function ft(e, t) {
    + var n,
    + r = 0,
    + i = { height: e }
    + for (t = t ? 1 : 0; r < 4; r += 2 - t) i["margin" + (n = re[r])] = i["padding" + n] = e
    + return t && (i.opacity = i.width = e), i
    + }
    + function pt(e, t, n) {
    + for (var r, i = (dt.tweeners[t] || []).concat(dt.tweeners["*"]), o = 0, a = i.length; o < a; o++) if ((r = i[o].call(n, t, e))) return r
    + }
    + function dt(o, e, t) {
    + var n,
    + a,
    + r = 0,
    + i = dt.prefilters.length,
    + s = k.Deferred().always(function () {
    + delete u.elem
    + }),
    + u = function () {
    + if (a) return !1
    + for (var e = rt || ct(), t = Math.max(0, l.startTime + l.duration - e), n = 1 - (t / l.duration || 0), r = 0, i = l.tweens.length; r < i; r++) l.tweens[r].run(n)
    + return s.notifyWith(o, [l, n, t]), n < 1 && i ? t : (i || s.notifyWith(o, [l, 1, 0]), s.resolveWith(o, [l]), !1)
    + },
    + l = s.promise({
    + elem: o,
    + props: k.extend({}, e),
    + opts: k.extend(!0, { specialEasing: {}, easing: k.easing._default }, t),
    + originalProperties: e,
    + originalOptions: t,
    + startTime: rt || ct(),
    + duration: t.duration,
    + tweens: [],
    + createTween: function (e, t) {
    + var n = k.Tween(o, l.opts, e, t, l.opts.specialEasing[e] || l.opts.easing)
    + return l.tweens.push(n), n
    + },
    + stop: function (e) {
    + var t = 0,
    + n = e ? l.tweens.length : 0
    + if (a) return this
    + for (a = !0; t < n; t++) l.tweens[t].run(1)
    + return e ? (s.notifyWith(o, [l, 1, 0]), s.resolveWith(o, [l, e])) : s.rejectWith(o, [l, e]), this
    + },
    + }),
    + c = l.props
    + for (
    + !(function (e, t) {
    + var n, r, i, o, a
    + for (n in e)
    + if (((i = t[(r = V(n))]), (o = e[n]), Array.isArray(o) && ((i = o[1]), (o = e[n] = o[0])), n !== r && ((e[r] = o), delete e[n]), (a = k.cssHooks[r]) && ("expand" in a)))
    + for (n in ((o = a.expand(o)), delete e[r], o)) (n in e) || ((e[n] = o[n]), (t[n] = i))
    + else t[r] = i
    + })(c, l.opts.specialEasing);
    + r < i;
    + r++
    + )
    + if ((n = dt.prefilters[r].call(l, o, c, l.opts))) return m(n.stop) && (k._queueHooks(l.elem, l.opts.queue).stop = n.stop.bind(n)), n
    + return (
    + k.map(c, pt, l),
    + m(l.opts.start) && l.opts.start.call(o, l),
    + l.progress(l.opts.progress).done(l.opts.done, l.opts.complete).fail(l.opts.fail).always(l.opts.always),
    + k.fx.timer(k.extend(u, { elem: o, anim: l, queue: l.opts.queue })),
    + l
    + )
    + }
    + ;(k.Animation = k.extend(dt, {
    + tweeners: {
    + "*": [
    + function (e, t) {
    + var n = this.createTween(e, t)
    + return le(n.elem, e, ne.exec(t), n), n
    + },
    + ],
    + },
    + tweener: function (e, t) {
    + m(e) ? ((t = e), (e = ["*"])) : (e = e.match(R))
    + for (var n, r = 0, i = e.length; r < i; r++) (n = e[r]), (dt.tweeners[n] = dt.tweeners[n] || []), dt.tweeners[n].unshift(t)
    + },
    + prefilters: [
    + function (e, t, n) {
    + var r,
    + i,
    + o,
    + a,
    + s,
    + u,
    + l,
    + c,
    + f = "width" in t || "height" in t,
    + p = this,
    + d = {},
    + h = e.style,
    + g = e.nodeType && se(e),
    + v = Q.get(e, "fxshow")
    + for (r in (n.queue ||
    + (null == (a = k._queueHooks(e, "fx")).unqueued &&
    + ((a.unqueued = 0),
    + (s = a.empty.fire),
    + (a.empty.fire = function () {
    + a.unqueued || s()
    + })),
    + a.unqueued++,
    + p.always(function () {
    + p.always(function () {
    + a.unqueued--, k.queue(e, "fx").length || a.empty.fire()
    + })
    + })),
    + t))
    + if (((i = t[r]), st.test(i))) {
    + if ((delete t[r], (o = o || "toggle" === i), i === (g ? "hide" : "show"))) {
    + if ("show" !== i || !v || void 0 === v[r]) continue
    + g = !0
    + }
    + d[r] = (v && v[r]) || k.style(e, r)
    + }
    + if ((u = !k.isEmptyObject(t)) || !k.isEmptyObject(d))
    + for (r in (f &&
    + 1 === e.nodeType &&
    + ((n.overflow = [h.overflow, h.overflowX, h.overflowY]),
    + null == (l = v && v.display) && (l = Q.get(e, "display")),
    + "none" === (c = k.css(e, "display")) && (l ? (c = l) : (fe([e], !0), (l = e.style.display || l), (c = k.css(e, "display")), fe([e]))),
    + ("inline" === c || ("inline-block" === c && null != l)) &&
    + "none" === k.css(e, "float") &&
    + (u ||
    + (p.done(function () {
    + h.display = l
    + }),
    + null == l && ((c = h.display), (l = "none" === c ? "" : c))),
    + (h.display = "inline-block"))),
    + n.overflow &&
    + ((h.overflow = "hidden"),
    + p.always(function () {
    + ;(h.overflow = n.overflow[0]), (h.overflowX = n.overflow[1]), (h.overflowY = n.overflow[2])
    + })),
    + (u = !1),
    + d))
    + u ||
    + (v ? "hidden" in v && (g = v.hidden) : (v = Q.access(e, "fxshow", { display: l })),
    + o && (v.hidden = !g),
    + g && fe([e], !0),
    + p.done(function () {
    + for (r in (g || fe([e]), Q.remove(e, "fxshow"), d)) k.style(e, r, d[r])
    + })),
    + (u = pt(g ? v[r] : 0, r, p)),
    + r in v || ((v[r] = u.start), g && ((u.end = u.start), (u.start = 0)))
    + },
    + ],
    + prefilter: function (e, t) {
    + t ? dt.prefilters.unshift(e) : dt.prefilters.push(e)
    + },
    + })),
    + (k.speed = function (e, t, n) {
    + var r = e && "object" == typeof e ? k.extend({}, e) : { complete: n || (!n && t) || (m(e) && e), duration: e, easing: (n && t) || (t && !m(t) && t) }
    + return (
    + k.fx.off ? (r.duration = 0) : "number" != typeof r.duration && (r.duration in k.fx.speeds ? (r.duration = k.fx.speeds[r.duration]) : (r.duration = k.fx.speeds._default)),
    + (null != r.queue && !0 !== r.queue) || (r.queue = "fx"),
    + (r.old = r.complete),
    + (r.complete = function () {
    + m(r.old) && r.old.call(this), r.queue && k.dequeue(this, r.queue)
    + }),
    + r
    + )
    + }),
    + k.fn.extend({
    + fadeTo: function (e, t, n, r) {
    + return this.filter(se).css("opacity", 0).show().end().animate({ opacity: t }, e, n, r)
    + },
    + animate: function (t, e, n, r) {
    + var i = k.isEmptyObject(t),
    + o = k.speed(e, n, r),
    + a = function () {
    + var e = dt(this, k.extend({}, t), o)
    + ;(i || Q.get(this, "finish")) && e.stop(!0)
    + }
    + return (a.finish = a), i || !1 === o.queue ? this.each(a) : this.queue(o.queue, a)
    + },
    + stop: function (i, e, o) {
    + var a = function (e) {
    + var t = e.stop
    + delete e.stop, t(o)
    + }
    + return (
    + "string" != typeof i && ((o = e), (e = i), (i = void 0)),
    + e && !1 !== i && this.queue(i || "fx", []),
    + this.each(function () {
    + var e = !0,
    + t = null != i && i + "queueHooks",
    + n = k.timers,
    + r = Q.get(this)
    + if (t) r[t] && r[t].stop && a(r[t])
    + else for (t in r) r[t] && r[t].stop && ut.test(t) && a(r[t])
    + for (t = n.length; t--; ) n[t].elem !== this || (null != i && n[t].queue !== i) || (n[t].anim.stop(o), (e = !1), n.splice(t, 1))
    + ;(!e && o) || k.dequeue(this, i)
    + })
    + )
    + },
    + finish: function (a) {
    + return (
    + !1 !== a && (a = a || "fx"),
    + this.each(function () {
    + var e,
    + t = Q.get(this),
    + n = t[a + "queue"],
    + r = t[a + "queueHooks"],
    + i = k.timers,
    + o = n ? n.length : 0
    + for (t.finish = !0, k.queue(this, a, []), r && r.stop && r.stop.call(this, !0), e = i.length; e--; )
    + i[e].elem === this && i[e].queue === a && (i[e].anim.stop(!0), i.splice(e, 1))
    + for (e = 0; e < o; e++) n[e] && n[e].finish && n[e].finish.call(this)
    + delete t.finish
    + })
    + )
    + },
    + }),
    + k.each(["toggle", "show", "hide"], function (e, r) {
    + var i = k.fn[r]
    + k.fn[r] = function (e, t, n) {
    + return null == e || "boolean" == typeof e ? i.apply(this, arguments) : this.animate(ft(r, !0), e, t, n)
    + }
    + }),
    + k.each(
    + { slideDown: ft("show"), slideUp: ft("hide"), slideToggle: ft("toggle"), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle" } },
    + function (e, r) {
    + k.fn[e] = function (e, t, n) {
    + return this.animate(r, e, t, n)
    + }
    + }
    + ),
    + (k.timers = []),
    + (k.fx.tick = function () {
    + var e,
    + t = 0,
    + n = k.timers
    + for (rt = Date.now(); t < n.length; t++) (e = n[t])() || n[t] !== e || n.splice(t--, 1)
    + n.length || k.fx.stop(), (rt = void 0)
    + }),
    + (k.fx.timer = function (e) {
    + k.timers.push(e), k.fx.start()
    + }),
    + (k.fx.interval = 13),
    + (k.fx.start = function () {
    + it || ((it = !0), lt())
    + }),
    + (k.fx.stop = function () {
    + it = null
    + }),
    + (k.fx.speeds = { slow: 600, fast: 200, _default: 400 }),
    + (k.fn.delay = function (r, e) {
    + return (
    + (r = (k.fx && k.fx.speeds[r]) || r),
    + (e = e || "fx"),
    + this.queue(e, function (e, t) {
    + var n = C.setTimeout(e, r)
    + t.stop = function () {
    + C.clearTimeout(n)
    + }
    + })
    + )
    + }),
    + (ot = E.createElement("input")),
    + (at = E.createElement("select").appendChild(E.createElement("option"))),
    + (ot.type = "checkbox"),
    + (y.checkOn = "" !== ot.value),
    + (y.optSelected = at.selected),
    + ((ot = E.createElement("input")).value = "t"),
    + (ot.type = "radio"),
    + (y.radioValue = "t" === ot.value)
    + var ht,
    + gt = k.expr.attrHandle
    + k.fn.extend({
    + attr: function (e, t) {
    + return _(this, k.attr, e, t, 1 < arguments.length)
    + },
    + removeAttr: function (e) {
    + return this.each(function () {
    + k.removeAttr(this, e)
    + })
    + },
    + }),
    + k.extend({
    + attr: function (e, t, n) {
    + var r,
    + i,
    + o = e.nodeType
    + if (3 !== o && 8 !== o && 2 !== o)
    + return "undefined" == typeof e.getAttribute
    + ? k.prop(e, t, n)
    + : ((1 === o && k.isXMLDoc(e)) || (i = k.attrHooks[t.toLowerCase()] || (k.expr.match.bool.test(t) ? ht : void 0)),
    + void 0 !== n
    + ? null === n
    + ? void k.removeAttr(e, t)
    + : i && "set" in i && void 0 !== (r = i.set(e, n, t))
    + ? r
    + : (e.setAttribute(t, n + ""), n)
    + : i && "get" in i && null !== (r = i.get(e, t))
    + ? r
    + : null == (r = k.find.attr(e, t))
    + ? void 0
    + : r)
    + },
    + attrHooks: {
    + type: {
    + set: function (e, t) {
    + if (!y.radioValue && "radio" === t && A(e, "input")) {
    + var n = e.value
    + return e.setAttribute("type", t), n && (e.value = n), t
    + }
    + },
    + },
    + },
    + removeAttr: function (e, t) {
    + var n,
    + r = 0,
    + i = t && t.match(R)
    + if (i && 1 === e.nodeType) while ((n = i[r++])) e.removeAttribute(n)
    + },
    + }),
    + (ht = {
    + set: function (e, t, n) {
    + return !1 === t ? k.removeAttr(e, n) : e.setAttribute(n, n), n
    + },
    + }),
    + k.each(k.expr.match.bool.source.match(/\w+/g), function (e, t) {
    + var a = gt[t] || k.find.attr
    + gt[t] = function (e, t, n) {
    + var r,
    + i,
    + o = t.toLowerCase()
    + return n || ((i = gt[o]), (gt[o] = r), (r = null != a(e, t, n) ? o : null), (gt[o] = i)), r
    + }
    + })
    + var vt = /^(?:input|select|textarea|button)$/i,
    + yt = /^(?:a|area)$/i
    + function mt(e) {
    + return (e.match(R) || []).join(" ")
    + }
    + function xt(e) {
    + return (e.getAttribute && e.getAttribute("class")) || ""
    + }
    + function bt(e) {
    + return Array.isArray(e) ? e : ("string" == typeof e && e.match(R)) || []
    + }
    + k.fn.extend({
    + prop: function (e, t) {
    + return _(this, k.prop, e, t, 1 < arguments.length)
    + },
    + removeProp: function (e) {
    + return this.each(function () {
    + delete this[k.propFix[e] || e]
    + })
    + },
    + }),
    + k.extend({
    + prop: function (e, t, n) {
    + var r,
    + i,
    + o = e.nodeType
    + if (3 !== o && 8 !== o && 2 !== o)
    + return (
    + (1 === o && k.isXMLDoc(e)) || ((t = k.propFix[t] || t), (i = k.propHooks[t])),
    + void 0 !== n ? (i && "set" in i && void 0 !== (r = i.set(e, n, t)) ? r : (e[t] = n)) : i && "get" in i && null !== (r = i.get(e, t)) ? r : e[t]
    + )
    + },
    + propHooks: {
    + tabIndex: {
    + get: function (e) {
    + var t = k.find.attr(e, "tabindex")
    + return t ? parseInt(t, 10) : vt.test(e.nodeName) || (yt.test(e.nodeName) && e.href) ? 0 : -1
    + },
    + },
    + },
    + propFix: { for: "htmlFor", class: "className" },
    + }),
    + y.optSelected ||
    + (k.propHooks.selected = {
    + get: function (e) {
    + var t = e.parentNode
    + return t && t.parentNode && t.parentNode.selectedIndex, null
    + },
    + set: function (e) {
    + var t = e.parentNode
    + t && (t.selectedIndex, t.parentNode && t.parentNode.selectedIndex)
    + },
    + }),
    + k.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () {
    + k.propFix[this.toLowerCase()] = this
    + }),
    + k.fn.extend({
    + addClass: function (t) {
    + var e,
    + n,
    + r,
    + i,
    + o,
    + a,
    + s,
    + u = 0
    + if (m(t))
    + return this.each(function (e) {
    + k(this).addClass(t.call(this, e, xt(this)))
    + })
    + if ((e = bt(t)).length)
    + while ((n = this[u++]))
    + if (((i = xt(n)), (r = 1 === n.nodeType && " " + mt(i) + " "))) {
    + a = 0
    + while ((o = e[a++])) r.indexOf(" " + o + " ") < 0 && (r += o + " ")
    + i !== (s = mt(r)) && n.setAttribute("class", s)
    + }
    + return this
    + },
    + removeClass: function (t) {
    + var e,
    + n,
    + r,
    + i,
    + o,
    + a,
    + s,
    + u = 0
    + if (m(t))
    + return this.each(function (e) {
    + k(this).removeClass(t.call(this, e, xt(this)))
    + })
    + if (!arguments.length) return this.attr("class", "")
    + if ((e = bt(t)).length)
    + while ((n = this[u++]))
    + if (((i = xt(n)), (r = 1 === n.nodeType && " " + mt(i) + " "))) {
    + a = 0
    + while ((o = e[a++])) while (-1 < r.indexOf(" " + o + " ")) r = r.replace(" " + o + " ", " ")
    + i !== (s = mt(r)) && n.setAttribute("class", s)
    + }
    + return this
    + },
    + toggleClass: function (i, t) {
    + var o = typeof i,
    + a = "string" === o || Array.isArray(i)
    + return "boolean" == typeof t && a
    + ? t
    + ? this.addClass(i)
    + : this.removeClass(i)
    + : m(i)
    + ? this.each(function (e) {
    + k(this).toggleClass(i.call(this, e, xt(this), t), t)
    + })
    + : this.each(function () {
    + var e, t, n, r
    + if (a) {
    + ;(t = 0), (n = k(this)), (r = bt(i))
    + while ((e = r[t++])) n.hasClass(e) ? n.removeClass(e) : n.addClass(e)
    + } else (void 0 !== i && "boolean" !== o) || ((e = xt(this)) && Q.set(this, "__className__", e), this.setAttribute && this.setAttribute("class", e || !1 === i ? "" : Q.get(this, "__className__") || ""))
    + })
    + },
    + hasClass: function (e) {
    + var t,
    + n,
    + r = 0
    + t = " " + e + " "
    + while ((n = this[r++])) if (1 === n.nodeType && -1 < (" " + mt(xt(n)) + " ").indexOf(t)) return !0
    + return !1
    + },
    + })
    + var wt = /\r/g
    + k.fn.extend({
    + val: function (n) {
    + var r,
    + e,
    + i,
    + t = this[0]
    + return arguments.length
    + ? ((i = m(n)),
    + this.each(function (e) {
    + var t
    + 1 === this.nodeType &&
    + (null == (t = i ? n.call(this, e, k(this).val()) : n)
    + ? (t = "")
    + : "number" == typeof t
    + ? (t += "")
    + : Array.isArray(t) &&
    + (t = k.map(t, function (e) {
    + return null == e ? "" : e + ""
    + })),
    + ((r = k.valHooks[this.type] || k.valHooks[this.nodeName.toLowerCase()]) && "set" in r && void 0 !== r.set(this, t, "value")) || (this.value = t))
    + }))
    + : t
    + ? (r = k.valHooks[t.type] || k.valHooks[t.nodeName.toLowerCase()]) && "get" in r && void 0 !== (e = r.get(t, "value"))
    + ? e
    + : "string" == typeof (e = t.value)
    + ? e.replace(wt, "")
    + : null == e
    + ? ""
    + : e
    + : void 0
    + },
    + }),
    + k.extend({
    + valHooks: {
    + option: {
    + get: function (e) {
    + var t = k.find.attr(e, "value")
    + return null != t ? t : mt(k.text(e))
    + },
    + },
    + select: {
    + get: function (e) {
    + var t,
    + n,
    + r,
    + i = e.options,
    + o = e.selectedIndex,
    + a = "select-one" === e.type,
    + s = a ? null : [],
    + u = a ? o + 1 : i.length
    + for (r = o < 0 ? u : a ? o : 0; r < u; r++)
    + if (((n = i[r]).selected || r === o) && !n.disabled && (!n.parentNode.disabled || !A(n.parentNode, "optgroup"))) {
    + if (((t = k(n).val()), a)) return t
    + s.push(t)
    + }
    + return s
    + },
    + set: function (e, t) {
    + var n,
    + r,
    + i = e.options,
    + o = k.makeArray(t),
    + a = i.length
    + while (a--) ((r = i[a]).selected = -1 < k.inArray(k.valHooks.option.get(r), o)) && (n = !0)
    + return n || (e.selectedIndex = -1), o
    + },
    + },
    + },
    + }),
    + k.each(["radio", "checkbox"], function () {
    + ;(k.valHooks[this] = {
    + set: function (e, t) {
    + if (Array.isArray(t)) return (e.checked = -1 < k.inArray(k(e).val(), t))
    + },
    + }),
    + y.checkOn ||
    + (k.valHooks[this].get = function (e) {
    + return null === e.getAttribute("value") ? "on" : e.value
    + })
    + }),
    + (y.focusin = "onfocusin" in C)
    + var Tt = /^(?:focusinfocus|focusoutblur)$/,
    + Ct = function (e) {
    + e.stopPropagation()
    + }
    + k.extend(k.event, {
    + trigger: function (e, t, n, r) {
    + var i,
    + o,
    + a,
    + s,
    + u,
    + l,
    + c,
    + f,
    + p = [n || E],
    + d = v.call(e, "type") ? e.type : e,
    + h = v.call(e, "namespace") ? e.namespace.split(".") : []
    + if (
    + ((o = f = a = n = n || E),
    + 3 !== n.nodeType &&
    + 8 !== n.nodeType &&
    + !Tt.test(d + k.event.triggered) &&
    + (-1 < d.indexOf(".") && ((d = (h = d.split(".")).shift()), h.sort()),
    + (u = d.indexOf(":") < 0 && "on" + d),
    + ((e = e[k.expando] ? e : new k.Event(d, "object" == typeof e && e)).isTrigger = r ? 2 : 3),
    + (e.namespace = h.join(".")),
    + (e.rnamespace = e.namespace ? new RegExp("(^|\\.)" + h.join("\\.(?:.*\\.|)") + "(\\.|$)") : null),
    + (e.result = void 0),
    + e.target || (e.target = n),
    + (t = null == t ? [e] : k.makeArray(t, [e])),
    + (c = k.event.special[d] || {}),
    + r || !c.trigger || !1 !== c.trigger.apply(n, t)))
    + ) {
    + if (!r && !c.noBubble && !x(n)) {
    + for (s = c.delegateType || d, Tt.test(s + d) || (o = o.parentNode); o; o = o.parentNode) p.push(o), (a = o)
    + a === (n.ownerDocument || E) && p.push(a.defaultView || a.parentWindow || C)
    + }
    + i = 0
    + while ((o = p[i++]) && !e.isPropagationStopped())
    + (f = o),
    + (e.type = 1 < i ? s : c.bindType || d),
    + (l = (Q.get(o, "events") || {})[e.type] && Q.get(o, "handle")) && l.apply(o, t),
    + (l = u && o[u]) && l.apply && G(o) && ((e.result = l.apply(o, t)), !1 === e.result && e.preventDefault())
    + return (
    + (e.type = d),
    + r ||
    + e.isDefaultPrevented() ||
    + (c._default && !1 !== c._default.apply(p.pop(), t)) ||
    + !G(n) ||
    + (u &&
    + m(n[d]) &&
    + !x(n) &&
    + ((a = n[u]) && (n[u] = null),
    + (k.event.triggered = d),
    + e.isPropagationStopped() && f.addEventListener(d, Ct),
    + n[d](),
    + e.isPropagationStopped() && f.removeEventListener(d, Ct),
    + (k.event.triggered = void 0),
    + a && (n[u] = a))),
    + e.result
    + )
    + }
    + },
    + simulate: function (e, t, n) {
    + var r = k.extend(new k.Event(), n, { type: e, isSimulated: !0 })
    + k.event.trigger(r, null, t)
    + },
    + }),
    + k.fn.extend({
    + trigger: function (e, t) {
    + return this.each(function () {
    + k.event.trigger(e, t, this)
    + })
    + },
    + triggerHandler: function (e, t) {
    + var n = this[0]
    + if (n) return k.event.trigger(e, t, n, !0)
    + },
    + }),
    + y.focusin ||
    + k.each({ focus: "focusin", blur: "focusout" }, function (n, r) {
    + var i = function (e) {
    + k.event.simulate(r, e.target, k.event.fix(e))
    + }
    + k.event.special[r] = {
    + setup: function () {
    + var e = this.ownerDocument || this,
    + t = Q.access(e, r)
    + t || e.addEventListener(n, i, !0), Q.access(e, r, (t || 0) + 1)
    + },
    + teardown: function () {
    + var e = this.ownerDocument || this,
    + t = Q.access(e, r) - 1
    + t ? Q.access(e, r, t) : (e.removeEventListener(n, i, !0), Q.remove(e, r))
    + },
    + }
    + })
    + var Et = C.location,
    + kt = Date.now(),
    + St = /\?/
    + k.parseXML = function (e) {
    + var t
    + if (!e || "string" != typeof e) return null
    + try {
    + t = new C.DOMParser().parseFromString(e, "text/xml")
    + } catch (e) {
    + t = void 0
    + }
    + return (t && !t.getElementsByTagName("parsererror").length) || k.error("Invalid XML: " + e), t
    + }
    + var Nt = /\[\]$/,
    + At = /\r?\n/g,
    + Dt = /^(?:submit|button|image|reset|file)$/i,
    + jt = /^(?:input|select|textarea|keygen)/i
    + function qt(n, e, r, i) {
    + var t
    + if (Array.isArray(e))
    + k.each(e, function (e, t) {
    + r || Nt.test(n) ? i(n, t) : qt(n + "[" + ("object" == typeof t && null != t ? e : "") + "]", t, r, i)
    + })
    + else if (r || "object" !== w(e)) i(n, e)
    + else for (t in e) qt(n + "[" + t + "]", e[t], r, i)
    + }
    + ;(k.param = function (e, t) {
    + var n,
    + r = [],
    + i = function (e, t) {
    + var n = m(t) ? t() : t
    + r[r.length] = encodeURIComponent(e) + "=" + encodeURIComponent(null == n ? "" : n)
    + }
    + if (null == e) return ""
    + if (Array.isArray(e) || (e.jquery && !k.isPlainObject(e)))
    + k.each(e, function () {
    + i(this.name, this.value)
    + })
    + else for (n in e) qt(n, e[n], t, i)
    + return r.join("&")
    + }),
    + k.fn.extend({
    + serialize: function () {
    + return k.param(this.serializeArray())
    + },
    + serializeArray: function () {
    + return this.map(function () {
    + var e = k.prop(this, "elements")
    + return e ? k.makeArray(e) : this
    + })
    + .filter(function () {
    + var e = this.type
    + return this.name && !k(this).is(":disabled") && jt.test(this.nodeName) && !Dt.test(e) && (this.checked || !pe.test(e))
    + })
    + .map(function (e, t) {
    + var n = k(this).val()
    + return null == n
    + ? null
    + : Array.isArray(n)
    + ? k.map(n, function (e) {
    + return { name: t.name, value: e.replace(At, "\r\n") }
    + })
    + : { name: t.name, value: n.replace(At, "\r\n") }
    + })
    + .get()
    + },
    + })
    + var Lt = /%20/g,
    + Ht = /#.*$/,
    + Ot = /([?&])_=[^&]*/,
    + Pt = /^(.*?):[ \t]*([^\r\n]*)$/gm,
    + Rt = /^(?:GET|HEAD)$/,
    + Mt = /^\/\//,
    + It = {},
    + Wt = {},
    + $t = "*/".concat("*"),
    + Ft = E.createElement("a")
    + function Bt(o) {
    + return function (e, t) {
    + "string" != typeof e && ((t = e), (e = "*"))
    + var n,
    + r = 0,
    + i = e.toLowerCase().match(R) || []
    + if (m(t)) while ((n = i[r++])) "+" === n[0] ? ((n = n.slice(1) || "*"), (o[n] = o[n] || []).unshift(t)) : (o[n] = o[n] || []).push(t)
    + }
    + }
    + function _t(t, i, o, a) {
    + var s = {},
    + u = t === Wt
    + function l(e) {
    + var r
    + return (
    + (s[e] = !0),
    + k.each(t[e] || [], function (e, t) {
    + var n = t(i, o, a)
    + return "string" != typeof n || u || s[n] ? (u ? !(r = n) : void 0) : (i.dataTypes.unshift(n), l(n), !1)
    + }),
    + r
    + )
    + }
    + return l(i.dataTypes[0]) || (!s["*"] && l("*"))
    + }
    + function zt(e, t) {
    + var n,
    + r,
    + i = k.ajaxSettings.flatOptions || {}
    + for (n in t) void 0 !== t[n] && ((i[n] ? e : r || (r = {}))[n] = t[n])
    + return r && k.extend(!0, e, r), e
    + }
    + ;(Ft.href = Et.href),
    + k.extend({
    + active: 0,
    + lastModified: {},
    + etag: {},
    + ajaxSettings: {
    + url: Et.href,
    + type: "GET",
    + isLocal: /^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Et.protocol),
    + global: !0,
    + processData: !0,
    + async: !0,
    + contentType: "application/x-www-form-urlencoded; charset=UTF-8",
    + accepts: { "*": $t, text: "text/plain", html: "text/html", xml: "application/xml, text/xml", json: "application/json, text/javascript" },
    + contents: { xml: /\bxml\b/, html: /\bhtml/, json: /\bjson\b/ },
    + responseFields: { xml: "responseXML", text: "responseText", json: "responseJSON" },
    + converters: { "* text": String, "text html": !0, "text json": JSON.parse, "text xml": k.parseXML },
    + flatOptions: { url: !0, context: !0 },
    + },
    + ajaxSetup: function (e, t) {
    + return t ? zt(zt(e, k.ajaxSettings), t) : zt(k.ajaxSettings, e)
    + },
    + ajaxPrefilter: Bt(It),
    + ajaxTransport: Bt(Wt),
    + ajax: function (e, t) {
    + "object" == typeof e && ((t = e), (e = void 0)), (t = t || {})
    + var c,
    + f,
    + p,
    + n,
    + d,
    + r,
    + h,
    + g,
    + i,
    + o,
    + v = k.ajaxSetup({}, t),
    + y = v.context || v,
    + m = v.context && (y.nodeType || y.jquery) ? k(y) : k.event,
    + x = k.Deferred(),
    + b = k.Callbacks("once memory"),
    + w = v.statusCode || {},
    + a = {},
    + s = {},
    + u = "canceled",
    + T = {
    + readyState: 0,
    + getResponseHeader: function (e) {
    + var t
    + if (h) {
    + if (!n) {
    + n = {}
    + while ((t = Pt.exec(p))) n[t[1].toLowerCase() + " "] = (n[t[1].toLowerCase() + " "] || []).concat(t[2])
    + }
    + t = n[e.toLowerCase() + " "]
    + }
    + return null == t ? null : t.join(", ")
    + },
    + getAllResponseHeaders: function () {
    + return h ? p : null
    + },
    + setRequestHeader: function (e, t) {
    + return null == h && ((e = s[e.toLowerCase()] = s[e.toLowerCase()] || e), (a[e] = t)), this
    + },
    + overrideMimeType: function (e) {
    + return null == h && (v.mimeType = e), this
    + },
    + statusCode: function (e) {
    + var t
    + if (e)
    + if (h) T.always(e[T.status])
    + else for (t in e) w[t] = [w[t], e[t]]
    + return this
    + },
    + abort: function (e) {
    + var t = e || u
    + return c && c.abort(t), l(0, t), this
    + },
    + }
    + if (
    + (x.promise(T),
    + (v.url = ((e || v.url || Et.href) + "").replace(Mt, Et.protocol + "//")),
    + (v.type = t.method || t.type || v.method || v.type),
    + (v.dataTypes = (v.dataType || "*").toLowerCase().match(R) || [""]),
    + null == v.crossDomain)
    + ) {
    + r = E.createElement("a")
    + try {
    + ;(r.href = v.url), (r.href = r.href), (v.crossDomain = Ft.protocol + "//" + Ft.host != r.protocol + "//" + r.host)
    + } catch (e) {
    + v.crossDomain = !0
    + }
    + }
    + if ((v.data && v.processData && "string" != typeof v.data && (v.data = k.param(v.data, v.traditional)), _t(It, v, t, T), h)) return T
    + for (i in ((g = k.event && v.global) && 0 == k.active++ && k.event.trigger("ajaxStart"),
    + (v.type = v.type.toUpperCase()),
    + (v.hasContent = !Rt.test(v.type)),
    + (f = v.url.replace(Ht, "")),
    + v.hasContent
    + ? v.data && v.processData && 0 === (v.contentType || "").indexOf("application/x-www-form-urlencoded") && (v.data = v.data.replace(Lt, "+"))
    + : ((o = v.url.slice(f.length)),
    + v.data && (v.processData || "string" == typeof v.data) && ((f += (St.test(f) ? "&" : "?") + v.data), delete v.data),
    + !1 === v.cache && ((f = f.replace(Ot, "$1")), (o = (St.test(f) ? "&" : "?") + "_=" + kt++ + o)),
    + (v.url = f + o)),
    + v.ifModified && (k.lastModified[f] && T.setRequestHeader("If-Modified-Since", k.lastModified[f]), k.etag[f] && T.setRequestHeader("If-None-Match", k.etag[f])),
    + ((v.data && v.hasContent && !1 !== v.contentType) || t.contentType) && T.setRequestHeader("Content-Type", v.contentType),
    + T.setRequestHeader(
    + "Accept",
    + v.dataTypes[0] && v.accepts[v.dataTypes[0]] ? v.accepts[v.dataTypes[0]] + ("*" !== v.dataTypes[0] ? ", " + $t + "; q=0.01" : "") : v.accepts["*"]
    + ),
    + v.headers))
    + T.setRequestHeader(i, v.headers[i])
    + if (v.beforeSend && (!1 === v.beforeSend.call(y, T, v) || h)) return T.abort()
    + if (((u = "abort"), b.add(v.complete), T.done(v.success), T.fail(v.error), (c = _t(Wt, v, t, T)))) {
    + if (((T.readyState = 1), g && m.trigger("ajaxSend", [T, v]), h)) return T
    + v.async &&
    + 0 < v.timeout &&
    + (d = C.setTimeout(function () {
    + T.abort("timeout")
    + }, v.timeout))
    + try {
    + ;(h = !1), c.send(a, l)
    + } catch (e) {
    + if (h) throw e
    + l(-1, e)
    + }
    + } else l(-1, "No Transport")
    + function l(e, t, n, r) {
    + var i,
    + o,
    + a,
    + s,
    + u,
    + l = t
    + h ||
    + ((h = !0),
    + d && C.clearTimeout(d),
    + (c = void 0),
    + (p = r || ""),
    + (T.readyState = 0 < e ? 4 : 0),
    + (i = (200 <= e && e < 300) || 304 === e),
    + n &&
    + (s = (function (e, t, n) {
    + var r,
    + i,
    + o,
    + a,
    + s = e.contents,
    + u = e.dataTypes
    + while ("*" === u[0]) u.shift(), void 0 === r && (r = e.mimeType || t.getResponseHeader("Content-Type"))
    + if (r)
    + for (i in s)
    + if (s[i] && s[i].test(r)) {
    + u.unshift(i)
    + break
    + }
    + if (u[0] in n) o = u[0]
    + else {
    + for (i in n) {
    + if (!u[0] || e.converters[i + " " + u[0]]) {
    + o = i
    + break
    + }
    + a || (a = i)
    + }
    + o = o || a
    + }
    + if (o) return o !== u[0] && u.unshift(o), n[o]
    + })(v, T, n)),
    + (s = (function (e, t, n, r) {
    + var i,
    + o,
    + a,
    + s,
    + u,
    + l = {},
    + c = e.dataTypes.slice()
    + if (c[1]) for (a in e.converters) l[a.toLowerCase()] = e.converters[a]
    + o = c.shift()
    + while (o)
    + if ((e.responseFields[o] && (n[e.responseFields[o]] = t), !u && r && e.dataFilter && (t = e.dataFilter(t, e.dataType)), (u = o), (o = c.shift())))
    + if ("*" === o) o = u
    + else if ("*" !== u && u !== o) {
    + if (!(a = l[u + " " + o] || l["* " + o]))
    + for (i in l)
    + if ((s = i.split(" "))[1] === o && (a = l[u + " " + s[0]] || l["* " + s[0]])) {
    + !0 === a ? (a = l[i]) : !0 !== l[i] && ((o = s[0]), c.unshift(s[1]))
    + break
    + }
    + if (!0 !== a)
    + if (a && e["throws"]) t = a(t)
    + else
    + try {
    + t = a(t)
    + } catch (e) {
    + return { state: "parsererror", error: a ? e : "No conversion from " + u + " to " + o }
    + }
    + }
    + return { state: "success", data: t }
    + })(v, s, T, i)),
    + i
    + ? (v.ifModified && ((u = T.getResponseHeader("Last-Modified")) && (k.lastModified[f] = u), (u = T.getResponseHeader("etag")) && (k.etag[f] = u)),
    + 204 === e || "HEAD" === v.type ? (l = "nocontent") : 304 === e ? (l = "notmodified") : ((l = s.state), (o = s.data), (i = !(a = s.error))))
    + : ((a = l), (!e && l) || ((l = "error"), e < 0 && (e = 0))),
    + (T.status = e),
    + (T.statusText = (t || l) + ""),
    + i ? x.resolveWith(y, [o, l, T]) : x.rejectWith(y, [T, l, a]),
    + T.statusCode(w),
    + (w = void 0),
    + g && m.trigger(i ? "ajaxSuccess" : "ajaxError", [T, v, i ? o : a]),
    + b.fireWith(y, [T, l]),
    + g && (m.trigger("ajaxComplete", [T, v]), --k.active || k.event.trigger("ajaxStop")))
    + }
    + return T
    + },
    + getJSON: function (e, t, n) {
    + return k.get(e, t, n, "json")
    + },
    + getScript: function (e, t) {
    + return k.get(e, void 0, t, "script")
    + },
    + }),
    + k.each(["get", "post"], function (e, i) {
    + k[i] = function (e, t, n, r) {
    + return m(t) && ((r = r || n), (n = t), (t = void 0)), k.ajax(k.extend({ url: e, type: i, dataType: r, data: t, success: n }, k.isPlainObject(e) && e))
    + }
    + }),
    + (k._evalUrl = function (e, t) {
    + return k.ajax({
    + url: e,
    + type: "GET",
    + dataType: "script",
    + cache: !0,
    + async: !1,
    + global: !1,
    + converters: { "text script": function () {} },
    + dataFilter: function (e) {
    + k.globalEval(e, t)
    + },
    + })
    + }),
    + k.fn.extend({
    + wrapAll: function (e) {
    + var t
    + return (
    + this[0] &&
    + (m(e) && (e = e.call(this[0])),
    + (t = k(e, this[0].ownerDocument).eq(0).clone(!0)),
    + this[0].parentNode && t.insertBefore(this[0]),
    + t
    + .map(function () {
    + var e = this
    + while (e.firstElementChild) e = e.firstElementChild
    + return e
    + })
    + .append(this)),
    + this
    + )
    + },
    + wrapInner: function (n) {
    + return m(n)
    + ? this.each(function (e) {
    + k(this).wrapInner(n.call(this, e))
    + })
    + : this.each(function () {
    + var e = k(this),
    + t = e.contents()
    + t.length ? t.wrapAll(n) : e.append(n)
    + })
    + },
    + wrap: function (t) {
    + var n = m(t)
    + return this.each(function (e) {
    + k(this).wrapAll(n ? t.call(this, e) : t)
    + })
    + },
    + unwrap: function (e) {
    + return (
    + this.parent(e)
    + .not("body")
    + .each(function () {
    + k(this).replaceWith(this.childNodes)
    + }),
    + this
    + )
    + },
    + }),
    + (k.expr.pseudos.hidden = function (e) {
    + return !k.expr.pseudos.visible(e)
    + }),
    + (k.expr.pseudos.visible = function (e) {
    + return !!(e.offsetWidth || e.offsetHeight || e.getClientRects().length)
    + }),
    + (k.ajaxSettings.xhr = function () {
    + try {
    + return new C.XMLHttpRequest()
    + } catch (e) {}
    + })
    + var Ut = { 0: 200, 1223: 204 },
    + Xt = k.ajaxSettings.xhr()
    + ;(y.cors = !!Xt && "withCredentials" in Xt),
    + (y.ajax = Xt = !!Xt),
    + k.ajaxTransport(function (i) {
    + var o, a
    + if (y.cors || (Xt && !i.crossDomain))
    + return {
    + send: function (e, t) {
    + var n,
    + r = i.xhr()
    + if ((r.open(i.type, i.url, i.async, i.username, i.password), i.xhrFields)) for (n in i.xhrFields) r[n] = i.xhrFields[n]
    + for (n in (i.mimeType && r.overrideMimeType && r.overrideMimeType(i.mimeType), i.crossDomain || e["X-Requested-With"] || (e["X-Requested-With"] = "XMLHttpRequest"), e))
    + r.setRequestHeader(n, e[n])
    + ;(o = function (e) {
    + return function () {
    + o &&
    + ((o = a = r.onload = r.onerror = r.onabort = r.ontimeout = r.onreadystatechange = null),
    + "abort" === e
    + ? r.abort()
    + : "error" === e
    + ? "number" != typeof r.status
    + ? t(0, "error")
    + : t(r.status, r.statusText)
    + : t(
    + Ut[r.status] || r.status,
    + r.statusText,
    + "text" !== (r.responseType || "text") || "string" != typeof r.responseText ? { binary: r.response } : { text: r.responseText },
    + r.getAllResponseHeaders()
    + ))
    + }
    + }),
    + (r.onload = o()),
    + (a = r.onerror = r.ontimeout = o("error")),
    + void 0 !== r.onabort
    + ? (r.onabort = a)
    + : (r.onreadystatechange = function () {
    + 4 === r.readyState &&
    + C.setTimeout(function () {
    + o && a()
    + })
    + }),
    + (o = o("abort"))
    + try {
    + r.send((i.hasContent && i.data) || null)
    + } catch (e) {
    + if (o) throw e
    + }
    + },
    + abort: function () {
    + o && o()
    + },
    + }
    + }),
    + k.ajaxPrefilter(function (e) {
    + e.crossDomain && (e.contents.script = !1)
    + }),
    + k.ajaxSetup({
    + accepts: { script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" },
    + contents: { script: /\b(?:java|ecma)script\b/ },
    + converters: {
    + "text script": function (e) {
    + return k.globalEval(e), e
    + },
    + },
    + }),
    + k.ajaxPrefilter("script", function (e) {
    + void 0 === e.cache && (e.cache = !1), e.crossDomain && (e.type = "GET")
    + }),
    + k.ajaxTransport("script", function (n) {
    + var r, i
    + if (n.crossDomain || n.scriptAttrs)
    + return {
    + send: function (e, t) {
    + ;(r = k("
    +
    + `
    + const samplePath = "sample." + this.getExtensionName()
    + files[samplePath] = sampleCode.toString()
    + files[GrammarBundleFiles.testJs] = `const ${languageName} = require("./index.js")
    + /*keep-line*/ const sampleCode = require("fs").readFileSync("${samplePath}", "utf8")
    + ${testCode}`
    + return files
    + }
    + getTargetExtension() {
    + return this.getRootNodeTypeDefinitionNode().get(GrammarConstants.compilesTo)
    + }
    + getCellTypeDefinitions() {
    + if (!this._cache_cellTypes) this._cache_cellTypes = this._getCellTypeDefinitions()
    + return this._cache_cellTypes
    + }
    + getCellTypeDefinitionById(cellTypeId) {
    + // todo: return unknownCellTypeDefinition? or is that handled somewhere else?
    + return this.getCellTypeDefinitions()[cellTypeId]
    + }
    + getNodeTypeFamilyTree() {
    + const tree = new TreeNode()
    + Object.values(this.getValidConcreteAndAbstractNodeTypeDefinitions()).forEach((node) => {
    + const path = node.getAncestorNodeTypeIdsArray().join(" ")
    + tree.touchNode(path)
    + })
    + return tree
    + }
    + _getCellTypeDefinitions() {
    + const types = {}
    + // todo: add built in word types?
    + this.getChildrenByNodeConstructor(cellTypeDefinitionNode).forEach((type) => (types[type.getCellTypeId()] = type))
    + return types
    + }
    + getLanguageDefinitionProgram() {
    + return this
    + }
    + getValidConcreteAndAbstractNodeTypeDefinitions() {
    + return this.getChildrenByNodeConstructor(nodeTypeDefinitionNode).filter((node) => node._hasValidNodeTypeId())
    + }
    + _getLastRootNodeTypeDefinitionNode() {
    + return this.findLast((def) => def instanceof AbstractGrammarDefinitionNode && def.has(GrammarConstants.root) && def._hasValidNodeTypeId())
    + }
    + _initRootNodeTypeDefinitionNode() {
    + if (this._cache_rootNodeTypeNode) return
    + if (!this._cache_rootNodeTypeNode) this._cache_rootNodeTypeNode = this._getLastRootNodeTypeDefinitionNode()
    + // By default, have a very permissive basic root node.
    + // todo: whats the best design pattern to use for this sort of thing?
    + if (!this._cache_rootNodeTypeNode) {
    + this._cache_rootNodeTypeNode = this.concat(`${GrammarConstants.defaultRootNode}
    + ${GrammarConstants.root}
    + ${GrammarConstants.catchAllNodeType} ${GrammarConstants.BlobNode}`)[0]
    + this._addDefaultCatchAllBlobNode()
    + }
    + }
    + getRootNodeTypeDefinitionNode() {
    + this._initRootNodeTypeDefinitionNode()
    + return this._cache_rootNodeTypeNode
    + }
    + // todo: whats the best design pattern to use for this sort of thing?
    + _addDefaultCatchAllBlobNode() {
    + delete this._cache_nodeTypeDefinitions
    + this.concat(`${GrammarConstants.BlobNode}
    + ${GrammarConstants.baseNodeType} ${GrammarConstants.blobNode}`)
    + }
    + getExtensionName() {
    + return this.getGrammarName()
    + }
    + getRootNodeTypeId() {
    + return this.getRootNodeTypeDefinitionNode().getNodeTypeIdFromDefinition()
    + }
    + getGrammarName() {
    + return this.getRootNodeTypeId().replace(HandGrammarProgram.nodeTypeSuffixRegex, "")
    + }
    + _getMyInScopeNodeTypeIds() {
    + const nodeTypesNode = this.getRootNodeTypeDefinitionNode().getNode(GrammarConstants.inScope)
    + return nodeTypesNode ? nodeTypesNode.getWordsFrom(1) : []
    + }
    + _getInScopeNodeTypeIds() {
    + const nodeTypesNode = this.getRootNodeTypeDefinitionNode().getNode(GrammarConstants.inScope)
    + return nodeTypesNode ? nodeTypesNode.getWordsFrom(1) : []
    + }
    + _initProgramNodeTypeDefinitionCache() {
    + if (this._cache_nodeTypeDefinitions) return undefined
    + this._cache_nodeTypeDefinitions = {}
    + this.getChildrenByNodeConstructor(nodeTypeDefinitionNode).forEach((nodeTypeDefinitionNode) => {
    + this._cache_nodeTypeDefinitions[nodeTypeDefinitionNode.getNodeTypeIdFromDefinition()] = nodeTypeDefinitionNode
    + })
    + }
    + _getProgramNodeTypeDefinitionCache() {
    + this._initProgramNodeTypeDefinitionCache()
    + return this._cache_nodeTypeDefinitions
    + }
    + compileAndReturnRootConstructor() {
    + if (!this._cache_rootConstructorClass) {
    + const def = this.getRootNodeTypeDefinitionNode()
    + const rootNodeTypeId = def.getNodeTypeIdFromDefinition()
    + this._cache_rootConstructorClass = def.getLanguageDefinitionProgram()._compileAndReturnNodeTypeMap()[rootNodeTypeId]
    + }
    + return this._cache_rootConstructorClass
    + }
    + _getFileExtensions() {
    + return this.getRootNodeTypeDefinitionNode().get(GrammarConstants.extensions)
    + ? this.getRootNodeTypeDefinitionNode().get(GrammarConstants.extensions).split(" ").join(",")
    + : this.getExtensionName()
    + }
    + toNodeJsJavascript(jtreePath = "jtree") {
    + return this._rootNodeDefToJavascriptClass(jtreePath, true).trim()
    + }
    + toBrowserJavascript() {
    + return this._rootNodeDefToJavascriptClass("", false).trim()
    + }
    + _getProperName() {
    + return TreeUtils.ucfirst(this.getExtensionName())
    + }
    + _rootNodeDefToJavascriptClass(jtreePath, forNodeJs = true) {
    + const defs = this.getValidConcreteAndAbstractNodeTypeDefinitions()
    + // todo: throw if there is no root node defined
    + const nodeTypeClasses = defs.map((def) => def._nodeDefToJavascriptClass()).join("\n\n")
    + const rootDef = this.getRootNodeTypeDefinitionNode()
    + const rootNodeJsHeader = forNodeJs && rootDef._getConcatBlockStringFromExtended(GrammarConstants._rootNodeJsHeader)
    + const rootName = rootDef._getGeneratedClassName()
    + if (!rootName) throw new Error(`Root Node Type Has No Name`)
    + let exportScript = ""
    + if (forNodeJs) {
    + exportScript = `module.exports = ${rootName};
    + ${rootName}`
    + } else {
    + exportScript = `window.${rootName} = ${rootName}`
    + }
    + // todo: we can expose the previous "constants" export, if needed, via the grammar, which we preserve.
    + return `{
    + ${forNodeJs ? `const {jtree} = require("${jtreePath}")` : ""}
    + ${rootNodeJsHeader ? rootNodeJsHeader : ""}
    + ${nodeTypeClasses}
    - if (this.req._parser) {
    - return this.req._parser(this, str);
    - }
    + ${exportScript}
    + }
    + `
    + }
    + toSublimeSyntaxFile() {
    + const cellTypeDefs = this.getCellTypeDefinitions()
    + const variables = Object.keys(cellTypeDefs)
    + .map((name) => ` ${name}: '${cellTypeDefs[name].getRegexString()}'`)
    + .join("\n")
    + const defs = this.getValidConcreteAndAbstractNodeTypeDefinitions().filter((kw) => !kw._isAbstract())
    + const nodeTypeContexts = defs.map((def) => def._toSublimeMatchBlock()).join("\n\n")
    + const includes = defs.map((nodeTypeDef) => ` - include: '${nodeTypeDef.getNodeTypeIdFromDefinition()}'`).join("\n")
    + return `%YAML 1.2
    + ---
    + name: ${this.getExtensionName()}
    + file_extensions: [${this._getFileExtensions()}]
    + scope: source.${this.getExtensionName()}
    - if (!parse && isJSON(this.type)) {
    - parse = request.parse['application/json'];
    - }
    + variables:
    + ${variables}
    - return parse && str && (str.length > 0 || str instanceof Object) ? parse(str) : null;
    - };
    - /**
    - * Return an `Error` representative of this response.
    - *
    - * @return {Error}
    - * @api public
    - */
    + contexts:
    + main:
    + ${includes}
    + ${nodeTypeContexts}`
    + }
    + }
    + HandGrammarProgram.makeNodeTypeId = (str) =>
    + TreeUtils._replaceNonAlphaNumericCharactersWithCharCodes(str).replace(HandGrammarProgram.nodeTypeSuffixRegex, "") + GrammarConstants.nodeTypeSuffix
    + HandGrammarProgram.makeCellTypeId = (str) =>
    + TreeUtils._replaceNonAlphaNumericCharactersWithCharCodes(str).replace(HandGrammarProgram.cellTypeSuffixRegex, "") + GrammarConstants.cellTypeSuffix
    + HandGrammarProgram.nodeTypeSuffixRegex = new RegExp(GrammarConstants.nodeTypeSuffix + "$")
    + HandGrammarProgram.nodeTypeFullRegex = new RegExp("^[a-zA-Z0-9_]+" + GrammarConstants.nodeTypeSuffix + "$")
    + HandGrammarProgram.cellTypeSuffixRegex = new RegExp(GrammarConstants.cellTypeSuffix + "$")
    + HandGrammarProgram.cellTypeFullRegex = new RegExp("^[a-zA-Z0-9_]+" + GrammarConstants.cellTypeSuffix + "$")
    + HandGrammarProgram._languages = {}
    + HandGrammarProgram._nodeTypes = {}
    + const PreludeKinds = {}
    + PreludeKinds[PreludeCellTypeIds.anyCell] = GrammarAnyCell
    + PreludeKinds[PreludeCellTypeIds.keywordCell] = GrammarKeywordCell
    + PreludeKinds[PreludeCellTypeIds.floatCell] = GrammarFloatCell
    + PreludeKinds[PreludeCellTypeIds.numberCell] = GrammarFloatCell
    + PreludeKinds[PreludeCellTypeIds.bitCell] = GrammarBitCell
    + PreludeKinds[PreludeCellTypeIds.boolCell] = GrammarBoolCell
    + PreludeKinds[PreludeCellTypeIds.intCell] = GrammarIntCell
    + window.GrammarConstants = GrammarConstants
    + window.PreludeCellTypeIds = PreludeCellTypeIds
    + window.HandGrammarProgram = HandGrammarProgram
    + window.GrammarBackedNode = GrammarBackedNode
    + window.UnknownNodeTypeError = UnknownNodeTypeError
    + class Upgrader extends TreeNode {
    + upgradeManyInPlace(globPatterns, fromVersion, toVersion) {
    + this._upgradeMany(globPatterns, fromVersion, toVersion).forEach((file) => file.tree.toDisk(file.path))
    + return this
    + }
    + upgradeManyPreview(globPatterns, fromVersion, toVersion) {
    + return this._upgradeMany(globPatterns, fromVersion, toVersion)
    + }
    + _upgradeMany(globPatterns, fromVersion, toVersion) {
    + const glob = this.require("glob")
    + const files = TreeUtils.flatten(globPatterns.map((pattern) => glob.sync(pattern)))
    + console.log(`${files.length} files to upgrade`)
    + return files.map((path) => {
    + console.log("Upgrading " + path)
    + return {
    + tree: this.upgrade(TreeNode.fromDisk(path), fromVersion, toVersion),
    + path: path,
    + }
    + })
    + }
    + upgrade(code, fromVersion, toVersion) {
    + const updateFromMap = this.getUpgradeFromMap()
    + const semver = this.require("semver")
    + let fromMap
    + while ((fromMap = updateFromMap[fromVersion])) {
    + const toNextVersion = Object.keys(fromMap)[0] // todo: currently we just assume 1 step at a time
    + if (semver.lt(toVersion, toNextVersion)) break
    + const fn = Object.values(fromMap)[0]
    + code = fn(code)
    + fromVersion = toNextVersion
    + }
    + return code
    + }
    + }
    + window.Upgrader = Upgrader
    + class UnknownGrammarProgram extends TreeNode {
    + _inferRootNodeForAPrefixLanguage(grammarName) {
    + grammarName = HandGrammarProgram.makeNodeTypeId(grammarName)
    + const rootNode = new TreeNode(`${grammarName}
    + ${GrammarConstants.root}`)
    + // note: right now we assume 1 global cellTypeMap and nodeTypeMap per grammar. But we may have scopes in the future?
    + const rootNodeNames = this.getFirstWords()
    + .filter((identity) => identity)
    + .map((word) => HandGrammarProgram.makeNodeTypeId(word))
    + rootNode
    + .nodeAt(0)
    + .touchNode(GrammarConstants.inScope)
    + .setWordsFrom(1, Array.from(new Set(rootNodeNames)))
    + return rootNode
    + }
    + _renameIntegerKeywords(clone) {
    + // todo: why are we doing this?
    + for (let node of clone.getTopDownArrayIterator()) {
    + const firstWordIsAnInteger = !!node.getFirstWord().match(/^\d+$/)
    + const parentFirstWord = node.getParent().getFirstWord()
    + if (firstWordIsAnInteger && parentFirstWord) node.setFirstWord(HandGrammarProgram.makeNodeTypeId(parentFirstWord + UnknownGrammarProgram._childSuffix))
    + }
    + }
    + _getKeywordMaps(clone) {
    + const keywordsToChildKeywords = {}
    + const keywordsToNodeInstances = {}
    + for (let node of clone.getTopDownArrayIterator()) {
    + const firstWord = node.getFirstWord()
    + if (!keywordsToChildKeywords[firstWord]) keywordsToChildKeywords[firstWord] = {}
    + if (!keywordsToNodeInstances[firstWord]) keywordsToNodeInstances[firstWord] = []
    + keywordsToNodeInstances[firstWord].push(node)
    + node.forEach((child) => {
    + keywordsToChildKeywords[firstWord][child.getFirstWord()] = true
    + })
    + }
    + return { keywordsToChildKeywords: keywordsToChildKeywords, keywordsToNodeInstances: keywordsToNodeInstances }
    + }
    + _inferNodeTypeDef(firstWord, globalCellTypeMap, childFirstWords, instances) {
    + const edgeSymbol = this.getEdgeSymbol()
    + const nodeTypeId = HandGrammarProgram.makeNodeTypeId(firstWord)
    + const nodeDefNode = new TreeNode(nodeTypeId).nodeAt(0)
    + const childNodeTypeIds = childFirstWords.map((word) => HandGrammarProgram.makeNodeTypeId(word))
    + if (childNodeTypeIds.length) nodeDefNode.touchNode(GrammarConstants.inScope).setWordsFrom(1, childNodeTypeIds)
    + const cellsForAllInstances = instances
    + .map((line) => line.getContent())
    + .filter((identity) => identity)
    + .map((line) => line.split(edgeSymbol))
    + const instanceCellCounts = new Set(cellsForAllInstances.map((cells) => cells.length))
    + const maxCellsOnLine = Math.max(...Array.from(instanceCellCounts))
    + const minCellsOnLine = Math.min(...Array.from(instanceCellCounts))
    + let catchAllCellType
    + let cellTypeIds = []
    + for (let cellIndex = 0; cellIndex < maxCellsOnLine; cellIndex++) {
    + const cellType = this._getBestCellType(
    + firstWord,
    + instances.length,
    + maxCellsOnLine,
    + cellsForAllInstances.map((cells) => cells[cellIndex])
    + )
    + if (!globalCellTypeMap.has(cellType.cellTypeId)) globalCellTypeMap.set(cellType.cellTypeId, cellType.cellTypeDefinition)
    + cellTypeIds.push(cellType.cellTypeId)
    + }
    + if (maxCellsOnLine > minCellsOnLine) {
    + //columns = columns.slice(0, min)
    + catchAllCellType = cellTypeIds.pop()
    + while (cellTypeIds[cellTypeIds.length - 1] === catchAllCellType) {
    + cellTypeIds.pop()
    + }
    + }
    + const needsCruxProperty = !firstWord.endsWith(UnknownGrammarProgram._childSuffix + "Node") // todo: cleanup
    + if (needsCruxProperty) nodeDefNode.set(GrammarConstants.crux, firstWord)
    + if (catchAllCellType) nodeDefNode.set(GrammarConstants.catchAllCellType, catchAllCellType)
    + const cellLine = cellTypeIds.slice()
    + cellLine.unshift(PreludeCellTypeIds.keywordCell)
    + if (cellLine.length > 0) nodeDefNode.set(GrammarConstants.cells, cellLine.join(edgeSymbol))
    + //if (!catchAllCellType && cellTypeIds.length === 1) nodeDefNode.set(GrammarConstants.cells, cellTypeIds[0])
    + // Todo: add conditional frequencies
    + return nodeDefNode.getParent().toString()
    + }
    + // inferGrammarFileForAnSSVLanguage(grammarName: string): string {
    + // grammarName = HandGrammarProgram.makeNodeTypeId(grammarName)
    + // const rootNode = new TreeNode(`${grammarName}
    + // ${GrammarConstants.root}`)
    + // // note: right now we assume 1 global cellTypeMap and nodeTypeMap per grammar. But we may have scopes in the future?
    + // const rootNodeNames = this.getFirstWords().map(word => HandGrammarProgram.makeNodeTypeId(word))
    + // rootNode
    + // .nodeAt(0)
    + // .touchNode(GrammarConstants.inScope)
    + // .setWordsFrom(1, Array.from(new Set(rootNodeNames)))
    + // return rootNode
    + // }
    + inferGrammarFileForAKeywordLanguage(grammarName) {
    + const clone = this.clone()
    + this._renameIntegerKeywords(clone)
    + const { keywordsToChildKeywords, keywordsToNodeInstances } = this._getKeywordMaps(clone)
    + const globalCellTypeMap = new Map()
    + globalCellTypeMap.set(PreludeCellTypeIds.keywordCell, undefined)
    + const nodeTypeDefs = Object.keys(keywordsToChildKeywords)
    + .filter((identity) => identity)
    + .map((firstWord) => this._inferNodeTypeDef(firstWord, globalCellTypeMap, Object.keys(keywordsToChildKeywords[firstWord]), keywordsToNodeInstances[firstWord]))
    + const cellTypeDefs = []
    + globalCellTypeMap.forEach((def, id) => cellTypeDefs.push(def ? def : id))
    + const nodeBreakSymbol = this.getNodeBreakSymbol()
    + return this._formatCode(
    + [this._inferRootNodeForAPrefixLanguage(grammarName).toString(), cellTypeDefs.join(nodeBreakSymbol), nodeTypeDefs.join(nodeBreakSymbol)]
    + .filter((identity) => identity)
    + .join("\n")
    + )
    + }
    + _formatCode(code) {
    + // todo: make this run in browser too
    + if (!this.isNodeJs()) return code
    + const grammarProgram = new HandGrammarProgram(TreeNode.fromDisk(__dirname + "/../langs/grammar/grammar.grammar"))
    + const programConstructor = grammarProgram.compileAndReturnRootConstructor()
    + const program = new programConstructor(code)
    + return program.format().toString()
    + }
    + _getBestCellType(firstWord, instanceCount, maxCellsOnLine, allValues) {
    + const asSet = new Set(allValues)
    + const edgeSymbol = this.getEdgeSymbol()
    + const values = Array.from(asSet).filter((identity) => identity)
    + const every = (fn) => {
    + for (let index = 0; index < values.length; index++) {
    + if (!fn(values[index])) return false
    + }
    + return true
    + }
    + if (every((str) => str === "0" || str === "1")) return { cellTypeId: PreludeCellTypeIds.bitCell }
    + if (
    + every((str) => {
    + const num = parseInt(str)
    + if (isNaN(num)) return false
    + return num.toString() === str
    + })
    + ) {
    + return { cellTypeId: PreludeCellTypeIds.intCell }
    + }
    + if (every((str) => str.match(/^-?\d*.?\d+$/))) return { cellTypeId: PreludeCellTypeIds.floatCell }
    + const bools = new Set(["1", "0", "true", "false", "t", "f", "yes", "no"])
    + if (every((str) => bools.has(str.toLowerCase()))) return { cellTypeId: PreludeCellTypeIds.boolCell }
    + // todo: cleanup
    + const enumLimit = 30
    + if (instanceCount > 1 && maxCellsOnLine === 1 && allValues.length > asSet.size && asSet.size < enumLimit)
    + return {
    + cellTypeId: HandGrammarProgram.makeCellTypeId(firstWord),
    + cellTypeDefinition: `${HandGrammarProgram.makeCellTypeId(firstWord)}
    + enum ${values.join(edgeSymbol)}`,
    + }
    + return { cellTypeId: PreludeCellTypeIds.anyCell }
    + }
    + }
    + UnknownGrammarProgram._childSuffix = "Child"
    + window.UnknownGrammarProgram = UnknownGrammarProgram
    + // Adapted from https://github.com/NeekSandhu/codemirror-textmate/blob/master/src/tmToCm.ts
    + var CmToken
    + ;(function (CmToken) {
    + CmToken["Atom"] = "atom"
    + CmToken["Attribute"] = "attribute"
    + CmToken["Bracket"] = "bracket"
    + CmToken["Builtin"] = "builtin"
    + CmToken["Comment"] = "comment"
    + CmToken["Def"] = "def"
    + CmToken["Error"] = "error"
    + CmToken["Header"] = "header"
    + CmToken["HR"] = "hr"
    + CmToken["Keyword"] = "keyword"
    + CmToken["Link"] = "link"
    + CmToken["Meta"] = "meta"
    + CmToken["Number"] = "number"
    + CmToken["Operator"] = "operator"
    + CmToken["Property"] = "property"
    + CmToken["Qualifier"] = "qualifier"
    + CmToken["Quote"] = "quote"
    + CmToken["String"] = "string"
    + CmToken["String2"] = "string-2"
    + CmToken["Tag"] = "tag"
    + CmToken["Type"] = "type"
    + CmToken["Variable"] = "variable"
    + CmToken["Variable2"] = "variable-2"
    + CmToken["Variable3"] = "variable-3"
    + })(CmToken || (CmToken = {}))
    + const tmToCm = {
    + comment: {
    + $: CmToken.Comment,
    + },
    + constant: {
    + // TODO: Revision
    + $: CmToken.Def,
    + character: {
    + escape: {
    + $: CmToken.String2,
    + },
    + },
    + language: {
    + $: CmToken.Atom,
    + },
    + numeric: {
    + $: CmToken.Number,
    + },
    + other: {
    + email: {
    + link: {
    + $: CmToken.Link,
    + },
    + },
    + symbol: {
    + // TODO: Revision
    + $: CmToken.Def,
    + },
    + },
    + },
    + entity: {
    + name: {
    + class: {
    + $: CmToken.Def,
    + },
    + function: {
    + $: CmToken.Def,
    + },
    + tag: {
    + $: CmToken.Tag,
    + },
    + type: {
    + $: CmToken.Type,
    + class: {
    + $: CmToken.Variable,
    + },
    + },
    + },
    + other: {
    + "attribute-name": {
    + $: CmToken.Attribute,
    + },
    + "inherited-class": {
    + // TODO: Revision
    + $: CmToken.Def,
    + },
    + },
    + support: {
    + function: {
    + // TODO: Revision
    + $: CmToken.Def,
    + },
    + },
    + },
    + invalid: {
    + $: CmToken.Error,
    + illegal: { $: CmToken.Error },
    + deprecated: {
    + $: CmToken.Error,
    + },
    + },
    + keyword: {
    + $: CmToken.Keyword,
    + operator: {
    + $: CmToken.Operator,
    + },
    + other: {
    + "special-method": CmToken.Def,
    + },
    + },
    + punctuation: {
    + $: CmToken.Operator,
    + definition: {
    + comment: {
    + $: CmToken.Comment,
    + },
    + tag: {
    + $: CmToken.Bracket,
    + },
    + // 'template-expression': {
    + // $: CodeMirrorToken.Operator,
    + // },
    + },
    + // terminator: {
    + // $: CodeMirrorToken.Operator,
    + // },
    + },
    + storage: {
    + $: CmToken.Keyword,
    + },
    + string: {
    + $: CmToken.String,
    + regexp: {
    + $: CmToken.String2,
    + },
    + },
    + support: {
    + class: {
    + $: CmToken.Def,
    + },
    + constant: {
    + $: CmToken.Variable2,
    + },
    + function: {
    + $: CmToken.Def,
    + },
    + type: {
    + $: CmToken.Type,
    + },
    + variable: {
    + $: CmToken.Variable2,
    + property: {
    + $: CmToken.Property,
    + },
    + },
    + },
    + variable: {
    + $: CmToken.Def,
    + language: {
    + // TODO: Revision
    + $: CmToken.Variable3,
    + },
    + other: {
    + object: {
    + $: CmToken.Variable,
    + property: {
    + $: CmToken.Property,
    + },
    + },
    + property: {
    + $: CmToken.Property,
    + },
    + },
    + parameter: {
    + $: CmToken.Def,
    + },
    + },
    + }
    + const textMateScopeToCodeMirrorStyle = (scopeSegments, styleTree = tmToCm) => {
    + const matchingBranch = styleTree[scopeSegments.shift()]
    + return matchingBranch ? textMateScopeToCodeMirrorStyle(scopeSegments, matchingBranch) || matchingBranch.$ || null : null
    + }
    + class TreeNotationCodeMirrorMode {
    + constructor(name, getProgramConstructorFn, getProgramCodeFn, codeMirrorLib = undefined) {
    + this._name = name
    + this._getProgramConstructorFn = getProgramConstructorFn
    + this._getProgramCodeFn = getProgramCodeFn || ((instance) => (instance ? instance.getValue() : this._originalValue))
    + this._codeMirrorLib = codeMirrorLib
    + }
    + _getParsedProgram() {
    + const source = this._getProgramCodeFn(this._cmInstance) || ""
    + if (!this._cachedProgram || this._cachedSource !== source) {
    + this._cachedSource = source
    + this._cachedProgram = new (this._getProgramConstructorFn())(source)
    + }
    + return this._cachedProgram
    + }
    + _getExcludedIntelliSenseTriggerKeys() {
    + return {
    + 8: "backspace",
    + 9: "tab",
    + 13: "enter",
    + 16: "shift",
    + 17: "ctrl",
    + 18: "alt",
    + 19: "pause",
    + 20: "capslock",
    + 27: "escape",
    + 33: "pageup",
    + 34: "pagedown",
    + 35: "end",
    + 36: "home",
    + 37: "left",
    + 38: "up",
    + 39: "right",
    + 40: "down",
    + 45: "insert",
    + 46: "delete",
    + 91: "left window key",
    + 92: "right window key",
    + 93: "select",
    + 112: "f1",
    + 113: "f2",
    + 114: "f3",
    + 115: "f4",
    + 116: "f5",
    + 117: "f6",
    + 118: "f7",
    + 119: "f8",
    + 120: "f9",
    + 121: "f10",
    + 122: "f11",
    + 123: "f12",
    + 144: "numlock",
    + 145: "scrolllock",
    + }
    + }
    + token(stream, state) {
    + return this._advanceStreamAndReturnTokenType(stream, state)
    + }
    + fromTextAreaWithAutocomplete(area, options) {
    + this._originalValue = area.value
    + const defaultOptions = {
    + lineNumbers: true,
    + mode: this._name,
    + tabSize: 1,
    + indentUnit: 1,
    + hintOptions: {
    + hint: (cmInstance, options) => this.codeMirrorAutocomplete(cmInstance, options),
    + },
    + }
    + Object.assign(defaultOptions, options)
    + this._cmInstance = this._getCodeMirrorLib().fromTextArea(area, defaultOptions)
    + this._enableAutoComplete(this._cmInstance)
    + return this._cmInstance
    + }
    + _enableAutoComplete(cmInstance) {
    + const excludedKeys = this._getExcludedIntelliSenseTriggerKeys()
    + const codeMirrorLib = this._getCodeMirrorLib()
    + cmInstance.on("keyup", (cm, event) => {
    + // https://stackoverflow.com/questions/13744176/codemirror-autocomplete-after-any-keyup
    + if (!cm.state.completionActive && !excludedKeys[event.keyCode.toString()])
    + // Todo: get typings for CM autocomplete
    + codeMirrorLib.commands.autocomplete(cm, null, { completeSingle: false })
    + })
    + }
    + _getCodeMirrorLib() {
    + return this._codeMirrorLib
    + }
    + async codeMirrorAutocomplete(cmInstance, options) {
    + const cursor = cmInstance.getDoc().getCursor()
    + const codeMirrorLib = this._getCodeMirrorLib()
    + const result = await this._getParsedProgram().getAutocompleteResultsAt(cursor.line, cursor.ch)
    + // It seems to be better UX if there's only 1 result, and its the word the user entered, to close autocomplete
    + if (result.matches.length === 1 && result.matches[0].text === result.word) return null
    + return result.matches.length
    + ? {
    + list: result.matches,
    + from: codeMirrorLib.Pos(cursor.line, result.startCharIndex),
    + to: codeMirrorLib.Pos(cursor.line, result.endCharIndex),
    + }
    + : null
    + }
    + register() {
    + const codeMirrorLib = this._getCodeMirrorLib()
    + codeMirrorLib.defineMode(this._name, () => this)
    + codeMirrorLib.defineMIME("text/" + this._name, this._name)
    + return this
    + }
    + _advanceStreamAndReturnTokenType(stream, state) {
    + let nextCharacter = stream.next()
    + const lineNumber = stream.lineOracle.line + 1 // state.lineIndex
    + const WordBreakSymbol = " "
    + const NodeBreakSymbol = "\n"
    + while (typeof nextCharacter === "string") {
    + const peek = stream.peek()
    + if (nextCharacter === WordBreakSymbol) {
    + if (peek === undefined || peek === NodeBreakSymbol) {
    + stream.skipToEnd() // advance string to end
    + this._incrementLine(state)
    + }
    + if (peek === WordBreakSymbol && state.cellIndex) {
    + // If we are missing a cell.
    + // TODO: this is broken for a blank 1st cell. We need to track WordBreakSymbol level.
    + state.cellIndex++
    + }
    + return "bracket"
    + }
    + if (peek === WordBreakSymbol) {
    + state.cellIndex++
    + return this._getCellStyle(lineNumber, state.cellIndex)
    + }
    + nextCharacter = stream.next()
    + }
    + state.cellIndex++
    + const style = this._getCellStyle(lineNumber, state.cellIndex)
    + this._incrementLine(state)
    + return style
    + }
    + _getCellStyle(lineIndex, cellIndex) {
    + const program = this._getParsedProgram()
    + // todo: if the current word is an error, don't show red?
    + if (!program.getCellHighlightScopeAtPosition) console.log(program)
    + const highlightScope = program.getCellHighlightScopeAtPosition(lineIndex, cellIndex)
    + const style = highlightScope ? textMateScopeToCodeMirrorStyle(highlightScope.split(".")) : undefined
    + return style || "noHighlightScopeDefinedInGrammar"
    + }
    + // todo: remove.
    + startState() {
    + return {
    + cellIndex: 0,
    + }
    + }
    + _incrementLine(state) {
    + state.cellIndex = 0
    + }
    + }
    + window.TreeNotationCodeMirrorMode = TreeNotationCodeMirrorMode
    + class jtree {}
    + jtree.GrammarBackedNode = GrammarBackedNode
    + jtree.GrammarConstants = GrammarConstants
    + jtree.Utils = TreeUtils
    + jtree.UnknownNodeTypeError = UnknownNodeTypeError
    + jtree.TestRacer = TestRacer
    + jtree.TreeEvents = TreeEvents
    + jtree.TreeNode = TreeNode
    + jtree.ExtendibleTreeNode = ExtendibleTreeNode
    + jtree.HandGrammarProgram = HandGrammarProgram
    + jtree.UnknownGrammarProgram = UnknownGrammarProgram
    + jtree.TreeNotationCodeMirrorMode = TreeNotationCodeMirrorMode
    + jtree.getVersion = () => TreeNode.getVersion()
    + window.jtree = jtree
    - Response.prototype.toError = function () {
    - var req = this.req;
    - var method = req.method;
    - var url = req.url;
    - var msg = "cannot ".concat(method, " ").concat(url, " (").concat(this.status, ")");
    - var err = new Error(msg);
    - err.status = this.status;
    - err.method = method;
    - err.url = url;
    - return err;
    - };
    - /**
    - * Expose `Response`.
    - */
    + //onsave jtree build produce jtable.browser.js
    + //onsave jtree build produce jtable.node.js
    + // todo: create a Tree Language for number formatting
    + // https://github.com/gentooboontoo/js-quantities
    + // https://github.com/moment/moment/issues/2469
    + // todo: ugly. how do we ditch this or test?
    + if (typeof moment !== "undefined")
    + moment.createFromInputFallback = function (momentConfig) {
    + momentConfig._d = new Date(momentConfig._i)
    + }
    + var VegaTypes
    + ;(function (VegaTypes) {
    + VegaTypes["nominal"] = "nominal"
    + VegaTypes["ordinal"] = "ordinal"
    + VegaTypes["geojson"] = "geojson"
    + VegaTypes["quantitative"] = "quantitative"
    + VegaTypes["temporal"] = "temporal"
    + })(VegaTypes || (VegaTypes = {}))
    + var JavascriptNativeTypeNames
    + ;(function (JavascriptNativeTypeNames) {
    + JavascriptNativeTypeNames["number"] = "number"
    + JavascriptNativeTypeNames["string"] = "string"
    + JavascriptNativeTypeNames["Date"] = "Date"
    + JavascriptNativeTypeNames["boolean"] = "boolean"
    + })(JavascriptNativeTypeNames || (JavascriptNativeTypeNames = {}))
    + class AbstractPrimitiveType {
    + constructor(typeName) {
    + this._name = typeName
    + }
    + getPrimitiveTypeName() {
    + return this._name
    + }
    + // Abstract methods:
    + toDisplayString(value, format) {
    + return value
    + }
    + getDefaultFormat(columnName, sample) {
    + return ""
    + }
    + getProbForColumnSpecimen(value) {
    + return 0
    + }
    + isInvalidValue(value) {
    + if (value === undefined || value === "") return true
    + return false
    + }
    + }
    + class BooleanType extends AbstractPrimitiveType {
    + getAsNativeJavascriptType(val) {
    + // todo: handle false, etc
    + return val ? 1 : 0
    + }
    + synthesizeValue(randomNumberFn) {
    + return Math.round(randomNumberFn())
    + }
    + getJavascriptTypeName() {
    + return JavascriptNativeTypeNames.boolean
    + }
    + fromStringToNumeric(val) {
    + return val.toString() === "true" ? 1 : 0
    + }
    + getStringExamples() {
    + return ["true"]
    + }
    + getVegaType() {
    + return VegaTypes.nominal
    + }
    + isNumeric() {
    + return false
    + }
    + isString() {
    + return false
    + }
    + isTemporal() {
    + return false
    + }
    + }
    + class AbstractNumeric extends AbstractPrimitiveType {
    + fromStringToNumeric(value) {
    + return parseFloat(value)
    + }
    + synthesizeValue(randomNumberFn) {
    + // todo: min/max etc
    + return this.getMin() + Math.floor((this.getMax() - this.getMin()) * randomNumberFn())
    + }
    + getMax() {
    + return 100
    + }
    + getMin() {
    + return 0
    + }
    + getAsNativeJavascriptType(val) {
    + if (val === undefined) return NaN
    + const valType = typeof val
    + if (valType === "string") return this.fromStringToNumeric(val)
    + else if (val instanceof Date) return Math.round(val.getDate() / 1000)
    + // Is a number
    + return val
    + }
    + getJavascriptTypeName() {
    + return JavascriptNativeTypeNames.number
    + }
    + getVegaType() {
    + return VegaTypes.quantitative
    + }
    + isString() {
    + return false
    + }
    + isTemporal() {
    + return false
    + }
    + isNumeric() {
    + return true
    + }
    + isInvalidValue(value) {
    + return super.isInvalidValue(value) || isNaN(value)
    + }
    + }
    + class IntType extends AbstractNumeric {
    + fromStringToNumeric(val) {
    + return parseInt(val)
    + }
    + getStringExamples() {
    + return ["30"]
    + }
    + getVegaType() {
    + return VegaTypes.quantitative
    + }
    + isNumeric() {
    + return true
    + }
    + isString() {
    + return false
    + }
    + isTemporal() {
    + return false
    + }
    + }
    + class Feet extends AbstractNumeric {
    + getProbForColumnSpecimen(sample) {
    + return isNaN(Feet.feetToInches(sample)) ? 0 : 1
    + }
    + fromStringToNumeric(val) {
    + return Feet.feetToInches(val)
    + }
    + toDisplayString(value, format) {
    + value = parseFloat(value)
    + const inches = Math.round(value % 12)
    + const feet = Math.floor(value / 12)
    + return `${feet}'${inches}"`
    + }
    + getStringExamples() {
    + return ["5'10\""]
    + }
    + // Return inches given formats like 6'1 6'2"
    + static feetToInches(numStr) {
    + let result = 0
    + const indexOfDelimited = numStr.search(/[^0-9\.]/)
    + if (indexOfDelimited < 1) {
    + result = parseFloat(numStr.replace(/[^0-9\.]/g, ""))
    + return isNaN(result) ? result : result * 12
    + }
    + const feetPart = parseFloat(numStr.substr(0, indexOfDelimited).replace(/[^0-9\.]/g, ""))
    + const inchesPart = parseFloat(numStr.substr(indexOfDelimited).replace(/[^0-9\.]/g, ""))
    + if (!isNaN(feetPart)) result += feetPart * 12
    + if (!isNaN(inchesPart)) result += inchesPart
    + return result
    + }
    + }
    + class AbstractCurrency extends AbstractNumeric {}
    + class USD extends AbstractCurrency {
    + toDisplayString(value, format) {
    + return format ? d3format.format(format)(value) : value
    + }
    + fromStringToNumeric(value) {
    + return parseFloat(value.toString().replace(/[\$\, \%]/g, ""))
    + }
    + getProbForColumnSpecimen(sample) {
    + return sample && sample.match && !!sample.match(/^\$[0-9\.\,]+$/) ? 1 : 0
    + }
    + getDefaultFormat() {
    + return "($.2f"
    + }
    + getStringExamples() {
    + return ["$2.22"]
    + }
    + }
    + class NumberCol extends AbstractNumeric {
    + // https://github.com/d3/d3-format
    + toDisplayString(value, format) {
    + if (format === "percent") return d3format.format("(.2f")(parseFloat(value)) + "%"
    + // Need the isNan bc numeral will throw otherwise
    + if (format && !isNaN(value) && value !== Infinity) return d3format.format(format)(value)
    + return value
    + }
    + getDefaultFormat(columnName, sample) {
    + if (columnName.match(/^(mile|pound|inch|feet)s?$/i)) return "(.1f"
    + if (columnName.match(/^(calorie|steps)s?$/i)) return ","
    + if (sample && !sample.toString().includes(".")) return ","
    + }
    + getStringExamples() {
    + return ["2.22"]
    + }
    + }
    + class NumberString extends AbstractNumeric {
    + toDisplayString(value, format) {
    + return format ? d3format.format(format)(value) : value
    + }
    + getDefaultFormat() {
    + return ","
    + }
    + fromStringToNumeric(str) {
    + return parseFloat(str.toString().replace(/[\$\, \%]/g, ""))
    + }
    + getStringExamples() {
    + return ["2,000"]
    + }
    + }
    + class ObjectType extends AbstractPrimitiveType {
    + getAsNativeJavascriptType(val) {
    + return val === undefined ? "" : val.toString()
    + }
    + // todo: not sure about this.
    + getStringExamples() {
    + return ["{score: 10}"]
    + }
    + synthesizeValue() {
    + return {}
    + }
    + fromStringToNumeric() {
    + return undefined
    + }
    + getJavascriptTypeName() {
    + return JavascriptNativeTypeNames.string
    + }
    + getVegaType() {
    + return VegaTypes.nominal
    + }
    + isNumeric() {
    + return false
    + }
    + isString() {
    + return false
    + }
    + isTemporal() {
    + return false
    + }
    + }
    + class AbstractStringCol extends AbstractPrimitiveType {
    + isString() {
    + return true
    + }
    + isNumeric() {
    + return false
    + }
    + getStringExamples() {
    + return ["Anything"]
    + }
    + getVegaType() {
    + return VegaTypes.nominal
    + }
    + synthesizeValue() {
    + return "randomString"
    + }
    + getJavascriptTypeName() {
    + return JavascriptNativeTypeNames.string
    + }
    + fromStringToNumeric() {
    + return undefined
    + }
    + isTemporal() {
    + return false
    + }
    + getAsNativeJavascriptType(val) {
    + return val === undefined ? "" : val.toString()
    + }
    + }
    + class StringCol extends AbstractStringCol {}
    + class UrlCol extends AbstractStringCol {
    + getStringExamples() {
    + return ["www.foo.com"]
    + }
    + }
    + class TextCol extends AbstractStringCol {}
    + class AbstractCodeCol extends AbstractStringCol {}
    + class CodeCol extends AbstractCodeCol {
    + getStringExamples() {
    + return ["i++"]
    + }
    + }
    + class HTMLCol extends AbstractCodeCol {
    + getStringExamples() {
    + return ["hi"]
    + }
    + }
    + class AbstractPathCol extends AbstractStringCol {}
    + // filepath
    + class PathCol extends AbstractPathCol {}
    + // Directory
    + class DirCol extends AbstractPathCol {}
    + class AbstractTemporal extends AbstractPrimitiveType {
    + _fromStringToDate(value) {
    + return moment(parseInt(value)).toDate()
    + }
    + getAsNativeJavascriptType(val) {
    + if (val === undefined) return undefined
    + const valType = typeof val
    + if (valType === "string") return this._fromStringToDate(val)
    + else if (val instanceof Date) return val
    + return this._fromNumericToDate(val)
    + }
    + fromDateToNumeric(date) {
    + return moment(date).unix()
    + }
    + getJavascriptTypeName() {
    + return JavascriptNativeTypeNames.Date
    + }
    + synthesizeValue() {
    + return new Date()
    + }
    + isNumeric() {
    + return true
    + }
    + isString() {
    + return false
    + }
    + isTemporal() {
    + return true
    + }
    + getVegaType() {
    + return VegaTypes.temporal
    + }
    + getVegaTimeUnit() {
    + return undefined
    + }
    + _fromNumericToDate(value) {
    + return moment(value).toDate()
    + }
    + }
    + class DateCol extends AbstractTemporal {
    + toDisplayString(value, format) {
    + if (!format) format = "MM/DD/YY"
    + if (format === "fromNow") return moment(parseFloat(value)).fromNow()
    + // todo: make sure we are working with numeric values?
    + return moment(value).format(format)
    + }
    + fromStringToNumeric(value) {
    + return DateCol.getDate(value).unix() * 1000
    + }
    + _fromStringToDate(value) {
    + return DateCol.getDate(value).toDate()
    + }
    + getProbForColumnSpecimen(value) {
    + const isValid = DateCol.getDate(value).isValid()
    + return isValid
    + }
    + getStringExamples() {
    + return ["01/01/01"]
    + }
    + static getDateAsUnixUtx(value) {
    + return this.getDate(value, moment.utc).unix()
    + }
    + static getDate(value, momentFn = moment) {
    + let result = momentFn(value)
    + if (result.isValid()) return result
    + if (typeof value === "string" && value.match(/^[0-9]{8}$/)) {
    + const first2 = parseInt(value.substr(0, 2))
    + const second2 = parseInt(value.substr(2, 2))
    + const third2 = parseInt(value.substr(4, 2))
    + const last2 = parseInt(value.substr(6, 2))
    + const first4 = parseInt(value.substr(0, 4))
    + const last4 = parseInt(value.substr(4, 4))
    + const first2couldBeDay = first2 < 32
    + const first2couldBeMonth = first2 < 13
    + const second2couldBeDay = second2 < 32
    + const second2couldBeMonth = second2 < 13
    + const third2couldBeDay = third2 < 32
    + const third2couldBeMonth = third2 < 13
    + const last2couldBeDay = last2 < 32
    + const last2couldBeMonth = last2 < 13
    + const last4looksLikeAYear = last4 > 1000 && last4 < 2100
    + const first4looksLikeAYear = first4 > 1000 && first4 < 2100
    + // MMDDYYYY
    + // YYYYMMDD
    + // Prioritize the above 2 american versions
    + // YYYYDDMM
    + // DDMMYYYY
    + if (first2couldBeMonth && second2couldBeDay && last4looksLikeAYear) result = momentFn(value, "MMDDYYYY")
    + else if (first4looksLikeAYear && third2couldBeMonth && last2couldBeDay) result = momentFn(value, "YYYYMMDD")
    + else if (first4looksLikeAYear && last2couldBeMonth) result = momentFn(value, "YYYYDDMM")
    + else result = momentFn(value, "DDMMYYYY")
    + return result
    + } else if (typeof value === "string" && value.match(/^[0-9]{2}\/[0-9]{4}$/))
    + // MM/YYYY
    + return momentFn(value, "MM/YYYY")
    + // Check if timestamp
    + if (value.match && !value.match(/[^0-9]/)) {
    + const num = parseFloat(value)
    + if (!isNaN(num)) {
    + if (value.length === 10) return momentFn(num * 1000)
    + else return momentFn(num)
    + }
    + }
    + // Okay to return an invalid result if we dont find a match
    + // todo: why??? should we return "" instead ?
    + return result
    + }
    + }
    + // Beginning of day
    + class Day extends AbstractTemporal {
    + toDisplayString(value, format) {
    + return moment(value).format(format || "MM/DD/YYYY")
    + }
    + fromStringToNumeric(value) {
    + return DateCol.getDate(value).startOf("day").unix() * 1000
    + }
    + getVegaTimeUnit() {
    + return undefined
    + }
    + _fromStringToDate(value) {
    + return DateCol.getDate(value).startOf("day").toDate()
    + }
    + fromDateToNumeric(date) {
    + return moment(date).startOf("day").unix() * 1000
    + }
    + getStringExamples() {
    + return ["01/01/01"]
    + }
    + getProbForColumnSpecimen(sample) {
    + const format = moment.parseFormat ? moment.parseFormat(sample) : parseFormat
    + return format === "MM/DD/YY" || format === "MM/DD/YYYY" || format === "M/D/YYYY" ? 1 : 0
    + }
    + }
    + class HourMinute extends AbstractTemporal {
    + // todo: is this correct? I dont think so.
    + fromStringToNumeric(value) {
    + return parseFloat(DateCol.getDate(value).format("H.m"))
    + }
    + getVegaTimeUnit() {
    + return "hoursminutes"
    + }
    + // todo: is this correct? I dont think so.
    + getStringExamples() {
    + return ["2:30"]
    + }
    + }
    + class Minute extends AbstractTemporal {
    + toDisplayString(value, format) {
    + return moment(value).format("m")
    + }
    + fromStringToNumeric(value) {
    + return DateCol.getDate(value).startOf("minute").unix() * 1000
    + }
    + getVegaTimeUnit() {
    + return "minutes"
    + }
    + getStringExamples() {
    + return ["30"]
    + }
    + }
    + class AbstractTemporalInt extends AbstractTemporal {
    + fromStringToNumeric(val) {
    + return parseInt(val)
    + }
    + // getAsNativeJavascriptType(val: any): number {
    + // const result = super.getAsNativeJavascriptType(val)
    + // return result === undefined ? undefined : this.fromDateToNumeric(result)
    + // }
    + getStringExamples() {
    + return ["30"]
    + }
    + isNumeric() {
    + return true
    + }
    + isString() {
    + return false
    + }
    + fromDateToNumeric(date) {
    + return moment(date).unix()
    + }
    + _fromStringToDate(val) {
    + return moment(parseFloat(val)).toDate()
    + }
    + _fromNumericToDate(value) {
    + return moment(value).toDate()
    + }
    + getVegaTimeUnit() {
    + return "seconds"
    + }
    + }
    + class Week extends AbstractTemporalInt {
    + toDisplayString(value, format) {
    + return moment(value).format("MM/DD/YYYY - WW")
    + }
    + fromDateToNumeric(date) {
    + return moment(date).startOf("week").unix() * 1000
    + }
    + getVegaTimeUnit() {
    + return "quartermonth"
    + }
    + }
    + class Month extends AbstractTemporalInt {
    + toDisplayString(value, format) {
    + return moment(value).format(format || "MMMM")
    + }
    + fromDateToNumeric(date) {
    + return moment(date).startOf("month").unix() * 1000
    + }
    + getVegaTimeUnit() {
    + return "month"
    + }
    + }
    + class MonthDay extends AbstractTemporalInt {
    + toDisplayString(value, format) {
    + return moment(value).format(format || "MMDD")
    + }
    + fromDateToNumeric(date) {
    + return moment(date).unix() * 1000
    + }
    + getVegaTimeUnit() {
    + return "monthdate"
    + }
    + }
    + class Hour extends AbstractTemporalInt {
    + fromDateToNumeric(date) {
    + return parseInt(moment(date).startOf("hour").format("H"))
    + }
    + getVegaTimeUnit() {
    + return "hours"
    + }
    + }
    + class Year extends AbstractTemporalInt {
    + fromDateToNumeric(date) {
    + return parseInt(moment(date).format("YYYY"))
    + }
    + _fromStringToDate(val) {
    + return moment(parseFloat(val), "YYYY").toDate()
    + }
    + toDisplayString(value, format) {
    + return moment(value).format(format || "YYYY")
    + }
    + getVegaTimeUnit() {
    + return "year"
    + }
    + _fromNumericToDate(value) {
    + return moment(value, "YYYY").toDate()
    + }
    + isTemporal() {
    + return true
    + }
    + }
    + class AbstractMillisecond extends AbstractTemporalInt {
    + toDisplayString(value, format) {
    + if (format === "fromNow") return moment(parseFloat(value)).fromNow()
    + return value
    + }
    + isTemporal() {
    + return true
    + }
    + getDefaultFormat() {
    + return "fromNow"
    + }
    + }
    + class MilliSecond extends AbstractMillisecond {
    + getVegaTimeUnit() {
    + return "milliseconds"
    + }
    + }
    + class Second extends AbstractMillisecond {
    + fromStringToNumeric(value) {
    + return parseInt(value) * 1000
    + }
    + getVegaTimeUnit() {
    + return "seconds"
    + }
    + _fromNumericToDate(number) {
    + return moment(number * 1000).toDate()
    + }
    + toDisplayString(value, format) {
    + if (format === "fromNow") return moment(parseFloat(value) * 1000).fromNow()
    + return value
    + }
    + }
    + // todo: ADD TYPINGS
    + class Column {
    + constructor(colDef = {}, rawAnyVector) {
    + this._colDefObject = colDef
    + this._rawAnyVectorFromSource = rawAnyVector
    + this._sampleSet = jtree.Utils.sampleWithoutReplacement(rawAnyVector, 30, Date.now())
    + }
    + static _getPrimitiveTypesCollection() {
    + if (!this._colTypes)
    + this._colTypes = {
    + millisecond: new MilliSecond("millisecond"),
    + second: new Second("second"),
    + date: new DateCol("date"),
    + day: new Day("day"),
    + week: new Week("week"),
    + month: new Month("month"),
    + monthDay: new MonthDay("monthDay"),
    + hour: new Hour("hour"),
    + hourMinute: new HourMinute("hourMinute"),
    + minute: new Minute("minute"),
    + year: new Year("year"),
    + feet: new Feet("feet"),
    + usd: new USD("usd"),
    + number: new NumberCol("number"),
    + numberString: new NumberString("numberString"),
    + string: new StringCol("string"),
    + text: new TextCol("text"),
    + path: new PathCol("path"),
    + dir: new DirCol("dir"),
    + code: new CodeCol("code"),
    + html: new HTMLCol("html"),
    + url: new UrlCol("url"),
    + object: new ObjectType("object"),
    + boolean: new BooleanType("boolean"),
    + int: new IntType("int"),
    + }
    + return this._colTypes
    + }
    + static getPrimitiveTypeByName(name) {
    + return this._getPrimitiveTypesCollection()[name]
    + }
    + getMathFn() {
    + return this._colDefObject.mathFn
    + }
    + getColumnName() {
    + return this._getColDefObject().name
    + }
    + _getSourceColumnName() {
    + return this._colDefObject.source
    + }
    + isInvalidValue(value) {
    + return this.getPrimitiveTypeObj().isInvalidValue(value)
    + }
    + _getFirstNonEmptyValueFromSampleSet() {
    + if (this._sample === undefined) {
    + const sampleSet = this._getSampleSet()
    + this._sample = sampleSet.length ? sampleSet.find((value) => !jtree.Utils.isValueEmpty(value)) : ""
    + }
    + return this._sample
    + }
    + _getColDefObject() {
    + return this._colDefObject
    + }
    + getPrimitiveTypeObj() {
    + if (!this._type) this._type = this._inferType()
    + return this._type
    + }
    + synthesizeValue(randomNumberFn) {
    + return this.getPrimitiveTypeObj().synthesizeValue(randomNumberFn)
    + }
    + isTemporal() {
    + return this.getPrimitiveTypeObj().isTemporal()
    + }
    + toDisplayString(value) {
    + return this.getPrimitiveTypeObj().toDisplayString(value, this.getFormat())
    + }
    + isString() {
    + return this.getPrimitiveTypeObj().isString()
    + }
    + isNumeric() {
    + return this.getPrimitiveTypeObj().isNumeric()
    + }
    + isHash() {
    + return this.isString() && false // todo: make this work. identify random hashes, et cetera.
    + }
    + // todo: isEnum/isSet
    + // todo: isUniqueTimestamp
    + getEntropy() {
    + if (this._entropy !== undefined) return this._entropy
    + const possibilities = {}
    + let bits = 1
    + const name = this.getColumnName()
    + this._getSampleSet().forEach((val) => {
    + if (possibilities[val]) return
    + bits++
    + possibilities[val] = true
    + })
    + this._entropy = bits
    + return this._entropy
    + }
    + isLink() {
    + if (this._isLink !== undefined) return this._isLink
    + const sample = this._getFirstNonEmptyValueFromSampleSet()
    + if (!this.isString() || !sample || !sample.match) this._isLink = false
    + else this._isLink = sample.match(/^(https?\:|\/)/) ? true : false
    + return this._isLink
    + }
    + _getSampleSet() {
    + return this._sampleSet
    + }
    + isUnique() {
    + return this.getEntropy() - 1 === this._getSampleSet().length
    + }
    + getTitlePotential() {
    + if (this._getColDefObject().title) return 1
    + if (this._titlePotential !== undefined) return this._titlePotential
    + const titleCols = {
    + title: 0.99,
    + name: 0.98,
    + label: 0.97,
    + category: 0.96,
    + }
    + const lowerCaseName = this.getColumnName().toLowerCase()
    + if (titleCols[lowerCaseName]) this._titlePotential = titleCols[lowerCaseName]
    + else if (this.getEstimatedTextLength() > 150) this._titlePotential = 0.01
    + else if (this.isString() && !this.isLink() && this.isUnique() && !this.isHash()) this._titlePotential = 0.75
    + else this._titlePotential = 0
    + return this._titlePotential
    + }
    + getVegaType() {
    + return this.getPrimitiveTypeObj().getVegaType()
    + }
    + getVegaTimeUnit() {
    + const type = this.getPrimitiveTypeObj()
    + return type.getVegaTimeUnit ? type.getVegaTimeUnit() : undefined
    + }
    + getEstimatedTextLength() {
    + if (!this.isString()) return 0
    + if (this._estimatedTextLength !== undefined) return this._estimatedTextLength
    + const name = this.getColumnName()
    + const sampleSet = this._getSampleSet()
    + const sum = sampleSet.map((val) => val && val.length).reduce((rowLength, cumulative) => rowLength + cumulative, 0)
    + this._estimatedTextLength = Math.floor(sum / sampleSet.length)
    + return this._estimatedTextLength
    + }
    + getFormat() {
    + if (this._getColDefObject().format) return this._getColDefObject().format
    + return this.getPrimitiveTypeObj().getDefaultFormat(this.getColumnName(), this._getFirstNonEmptyValueFromSampleSet())
    + }
    + getBlankPercentage() {
    + let blankCount = 0
    + let mistypedCount = 0 // todo.
    + const colName = this.getColumnName()
    + const sampleSet = this._getSampleSet()
    + sampleSet.forEach((value) => {
    + if (value === undefined || value === "") blankCount++
    + // todo: add mistyped data
    + })
    + return blankCount / (sampleSet.length || 1)
    + }
    + getMap() {
    + const map = this._map
    + if (map) return map
    + this._map = this._getSummaryVector().map
    + return this._map
    + }
    + getValues() {
    + return this._getSummaryVector().values
    + }
    + _getSummaryVector() {
    + if (!this._summaryVector) this._summaryVector = this._createSummaryVector()
    + return this._summaryVector
    + }
    + _getRawAnyVectorFromSource() {
    + return this._rawAnyVectorFromSource
    + }
    + _createSummaryVector() {
    + const values = []
    + const map = new Map()
    + let incompleteCount = 0
    + let uniques = 0
    + let index = 0
    + let rawVector = this._getRawAnyVectorFromSource()
    + // If needs conversion.
    + // todo: add tests
    + const primitiveType = this.getPrimitiveTypeObj()
    + if (primitiveType.isNumeric() && typeof rawVector[0] === "string") rawVector = rawVector.map(primitiveType.fromStringToNumeric)
    + rawVector.forEach((val) => {
    + if (this.isInvalidValue(val)) {
    + incompleteCount++
    + return true
    + }
    + if (!map.has(val)) {
    + map.set(val, { count: 0, index: index })
    + uniques++
    + } else map.get(val).count++
    + values.push(val)
    + })
    + return {
    + map: map,
    + values: values,
    + incompleteCount: incompleteCount,
    + uniqueValues: uniques,
    + }
    + }
    + getQuins() {
    + const deciles = this.getReductions().deciles
    + return [20, 40, 60, 80, 100].map((decile) => {
    + return {
    + value: deciles[decile],
    + percent: decile / 100,
    + }
    + })
    + }
    + getPrimitiveTypeName() {
    + return this.getPrimitiveTypeObj().getPrimitiveTypeName()
    + }
    + toObject() {
    + return {
    + name: this.getColumnName(),
    + type: this.getPrimitiveTypeName(),
    + vegaType: this.getVegaType(),
    + vegaTimeUnit: this.getVegaTimeUnit(),
    + reduction: this._getColDefObject().reduction,
    + titlePotential: this.getTitlePotential(),
    + isString: this.isString(),
    + isTemporal: this.isTemporal(),
    + isLink: this.isLink(),
    + estimatedTextLength: this.getEstimatedTextLength(),
    + }
    + }
    + getReductions() {
    + if (!this._reductions) this._reductions = this._getReductionResult(this._getSummaryVector(), this)
    + return this._reductions
    + }
    + getMax() {
    + return this.getReductions().max
    + }
    + getMin() {
    + return this.getReductions().min
    + }
    + getMean() {
    + return this.getReductions().mean
    + }
    + _getReductionResult(valuesObj, col) {
    + const values = valuesObj.values
    + const count = values.length
    + const reductionResult = {}
    + reductionResult.incompleteCount = valuesObj.incompleteCount
    + reductionResult.uniqueValues = valuesObj.uniqueValues
    + if (!count) return reductionResult
    + const numericCompare = (av, bv) => (av > bv ? 1 : av < bv ? -1 : 0)
    + const arr = values.slice()
    + col.isString() ? arr.sort() : arr.sort(numericCompare)
    + let min = arr[0]
    + let max = arr[0]
    + let sum = 0
    + let mode = undefined
    + let modeSize = 0
    + let currentBucketValue = undefined
    + let currentBucketSize = 0
    + for (let index = 0; index < count; index++) {
    + let value = arr[index]
    + sum += value
    + if (value > max) max = value
    + if (value < min) min = value
    + if (value === currentBucketValue) currentBucketSize++
    + else {
    + currentBucketValue = value
    + currentBucketSize = 1
    + }
    + if (currentBucketSize > modeSize) {
    + modeSize = currentBucketSize
    + mode = currentBucketValue
    + }
    + }
    + const medianIndex = Math.floor(count / 2)
    + reductionResult.count = count
    + reductionResult.sum = sum
    + reductionResult.median = arredianIndex]
    + reductionResult.mean = sum / count
    + reductionResult.min = min
    + reductionResult.max = max
    + reductionResult.range = max - min
    + reductionResult.mode = mode
    + reductionResult.modeSize = modeSize
    + if (col.isString()) {
    + reductionResult.sum = undefined
    + reductionResult.mean = undefined
    + } else if (col.isTemporal()) reductionResult.sum = undefined
    + reductionResult.deciles = {}
    + const deciles = [10, 20, 30, 40, 50, 60, 70, 80, 90, 99, 100]
    + deciles.forEach((decile) => {
    + let index = Math.floor(count * (decile / 100))
    + index = index === count ? index - 1 : index
    + reductionResult.deciles[decile] = arr[index]
    + })
    + return reductionResult
    + }
    + static _getColumnProbabilities(name, sample) {
    + // Assume data is trimmed.
    + const sampleType = typeof sample
    + const sampleStringLength = sample !== undefined ? sample.toString().length : 0
    + const guesses = {}
    + guesses.number = 0.5
    + guesses.date = 0.25
    + guesses.string = 0.75
    + guesses.feet = 0.01 // 5'11"
    + guesses.object = 0.1
    + guesses.boolean = 0.02
    + const isDate = sample instanceof Date
    + const isNumber = !isNaN(parseFloat(sample)) || Column.getPrimitiveTypeByName("usd").getProbForColumnSpecimen(sample)
    + if (sampleType === "object") guesses.object = 0.9
    + if (sample === true || sample === false) guesses.boolean = 0.96
    + if (name.match(/(team|name|link|image|description|permalink|title|label|status|thumb|ip|useragent)/i)) guesses.string = 0.95
    + if (name.match(/(gender|region|category|group|section|sector|field)/i)) guesses.string = 0.95
    + if (name.match(/(height|length)/i)) {
    + if (sample.toString().match(/[0-9]+(\'|\-)[0-9\.]+/) && Column.getPrimitiveTypeByName("feet").getProbForColumnSpecimen(sample)) guesses.feet = 0.97
    + }
    + if (isNumber) guesses.number = 0.8
    + else guesses.number = 0.1
    + const usdGuess = Column.getPrimitiveTypeByName("usd").getProbForColumnSpecimen(sample)
    + if (usdGuess || (!isNaN(sample) && name.match(/^(price|income|cost|revenue|budget|profit|amount|balance)$/i))) guesses.usd = 0.99
    + if (isNumber && name.match(/(year|born)/i) && sampleStringLength === 4) guesses.year = 0.99
    + if (isDate && name.match(/(year|born)/i)) guesses.year = 0.99
    + if (isNumber && name.match(/(time|second|created|edited)/i) && sampleStringLength === 10) guesses.second = 0.99
    + if (isNumber && name.match(/(time|second)/i) && sampleStringLength === 13) guesses.millisecond = 0.99
    + const isValidDate = Column.getPrimitiveTypeByName("date").getProbForColumnSpecimen(sample)
    + if (name.match(/(year|date|dob|birthday|day|month|time|birthdate|utc)/i) && isValidDate) guesses.date = 0.98
    + else if (isValidDate && sampleType === "string" && sample.includes("/")) guesses.date = 0.81
    + if (sampleType === "string" && sampleStringLength > 100) guesses.string = 0.98
    + return guesses
    + }
    + _inferType() {
    + const columnObj = this._getColDefObject()
    + const sample = this._getFirstNonEmptyValueFromSampleSet()
    + if (columnObj && columnObj.type && Column.getPrimitiveTypeByName(columnObj.type)) return Column.getPrimitiveTypeByName(columnObj.type)
    + const guesses = Column._getColumnProbabilities(this.getColumnName(), this._getFirstNonEmptyValueFromSampleSet())
    + let max = 0
    + let bestGuess = null
    + for (let typeScore in guesses) {
    + if (guesses[typeScore] > max) {
    + max = guesses[typeScore]
    + bestGuess = typeScore
    + }
    + }
    + if (bestGuess === "number" && typeof sample === "string") {
    + if (sample.match(",")) bestGuess = "numberString"
    + }
    + if (bestGuess === "date" && typeof sample === "string") {
    + if (Column.getPrimitiveTypeByName("day").getProbForColumnSpecimen(sample)) bestGuess = "day"
    + }
    + return Column.getPrimitiveTypeByName(bestGuess)
    + }
    + // Note: If it returns a string removes spaces
    + static convertValueToNumeric(value, sourceType, destinationType, mathFn) {
    + const destType = this.getPrimitiveTypeByName(destinationType)
    + if (value === undefined || !destType || value === "") return ""
    + const conversionFn = this._getConversionFn(sourceType, destinationType, value)
    + const res = conversionFn(value)
    + if (mathFn) return mathFn(res)
    + return res
    + }
    + static _getConversionFn(sourceType, destinationType, value) {
    + const sourceCol = this.getPrimitiveTypeByName(sourceType)
    + const destinationCol = this.getPrimitiveTypeByName(destinationType)
    + if (!sourceCol || !destinationCol) return destinationCol.fromStringToNumeric
    + if (destinationCol.isTemporal() && sourceCol.isTemporal()) return (val) => destinationCol.fromDateToNumeric(sourceCol._fromStringToDate(val))
    + return destinationCol.fromStringToNumeric
    + }
    + }
    + const PrimitiveTypes = {
    + AbstractPrimitiveType,
    + BooleanType,
    + ObjectType,
    + USD,
    + NumberCol,
    + NumberString,
    + Feet,
    + IntType,
    + UrlCol,
    + HTMLCol,
    + DirCol,
    + PathCol,
    + TextCol,
    + StringCol,
    + AbstractTemporal,
    + MilliSecond,
    + Second,
    + DateCol,
    + Day,
    + Month,
    + MonthDay,
    + Week,
    + Hour,
    + Minute,
    + Year,
    + HourMinute,
    + CodeCol,
    + }
    + window.Column = Column
    + window.PrimitiveTypes = PrimitiveTypes
    + //onsave jtree build produce jtable.browser.js
    + //onsave jtree build produce jtable.node.js
    + class Row {
    + constructor(sourceObject = {}, table) {
    + this._puid = this._getUniqueId()
    + this._sourceObject = sourceObject
    + this._table = table
    + }
    + _getUniqueId() {
    + Row._uniqueId++
    + return Row._uniqueId
    + }
    + destroy() {}
    + async destroyRow() {}
    + getAsArray(headerRow) {
    + const obj = this.rowToObjectWithOnlyNativeJavascriptTypes()
    + return headerRow.map((col) => obj[col])
    + }
    + getRowSourceObject() {
    + return this._sourceObject
    + }
    + toVector() {
    + return Object.values(this.rowToObjectWithOnlyNativeJavascriptTypes())
    + }
    + // todo: rowToObjectWithOnlyNativeJavascriptTypes method? Its numerics where we need and strings where we need.
    + _parseIntoObjectWithOnlyNativeJavascriptTypes() {
    + const columns = this._table.getColumnsMap()
    + const typedNode = {}
    + Object.keys(columns).forEach((colName) => {
    + typedNode[colName] = this._getRowValueFromSourceColOrOriginalCol(colName)
    + })
    + return typedNode
    + }
    + // why from source col? if we always copy, we shouldnt need that, correct? perhaps have an audit array of all operations on a row?
    + _getRowValueFromSourceColOrOriginalCol(colName) {
    + const columns = this._table.getColumnsMap()
    + const destColumn = columns[colName]
    + const sourceColName = destColumn._getSourceColumnName()
    + const sourceCol = columns[sourceColName]
    + // only use source if we still have access to it
    + const val =
    + sourceColName && sourceCol
    + ? this._getRowValueFromOriginalOrSource(sourceColName, sourceCol.getPrimitiveTypeName(), destColumn.getPrimitiveTypeName())
    + : this.getRowOriginalValue(colName)
    + const res = destColumn.getPrimitiveTypeObj().getAsNativeJavascriptType(val)
    + const mathFn = destColumn.getMathFn()
    + if (mathFn) return mathFn(res)
    + return res
    + }
    + _getRowValueFromOriginalOrSource(sourceColName, sourceColType, destType) {
    + return Column.convertValueToNumeric(this.getRowOriginalValue(sourceColName), sourceColType, destType)
    + }
    + rowToObjectWithOnlyNativeJavascriptTypes() {
    + if (!this._objectWithOnlyNativeJavascriptTypes) this._objectWithOnlyNativeJavascriptTypes = this._parseIntoObjectWithOnlyNativeJavascriptTypes()
    + return this._objectWithOnlyNativeJavascriptTypes
    + }
    + getRowKeys() {
    + return Object.keys(this.getRowSourceObject())
    + }
    + getFirstValue() {
    + return this.getRowOriginalValue(this.getRowKeys()[0])
    + }
    + // todo: get values from source/virtual columns
    + getRowOriginalValue(column) {
    + const value = this.getRowSourceObject()[column]
    + return value === null ? "" : value
    + }
    + getRowHtmlSafeValue(columnName) {
    + const val = this.getRowOriginalValue(columnName)
    + return val === undefined ? "" : jtree.Utils.stripHtml(val.toString()).toString() // todo: cache this?
    + }
    + getHoverTitle() {
    + return encodeURIComponent(this.rowToString().replace(/\n/g, " "))
    + }
    + getPuid() {
    + return this._puid
    + }
    + rowToString() {
    + return JSON.stringify(this.getRowSourceObject(), null, 2)
    + }
    + }
    + Row._uniqueId = 0
    + window.Row = Row
    + //onsave jtree build produce jtable.browser.js
    + //onsave jtree build produce jtable.node.js
    + var TableParserIds
    + ;(function (TableParserIds) {
    + TableParserIds["csv"] = "csv"
    + TableParserIds["ssv"] = "ssv"
    + TableParserIds["psv"] = "psv"
    + TableParserIds["tsv"] = "tsv"
    + TableParserIds["xml"] = "xml"
    + TableParserIds["html"] = "html"
    + TableParserIds["spaced"] = "spaced"
    + TableParserIds["tree"] = "tree"
    + TableParserIds["treeRows"] = "treeRows"
    + TableParserIds["sections"] = "sections"
    + TableParserIds["txt"] = "txt"
    + TableParserIds["list"] = "list"
    + TableParserIds["text"] = "text"
    + TableParserIds["jsonVector"] = "jsonVector"
    + TableParserIds["json"] = "json"
    + TableParserIds["jsonDataTableWithHeader"] = "jsonDataTableWithHeader"
    + TableParserIds["jsonMap"] = "jsonMap"
    + TableParserIds["jsonCounts"] = "jsonCounts"
    + })(TableParserIds || (TableParserIds = {}))
    + // todo: detect mixed format, like a csv file with a header. and then suggest ignore that part, or splitting it out?
    + // maybe we could split a string into sections, and say "we've detected 3 sections, which one do you want to use"?
    + // todo: split csv into normal csv and advanced delimited.
    + // todo: allow for metadata like filename and filetype header
    + class RowStringSpecimen {
    + constructor(str) {
    + const trimmedStr = str.trim()
    + const lines = trimmedStr.split(/\n/g)
    + const firstLine = lines[0]
    + const strCount = (str, reg) => (str.match(reg) || []).length
    + // todo: do these things lazily.
    + this.trimmedStr = trimmedStr
    + this.lines = lines
    + this.firstLine = firstLine
    + this.lineCount = lines.length
    + this.indentedLineCount = strCount(trimmedStr, /\n /g)
    + this.blankLineCount = strCount(trimmedStr, /\n\n/g)
    + this.commaCount = strCount(trimmedStr, /\,/g)
    + this.tabCount = strCount(trimmedStr, /\t/g)
    + this.verticalBarCount = strCount(trimmedStr, /\|/g)
    + this.firstLineCommaCount = strCount(firstLine, /\,/g)
    + this.firstLineTabCount = strCount(firstLine, /\t/g)
    + this.firstLineSpaceCount = strCount(firstLine, / /g)
    + this.firstLineVerticalBarCount = strCount(firstLine, /\|/g)
    + }
    + getParsedJsonAttemptResult() {
    + if (this._parsedJsonObject) return this._parsedJsonObject
    + try {
    + this._parsedJsonObject = { ok: true, result: JSON.parse(this.trimmedStr) }
    + } catch (err) {
    + this._parsedJsonObject = { ok: false }
    + }
    + return this._parsedJsonObject
    + }
    + }
    + class AbstractTableParser {
    + isNodeJs() {
    + return typeof exports !== "undefined"
    + }
    + }
    + class AbstractJsonParser extends AbstractTableParser {
    + getParserId() {
    + return TableParserIds.json
    + }
    + getProbForRowSpecimen(specimen) {
    + return 0
    + }
    + getExample() {
    + return JSON.stringify([
    + { name: "joe", age: 2 },
    + { name: "mike", age: 4 },
    + ])
    + }
    + _parseTableInputsFromString(str) {
    + const obj = JSON.parse(str)
    + return { rows: obj instanceof Array ? obj : [obj] }
    + }
    + }
    + class JsonParser extends AbstractJsonParser {}
    + class AbstractJsonArrayParser extends AbstractJsonParser {
    + getExample() {
    + return JSON.stringify([
    + { name: "jane", age: 33 },
    + { name: "bill", age: 25 },
    + ])
    + }
    + getProbForRowSpecimen(specimen) {
    + const str = specimen.trimmedStr
    + if (str.match(/^\s*\[/) && str.match(/\]\s*$/)) return 0.98
    + return 0
    + }
    + }
    + class JsonArrayParser extends AbstractJsonArrayParser {}
    + class JsonDataTableWithHeaderParser extends AbstractJsonArrayParser {
    + getExample() {
    + return JSON.stringify([
    + ["country", "income", "health", "population"],
    + ["Afghanistan", 1925, "57.63", 32526562],
    + ["Albania", 10620, "76", 2896679],
    + ])
    + }
    + _parseTableInputsFromString(str) {
    + return { rows: jtree.Utils.javascriptTableWithHeaderRowToObjects(JSON.parse(str)) }
    + }
    + getParserId() {
    + return TableParserIds.jsonDataTableWithHeader
    + }
    + getProbForRowSpecimen(specimen) {
    + const result = specimen.getParsedJsonAttemptResult()
    + if (!result.ok) return 0
    + if (JsonDataTableWithHeaderParser.isJavaScriptDataTable(result.result)) return 0.99
    + return 0.001
    + }
    + static isJavaScriptDataTable(obj) {
    + const isAnArray = obj instanceof Array
    + if (!isAnArray) return false
    + const isAnArrayOfArrays = obj.every((row) => row instanceof Array)
    + if (!isAnArrayOfArrays) return false
    + if (obj.length < 3) return false
    + const firstRowTypes = obj[0].map((item) => typeof item === "string").join(" ")
    + const secondRowTypes = obj[1].map((item) => typeof item === "string").join(" ")
    + const thirdRowTypes = obj[2].map((item) => typeof item === "string").join(" ")
    + const firstRowIsJustStrings = !firstRowTypes.replace(/true/g, "").trim()
    + if (secondRowTypes === thirdRowTypes && secondRowTypes !== firstRowTypes && firstRowIsJustStrings) return true
    + return false
    + }
    + }
    + class AbstractJsonObjectParser extends AbstractJsonParser {
    + getProbForRowSpecimen(specimen) {
    + const str = specimen.trimmedStr
    + if (str.match(/^\s*\{/) && str.match(/\}\s*$/)) return 0.99
    + return 0
    + }
    + }
    + class JsonObjectParser extends AbstractJsonObjectParser {}
    + // formerley flatobject
    + class JsonMapParser extends AbstractJsonObjectParser {
    + getExample() {
    + return JSON.stringify({ person1: { name: "joe", age: 2 }, person2: { name: "mike", age: 4 } })
    + }
    + getParserId() {
    + return TableParserIds.jsonMap
    + }
    + _parseTableInputsFromString(str) {
    + // todo: should we preserve keys?
    + return { rows: Object.values(JSON.parse(str)) }
    + }
    + }
    + // formerly flatarray
    + class JsonVectorParser extends AbstractJsonArrayParser {
    + getExample() {
    + return JSON.stringify([23, 32, 41])
    + }
    + getParserId() {
    + return TableParserIds.jsonVector
    + }
    + getProbForRowSpecimen(specimen) {
    + const result = specimen.getParsedJsonAttemptResult()
    + if (!result.ok) return 0
    + if (!(result.result instanceof Array)) return 0
    + return result.result.filter((item) => item && typeof item === "object" && item.hasOwnProperty).length === 0 ? 1 : 0
    + return 0
    + }
    + _parseTableInputsFromString(str) {
    + return {
    + rows: JSON.parse(str).map((num) => {
    + return { value: num }
    + }),
    + }
    + }
    + }
    + class JsonCountMapParser extends AbstractJsonObjectParser {
    + getParserId() {
    + return TableParserIds.jsonCounts
    + }
    + getProbForRowSpecimen(specimen) {
    + const result = specimen.getParsedJsonAttemptResult()
    + if (!result.ok) return 0
    + const keys = Object.keys(result.result)
    + if (keys.length < 2) return 0
    + return !keys.some((key) => typeof result.result[key] !== "number") ? 1 : 0
    + return 0
    + }
    + getExample() {
    + return JSON.stringify({ h1: 10, h2: 5, h3: 2 })
    + }
    + _parseTableInputsFromString(str) {
    + const obj = JSON.parse(str)
    + return {
    + rows: Object.keys(obj).map((key) => {
    + return {
    + name: key,
    + count: obj[key],
    + }
    + }),
    + }
    + }
    + }
    + // todo: remove?
    + class AbstractJTreeTableParser extends AbstractTableParser {
    + _parseTableInputsFromString(str) {
    + return {
    + rows: this._parseTrees(str)
    + .filter((node) => node.length)
    + .map((node) => node.toObject()),
    + }
    + }
    + _parseTrees(str) {
    + return []
    + }
    + }
    + class CsvParser extends AbstractJTreeTableParser {
    + getExample() {
    + return `name,age,height
    + john,12,50`
    + }
    + _parseTrees(str) {
    + return jtree.TreeNode.fromCsv(str)
    + }
    + getProbForRowSpecimen(specimen) {
    + if (!specimen.firstLineCommaCount) return 0
    + if (specimen.blankLineCount) return 0.05
    + return 0.49
    + }
    + getParserId() {
    + return TableParserIds.csv
    + }
    + }
    + class TsvParser extends AbstractJTreeTableParser {
    + getExample() {
    + return `name\tage\theight
    + john\t12\t50`
    + }
    + _parseTrees(str) {
    + return jtree.TreeNode.fromTsv(str)
    + }
    + getProbForRowSpecimen(specimen) {
    + if (!specimen.firstLineTabCount) return 0
    + else if (specimen.tabCount > 5) return 0.9
    + return 0.25
    + }
    + getParserId() {
    + return TableParserIds.tsv
    + }
    + }
    + class PsvParser extends AbstractJTreeTableParser {
    + getParserId() {
    + return TableParserIds.psv
    + }
    + getExample() {
    + return `name|age
    + mike|33`
    + }
    + _parseTrees(str) {
    + return jtree.TreeNode.fromDelimited(str, "|", '"')
    + }
    + getProbForRowSpecimen(specimen) {
    + // vertical bar separated file
    + if (!specimen.firstLineVerticalBarCount) return 0
    + else if (specimen.verticalBarCount >= specimen.lineCount) return 0.8
    + return 0.01
    + }
    + }
    + class SsvParser extends AbstractJTreeTableParser {
    + getExample() {
    + return `name age height
    + john 12 50`
    + }
    + getParserId() {
    + return TableParserIds.ssv
    + }
    + _parseTrees(str) {
    + return jtree.TreeNode.fromSsv(str)
    + }
    + getProbForRowSpecimen(specimen) {
    + if (!specimen.firstLineSpaceCount) return 0
    + if (specimen.blankLineCount) return 0.05
    + return 0.11
    + }
    + }
    + class XmlParser extends AbstractJTreeTableParser {
    + getProbForRowSpecimen(specimen) {
    + return specimen.trimmedStr.match(/^ *\
    + }
    + getExample() {
    + return `
    + bob32`
    + }
    + getParserId() {
    + return TableParserIds.xml
    + }
    + _parseTrees(str) {
    + // todo: fix this! Create an XML Tree Language
    + if (this.isNodeJs()) return new jtree.TreeNode(str)
    + return jtree.TreeNode.fromXml(str)
    + }
    + }
    + class HtmlParser extends AbstractJTreeTableParser {
    + getProbForRowSpecimen(specimen) {
    + return specimen.trimmedStr.match(/^(\<\!doctype html\>|\
    + }
    + getExample() {
    + return `
    +
    + bam`
    + }
    + getParserId() {
    + return TableParserIds.html
    + }
    + _parseTrees(str) {
    + if (this.isNodeJs()) return new jtree.TreeNode(str)
    + return jtree.TreeNode.fromXml(str)
    + }
    + }
    + class TreeRowsParser extends AbstractJTreeTableParser {
    + getExample() {
    + return `person
    + name john
    + age 12
    + height 50`
    + }
    + _parseTableInputsFromString(str) {
    + // todo: get columns on first pass.
    + const rows = new jtree.TreeNode(str)
    + return {
    + rows: rows.map((node) => node.toObject()),
    + columnDefinitions: rows.getColumnNames().map((name) => {
    + return { name: name }
    + }),
    + }
    + }
    + getProbForRowSpecimen(specimen) {
    + if (specimen.indentedLineCount < 1) return 0
    + return 0.1
    + }
    + getParserId() {
    + return TableParserIds.treeRows
    + }
    + }
    + class TreeParser extends AbstractJTreeTableParser {
    + getExample() {
    + return `country
    + name USA
    + state
    + name MA
    + city
    + name Brockton`
    + }
    + _parseTrees(str) {
    + // todo: add tests. Detected value(s) or undefined subtrees, treating as object.
    + const newTree = new jtree.TreeNode()
    + newTree.pushContentAndChildren(undefined, str instanceof jtree.TreeNode ? str : new jtree.TreeNode(str))
    + return newTree
    + }
    + getProbForRowSpecimen(specimen) {
    + return 0
    + }
    + getParserId() {
    + return TableParserIds.tree
    + }
    + }
    + class SpacedParser extends AbstractTableParser {
    + getExample() {
    + return `name john
    + age 12
    + name mary
    + age 20`
    + }
    + getParserId() {
    + return TableParserIds.spaced
    + }
    + getProbForRowSpecimen(specimen) {
    + if (specimen.blankLineCount > 10) return 0.95
    + return 0.05
    + }
    + _parseTableInputsFromString(str) {
    + // todo: clean this up. it looks like this is just trees, but not indented, with a newline as a delimiter.
    + const headerBreak = str.indexOf("\n\n")
    + const header = str.substr(0, headerBreak)
    + let names = header.split(/\n/g)
    + const rest = str
    + .substr(headerBreak + 2)
    + .replace(/\n\n/g, "\n")
    + .trim()
    + .split("\n")
    + const nodeCount = names.length
    + const lineCount = rest.length
    + const rows = []
    + // todo: should we do this here?
    + names = names.map((name) => name.replace(/ /g, ""))
    + for (let lineNumber = 0; lineNumber < lineCount; lineNumber = lineNumber + nodeCount) {
    + const obj = {}
    + names.forEach((col, index) => {
    + obj[col] = rest[lineNumber + index].trim()
    + })
    + rows.push(obj)
    + }
    + return { rows: rows }
    + }
    + }
    + class SectionsParser extends AbstractTableParser {
    + getExample() {
    + return `name
    + age
    - request.Response = Response;
    - /**
    - * Initialize a new `Request` with the given `method` and `url`.
    - *
    - * @param {String} method
    - * @param {String} url
    - * @api public
    - */
    + john
    + 12
    - function Request(method, url) {
    - var self = this;
    - this._query = this._query || [];
    - this.method = method;
    - this.url = url;
    - this.header = {}; // preserves header name case
    -
    - this._header = {}; // coerces header names to lowercase
    -
    - this.on('end', function () {
    - var err = null;
    - var res = null;
    -
    - try {
    - res = new Response(self);
    - } catch (err2) {
    - err = new Error('Parser is unable to parse the response');
    - err.parse = true;
    - err.original = err2; // issue #675: return the raw response if the response parsing fails
    -
    - if (self.xhr) {
    - // ie9 doesn't have 'response' property
    - err.rawResponse = typeof self.xhr.responseType === 'undefined' ? self.xhr.responseText : self.xhr.response; // issue #876: return the http status code if the response parsing fails
    -
    - err.status = self.xhr.status ? self.xhr.status : null;
    - err.statusCode = err.status; // backwards-compat only
    - } else {
    - err.rawResponse = null;
    - err.status = null;
    - }
    -
    - return self.callback(err);
    - }
    -
    - self.emit('response', res);
    - var new_err;
    -
    - try {
    - if (!self._isResponseOK(res)) {
    - new_err = new Error(res.statusText || 'Unsuccessful HTTP response');
    - }
    - } catch (err2) {
    - new_err = err2; // ok() callback can throw
    - } // #1000 don't catch errors from the callback to avoid double calling it
    -
    -
    - if (new_err) {
    - new_err.original = err;
    - new_err.response = res;
    - new_err.status = res.status;
    - self.callback(new_err, res);
    - } else {
    - self.callback(null, res);
    - }
    - });
    + mary
    + 20`
    + }
    + getProbForRowSpecimen() {
    + return 0
    + }
    + getParserId() {
    + return TableParserIds.sections
    + }
    + _parseTableInputsFromString(str) {
    + const firstDoubleNewline = str.indexOf("\n\n")
    + const tiles = [str.slice(0, firstDoubleNewline), str.slice(firstDoubleNewline + 1)]
    + const header = tiles.shift()
    + const names = header.split(/\n/g)
    + const length = names.length
    + const lines = tiles[0].trim().split(/\n/g)
    + const lineCount = lines.length
    + const rowCount = lineCount / length
    + const rows = []
    + for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
    + const startLine = rowIndex * length
    + const values = lines.slice(startLine, startLine + length)
    + const obj = {}
    + names.forEach((name, colIndex) => (obj[name] = values[colIndex]))
    + rows.push(obj)
    + }
    + return { rows: rows }
    + }
    - /**
    - * Mixin `Emitter` and `RequestBase`.
    - */
    - // eslint-disable-next-line new-cap
    -
    -
    - Emitter(Request.prototype); // eslint-disable-next-line new-cap
    -
    - RequestBase(Request.prototype);
    - /**
    - * Set Content-Type to `type`, mapping values from `request.types`.
    - *
    - * Examples:
    - *
    - * superagent.types.xml = 'application/xml';
    - *
    - * request.post('/')
    - * .type('xml')
    - * .send(xmlstring)
    - * .end(callback);
    - *
    - * request.post('/')
    - * .type('application/xml')
    - * .send(xmlstring)
    - * .end(callback);
    - *
    - * @param {String} type
    - * @return {Request} for chaining
    - * @api public
    - */
    -
    - Request.prototype.type = function (type) {
    - this.set('Content-Type', request.types[type] || type);
    - return this;
    - };
    - /**
    - * Set Accept to `type`, mapping values from `request.types`.
    - *
    - * Examples:
    - *
    - * superagent.types.json = 'application/json';
    - *
    - * request.get('/agent')
    - * .accept('json')
    - * .end(callback);
    - *
    - * request.get('/agent')
    - * .accept('application/json')
    - * .end(callback);
    - *
    - * @param {String} accept
    - * @return {Request} for chaining
    - * @api public
    - */
    -
    + class ListParser extends AbstractTableParser {
    + getExample() {
    + return `john doe
    + frank jones`
    + }
    + getProbForRowSpecimen() {
    + return 0
    + }
    + getParserId() {
    + return TableParserIds.list
    + }
    + _parseTableInputsFromString(str) {
    + return {
    + rows: str.split(/\n/g).map((line, index) => {
    + return {
    + index: index,
    + name: line,
    + }
    + }),
    + }
    + }
    + }
    + class TextListParser extends ListParser {
    + getParserId() {
    + return TableParserIds.txt
    + }
    + }
    + class TextParser extends AbstractTableParser {
    + getParserId() {
    + return TableParserIds.text
    + }
    + getExample() {
    + return "hello world"
    + }
    + getProbForRowSpecimen(specimen) {
    + if (specimen.blankLineCount) return 0.12
    + return 0.05
    + }
    + _parseTableInputsFromString(str) {
    + return { rows: [{ text: str }] }
    + }
    + }
    + class TableParser {
    + constructor() {
    + this._parsers = [
    + new CsvParser(),
    + new TsvParser(),
    + new SsvParser(),
    + new PsvParser(),
    + new TreeRowsParser(),
    + new TreeParser(),
    + new XmlParser(),
    + new HtmlParser(),
    + new TextParser(),
    + new SectionsParser(),
    + new SpacedParser(),
    + new ListParser(),
    + new TextListParser(),
    + new JsonParser(),
    + new JsonArrayParser(),
    + new JsonDataTableWithHeaderParser(),
    + new JsonVectorParser(),
    + new JsonMapParser(),
    + new JsonCountMapParser(),
    + ]
    + this._parserMap = {}
    + this._parsers.forEach((parser) => {
    + const name = parser.getParserId()
    + if (!name) return // only allow leafs to be used as names?
    + this._parserMap[name] = parser
    + })
    + }
    + getAllParsers() {
    + return this._getParsersArray()
    + }
    + getAllTableParserIds() {
    + return Object.keys(this._getParserMap())
    + }
    + getExample(parserId) {
    + return this._getParser(parserId).getExample()
    + }
    + _getParser(parserId) {
    + const options = this._getParserMap()
    + return options[parserId] || options.text // todo: surface an error.
    + }
    + _getParserMap() {
    + return this._parserMap
    + }
    + _getParsersArray() {
    + return this._parsers
    + }
    + // todo: remove this?
    + parseTableInputsFromObject(data, parserId) {
    + if (data instanceof Array) {
    + if (JsonDataTableWithHeaderParser.isJavaScriptDataTable(data)) return { rows: jtree.Utils.javascriptTableWithHeaderRowToObjects(data) }
    + // test to see if it's primitives
    + if (typeof data[0] === "object") return { rows: data }
    + return { rows: data.map((row) => (typeof row === "object" ? row : { value: row })) }
    + } else if (parserId === TableParserIds.jsonMap) return { rows: Object.values(data) }
    + return { rows: [data] }
    + }
    + // todo: should this be inferAndParse? or 2 methods? parse and inferAndParse?
    + parseTableInputsFromString(str = "", parserId) {
    + str = str.trim() // Remove empty lines at end of string, which seem to be common.
    + if (!str) return { rows: [] }
    + parserId = parserId || this.guessTableParserId(str)
    + try {
    + return this._getParser(parserId)._parseTableInputsFromString(str)
    + } catch (err) {
    + console.error(err)
    + const snippet = str.substr(0, 30).replace(/[\n\r]/g, " ")
    + throw new Error(`Failed parsing string '${snippet}...' using parser '${parserId}'`)
    + }
    + }
    + guessProbabilitiesForAllTableParsers(str) {
    + const parsers = this._getParsersArray()
    + const length = parsers.length
    + const probabilities = {}
    + const specimen = new RowStringSpecimen(str)
    + for (let index = 0; index < parsers.length; index++) {
    + const parser = parsers[index]
    + const probability = parser.getProbForRowSpecimen(specimen)
    + const name = parser.getParserId()
    + if (probability === 1) {
    + const exact = {}
    + exact[name] = 1
    + return exact
    + }
    + probabilities[name] = probability
    + }
    + return probabilities
    + }
    + guessTableParserId(str) {
    + const probabilities = this.guessProbabilitiesForAllTableParsers(str)
    + let maxScore = 0
    + let bestGuess = null
    + for (let option in probabilities) {
    + if (probabilities[option] > maxScore) {
    + maxScore = probabilities[option]
    + bestGuess = option
    + }
    + }
    + return bestGuess
    + }
    + }
    + window.TableParser = TableParser
    + const DummyDataSets = {
    + flowPrograms: [
    + ["filename", "bytes", "link"],
    + [
    + "hello.flow",
    + `samples.iris
    + tables.basic`,
    + "",
    + ],
    + ],
    + amazonPurchases: [
    + ["OrderDate", "Title", "Category", "ItemTotal"],
    + [1329386400000, "3D Math Primer for Graphics and Game Development (Wordware Game Math Library)", "Paperback", "26.2"],
    + [1261735200000, "A Mathematician Reads the Newspaper", "Paperback", "1.19"],
    + [1447840800000, "A Most Incomprehensible Thing: Notes Towards a Very Gentle Introduction to the Mathematics of Relativity", "Paperback", "14.63"],
    + [1464429600000, "From Mathematics to Generic Programming", "Paperback", "34.37"],
    + [1268215200000, "Innumeracy: Mathematical Illiteracy and Its Consequences", "Paperback", "9.89"],
    + [1268215200000, "Irreligion: A Mathematician Explains Why the Arguments for God Just Don't Add Up", "Paperback", "9.89"],
    + [1379844000000, "Mathematics and the Imagination", "Paperback", "5.3"],
    + [1410688800000, "Medical Math (Laminated Reference Guide; Quick Study Academic)", "Pamphlet", "3.78"],
    + [1268215200000, "Once Upon A Number: The Hidden Mathematical Logic Of Stories", "Paperback", "14.35"],
    + [1408528800000, "The Language of Mathematics: Making the Invisible Visible", "Paperback", "18.37"],
    + ],
    + waterBill: [
    + ["Amount", "PaidOn", "Gallons"],
    + ["$64.86", "1/10/2018", 2087],
    + ["$73.32", "1/28/2018", 2451],
    + ["$62.65", "2/26/2018", 1968],
    + ["$71.51", "3/25/2018", 2365],
    + ["$65.03", "4/23/2018", 2075],
    + ["$81.39", "5/15/2018", 2757],
    + ["$65.01", "6/15/2018", 2047],
    + ["$93.09", "7/10/2018", 3051],
    + ["$196.58", "8/25/2018", 7309],
    + ["$130.68", "9/10/2018", 4597],
    + ["$55.03", "10/14/2018", 1484],
    + ["$63.44", "11/7/2018", 1967],
    + ["$71.88", "12/12/2018", 2335],
    + ["$53.18", "2/3/2019", 1483],
    + ["$52.05", "3/8/2019", 1429],
    + ["$54.73", "4/28/2019", 1544],
    + ],
    + gapMinder: [
    + ["country", "income", "health", "population"],
    + ["Afghanistan", 1925, "57.63", 32526562],
    + ["Albania", 10620, "76", 2896679],
    + ["Algeria", 13434, "76.5", 39666519],
    + ["Andorra", 46577, "84.1", 70473],
    + ["Angola", 7615, "61", 25021974],
    + ["Antigua and Barbuda", 21049, "75.2", 91818],
    + ["Argentina", 17344, "76.2", 43416755],
    + ["Armenia", 7763, "74.4", 3017712],
    + ["Australia", 44056, "81.8", 23968973],
    + ["Austria", 44401, "81", 8544586],
    + ["Azerbaijan", 16986, "72.9", 9753968],
    + ["Bahamas", 22818, "72.3", 388019],
    + ["Bahrain", 44138, "79.2", 1377237],
    + ["Bangladesh", 3161, "70.1", 160995642],
    + ["Barbados", 12984, "75.8", 284215],
    + ["Belarus", 17415, "70.4", 9495826],
    + ["Belgium", 41240, "80.4", 11299192],
    + ["Belize", 8501, "70", 359287],
    + ["Benin", 1830, "65.5", 10879829],
    + ["Bhutan", 7983, "70.2", 774830],
    + ["Bolivia", 6295, "72.3", 10724705],
    + ["Bosnia and Herzegovina", 9833, "77.9", 3810416],
    + ["Botswana", 17196, "66.4", 2262485],
    + ["Brazil", 15441, "75.6", 207847528],
    + ["Brunei", 73003, "78.7", 423188],
    + ["Bulgaria", 16371, "74.9", 7149787],
    + ["Burkina Faso", 1654, "62.8", 18105570],
    + ["Burundi", 777, "60.4", 11178921],
    + ["Cambodia", 3267, "68.4", 15577899],
    + ["Cameroon", 2897, "59.5", 23344179],
    + ["Canada", 43294, "81.7", 35939927],
    + ["Cape Verde", 6514, "74.6", 520502],
    + ["Central African Republic", 599, "53.8", 4900274],
    + ["Chad", 2191, "57.7", 14037472],
    + ["Chile", 22465, "79.3", 17948141],
    + ["China", 13334, "76.9", 1376048943],
    + ["Colombia", 12761, "75.8", 48228704],
    + ["Comoros", 1472, "64.1", 788474],
    + ["Congo, Dem. Rep.", 809, "58.3", 77266814],
    + ["Congo, Rep.", 6220, "61.9", 4620330],
    + ["Costa Rica", 14132, "80", 4807850],
    + ["Cote d'Ivoire", 3491, "60.33", 22701556],
    + ["Croatia", 20260, "78", 4240317],
    + ["Cuba", 21291, "78.5", 11389562],
    + ["Cyprus", 29797, "82.6", 1165300],
    + ["Czech Republic", 29437, "78.6", 10543186],
    + ["Denmark", 43495, "80.1", 5669081],
    + ["Djibouti", 3139, "64.63", 887861],
    + ["Dominica", 10503, "74.6", 72680],
    + ["Dominican Republic", 12837, "73.8", 10528391],
    + ["Ecuador", 10996, "75.2", 16144363],
    + ["Egypt", 11031, "71.3", 91508084],
    + ["El Salvador", 7776, "74.1", 6126583],
    + ["Equatorial Guinea", 31087, "60.63", 845060],
    + ["Eritrea", 1129, "62.9", 5227791],
    + ["Estonia", 26812, "76.8", 1312558],
    + ["Ethiopia", 1520, "63.6", 99390750],
    + ["Fiji", 7925, "66.3", 892145],
    + ["Finland", 38923, "80.8", 5503457],
    + ["France", 37599, "81.9", 64395345],
    + ["Gabon", 18627, "60.53", 1725292],
    + ["Gambia", 1644, "65.1", 1990924],
    + ["Georgia", 7474, "73.3", 3999812],
    + ["Germany", 44053, "81.1", 80688545],
    + ["Ghana", 4099, "65.5", 27409893],
    + ["Greece", 25430, "79.8", 10954617],
    + ["Grenada", 11593, "71.7", 106825],
    + ["Guatemala", 7279, "73.1", 16342897],
    + ["Guinea", 1225, "60.8", 12608590],
    + ["Guinea-Bissau", 1386, "53.4", 1844325],
    + ["Guyana", 6816, "64.4", 767085],
    + ["Haiti", 1710, "65.3", 10711067],
    + ["Honduras", 4270, "72.4", 8075060],
    + ["Hungary", 24200, "76.2", 9855023],
    + ["Iceland", 42182, "82.8", 329425],
    + ["India", 5903, "66.8", 1311050527],
    + ["Indonesia", 10504, "70.9", 257563815],
    + ["Iran", 15573, "78.5", 79109272],
    + ["Iraq", 14646, "72.1", 36423395],
    + ["Ireland", 47758, "80.4", 4688465],
    + ["Israel", 31590, "82.4", 8064036],
    + ["Italy", 33297, "82.1", 59797685],
    + ["Jamaica", 8606, "75.5", 2793335],
    + ["Japan", 36162, "83.5", 126573481],
    + ["Jordan", 11752, "78.3", 7594547],
    + ["Kazakhstan", 23468, "68.2", 17625226],
    + ["Kenya", 2898, "66.63", 46050302],
    + ["Kiribati", 1824, "62.4", 112423],
    + ["Kuwait", 82633, "80.7", 3892115],
    + ["Kyrgyz Republic", 3245, "69", 5939962],
    + ["Lao", 5212, "66.4", 6802023],
    + ["Latvia", 23282, "75.7", 1970503],
    + ["Lebanon", 17050, "78.5", 5850743],
    + ["Lesotho", 2598, "48.5", 2135022],
    + ["Liberia", 958, "63.9", 4503438],
    + ["Libya", 17261, "76.2", 6278438],
    + ["Lithuania", 26665, "75.4", 2878405],
    + ["Luxembourg", 88314, "81.1", 567110],
    + ["Macedonia, FYR", 12547, "77", 2078453],
    + ["Madagascar", 1400, "64.7", 24235390],
    + ["Malawi", 799, "60.22", 17215232],
    + ["Malaysia", 24320, "75.1", 30331007],
    + ["Maldives", 14408, "79.5", 363657],
    + ["Mali", 1684, "57.6", 17599694],
    + ["Malta", 30265, "82.1", 418670],
    + ["Marshall Islands", 3661, "65.1", 52993],
    + ["Mauritania", 3877, "65.7", 4067564],
    + ["Mauritius", 18350, "73.9", 1273212],
    + ["Mexico", 16850, "74.5", 127017224],
    + ["Micronesia, Fed. Sts.", 3510, "67", 104460],
    + ["Moldova", 4896, "72.7", 4068897],
    + ["Mongolia", 11819, "65.3", 2959134],
    + ["Montenegro", 14833, "75.8", 625781],
    + ["Morocco", 7319, "74.7", 34377511],
    + ["Mozambique", 1176, "56.4", 27977863],
    + ["Myanmar", 4012, "67.9", 53897154],
    + ["Namibia", 10040, "61", 2458830],
    + ["Nepal", 2352, "71.2", 28513700],
    + ["Netherlands", 45784, "80.6", 16924929],
    + ["New Zealand", 34186, "80.6", 4528526],
    + ["Nicaragua", 4712, "76.8", 6082032],
    + ["Niger", 943, "62.2", 19899120],
    + ["Nigeria", 5727, "61.33", 182201962],
    + ["North Korea", 1390, "71.4", 25155317],
    + ["Norway", 64304, "81.6", 5210967],
    + ["Oman", 48226, "75.7", 4490541],
    + ["Pakistan", 4743, "66.5", 188924874],
    + ["Panama", 20485, "78.2", 3929141],
    + ["Papua New Guinea", 2529, "60.6", 7619321],
    + ["Paraguay", 8219, "73.9", 6639123],
    + ["Peru", 11903, "77.5", 31376670],
    + ["Philippines", 6876, "70.2", 100699395],
    + ["Poland", 24787, "77.3", 38611794],
    + ["Portugal", 26437, "79.8", 10349803],
    + ["Qatar", 132877, "82", 2235355],
    + ["Romania", 19203, "76.8", 19511324],
    + ["Russia", 23038, "73.13", 143456918],
    + ["Rwanda", 1549, "66.53", 11609666],
    + ["Samoa", 5558, "72.2", 193228],
    + ["Sao Tome and Principe", 3003, "68.8", 190344],
    + ["Saudi Arabia", 52469, "78.1", 31540372],
    + ["Senegal", 2251, "66.1", 15129273],
    + ["Serbia", 12908, "78.1", 8850975],
    + ["Seychelles", 25684, "73.7", 96471],
    + ["Sierra Leone", 2085, "58.5", 6453184],
    + ["Singapore", 80794, "82.1", 5603740],
    + ["Slovak Republic", 27204, "76.4", 5426258],
    + ["Slovenia", 28550, "80.2", 2067526],
    + ["Solomon Islands", 2047, "64.1", 583591],
    + ["Somalia", 624, "58.7", 10787104],
    + ["South Africa", 12509, "63.72", 54490406],
    + ["South Korea", 34644, "80.7", 50293439],
    + ["South Sudan", 3047, "58", 12339812],
    + ["Spain", 32979, "81.7", 46121699],
    + ["Sri Lanka", 10624, "76.5", 20715010],
    + ["St. Lucia", 9997, "74.5", 184999],
    + ["St. Vincent and the Grenadines", 10435, "72.9", 109462],
    + ["Sudan", 3975, "69.5", 40234882],
    + ["Suriname", 17125, "70.5", 542975],
    + ["Swaziland", 6095, "51.5", 1286970],
    + ["Sweden", 44892, "82", 9779426],
    + ["Switzerland", 56118, "82.9", 8298663],
    + ["Syria", 4637, "70.26", 18502413],
    + ["Tajikistan", 2582, "71", 8481855],
    + ["Tanzania", 2571, "63.43", 53470420],
    + ["Thailand", 14512, "75.1", 67959359],
    + ["Timor-Leste", 2086, "72.4", 1184765],
    + ["Togo", 1433, "64.23", 7304578],
    + ["Tonga", 5069, "70.5", 106170],
    + ["Trinidad and Tobago", 30113, "71.4", 1360088],
    + ["Tunisia", 11126, "77.3", 11253554],
    + ["Turkey", 19360, "76.5", 78665830],
    + ["Turkmenistan", 15865, "67.9", 5373502],
    + ["Uganda", 1680, "60.8", 39032383],
    + ["Ukraine", 8449, "72.1", 44823765],
    + ["United Arab Emirates", 60749, "76.6", 9156963],
    + ["United Kingdom", 38225, "81.4", 64715810],
    + ["United States", 53354, "79.1", 321773631],
    + ["Uruguay", 20438, "77.3", 3431555],
    + ["Uzbekistan", 5598, "70.1", 29893488],
    + ["Vanuatu", 2912, "65", 264652],
    + ["Venezuela", 15753, "75.8", 31108083],
    + ["Vietnam", 5623, "76.5", 93447601],
    + ["West Bank and Gaza", 4319, "75.2", 4668466],
    + ["Yemen", 3887, "67.6", 26832215],
    + ["Zambia", 4034, "58.96", 16211767],
    + ["Zimbabwe", 1801, "60.01", 15602751],
    + ],
    + emojis: [
    + ["animal", "count"],
    + ["🐄", 9],
    + ["🐖", 12],
    + ["🐏", 3],
    + ],
    + telescopes: [
    + ["Name", "Type", "Url", "Location", "OperatedBy", "FundedBy"],
    + ["Hubble Space Telescope", "Space Telescope", "https://en.wikipedia.org/wiki/Hubble_Space_Telescope", "Space", "NASA", "NASA"],
    + ["LIGO Hanford", "Gravity Wave Observatory", "https://www.ligo.caltech.edu/WA", "Richland, WA, USA", "Caltech", "National Science Foundation"],
    + ["LIGO Livingston", "Gravity Wave Observatory", "https://www.ligo.caltech.edu/LA", "Livingston, LA, USA", "MIT", "National Science Foundation"],
    + [
    + "Gran Telescopio Canarias (GTC)",
    + "Astronomical Observatory",
    + "http://www.gtc.iac.es/gtc/gtc.php",
    + "La Palma, Garafía, Spain ",
    + "IAC",
    + "Observatorio Astronómico de Canarias, National Autonomous University of Mexico, University of Florida Edit this on Wikidata",
    + ],
    + [
    + "Hobby–Eberly Telescope",
    + "Astronomical Observatory",
    + "http://mcdonaldobservatory.org/research/telescopes/HET",
    + "Davis Mountains, Texas, US",
    + "Stanford University & Ludwig Maximilians University of Munich and Georg August University of Göttingen",
    + "YarCom Inc. and the Lott family ",
    + ],
    + ],
    + markdown: [
    + ["text"],
    + [
    + `# My header
    + ## My subheader
    + Hello world`,
    + ],
    + ],
    + webPages: [["name", "url"]],
    + outerSpace: [
    + ["text"],
    + [
    + `universe
    + galaxies
    + milkyWay
    + solarSystems
    + solarSystem
    + stars
    + sun
    + planets
    + mercury
    + venus
    + earth
    + moons
    + moon
    + mars
    + jupiter
    + saturn
    + uranus
    + neptune
    + pluto`,
    + ],
    + ],
    + wordCounts: [
    + ["word", "count"],
    + ["Two", 2],
    + ["roads", 2],
    + ["diverged", 2],
    + ["in", 3],
    + ["a", 3],
    + ["yellow", 1],
    + ["wood", 2],
    + ["And", 6],
    + ["sorry", 1],
    + ["I", 9],
    + ["could", 2],
    + ["not", 1],
    + ["travel", 1],
    + ["both", 2],
    + ["be", 2],
    + ["one", 3],
    + ["traveler", 1],
    + ["long", 1],
    + ["stood", 1],
    + ["looked", 1],
    + ],
    + treeProgram: [
    + ["source"],
    + [
    + `samples.iris
    + group.by Species
    + tables.basic
    + columns.first 3`,
    + ],
    + ],
    + poem: [
    + ["text"],
    + [
    + `Two roads diverged in a yellow wood,
    + And sorry I could not travel both
    + And be one traveler, long I stood
    + And looked down one as far as I could
    + To where it bent in the undergrowth;
    - Request.prototype.accept = function (type) {
    - this.set('Accept', request.types[type] || type);
    - return this;
    - };
    - /**
    - * Set Authorization field value with `user` and `pass`.
    - *
    - * @param {String} user
    - * @param {String} [pass] optional in case of using 'bearer' as type
    - * @param {Object} options with 'type' property 'auto', 'basic' or 'bearer' (default 'basic')
    - * @return {Request} for chaining
    - * @api public
    - */
    + Then took the other, as just as fair,
    + And having perhaps the better claim,
    + Because it was grassy and wanted wear;
    + Though as for that the passing there
    + Had worn them really about the same,
    + And both that morning equally lay
    + In leaves no step had trodden black.
    + Oh, I kept the first for another day!
    + Yet knowing how way leads on to way,
    + I doubted if I should ever come back.
    - Request.prototype.auth = function (user, pass, options) {
    - if (arguments.length === 1) pass = '';
    + I shall be telling this with a sigh
    + Somewhere ages and ages hence:
    + Two roads diverged in a wood, and I—
    + I took the one less traveled by,
    + And that has made all the difference.`,
    + ],
    + ],
    + playerGoals: [
    + ["PlayerGoals", "Goals"],
    + ["Player1", 11],
    + ["Player2", 2],
    + ["Player3", 2],
    + ["Player4", 2],
    + ["Player5", 7],
    + ],
    + patients: [
    + ["Patient", "Gender", "Weight"],
    + ["Patient1", "Girl", "3.31"],
    + ["Patient2", "Male", "2.8"],
    + ["Patient3", "Male", "3.7"],
    + ["Patient4", "Girl", "2.5"],
    + ["Patient5", "Girl", "2.8"],
    + ],
    + regionalMarkets: [
    + ["Location", "Parent", "Market trade volume (size)", "Market increase/decrease (color)"],
    + ["Global", null, 0, 0],
    + ["America", "Global", 0, 0],
    + ["Europe", "Global", 0, 0],
    + ["Asia", "Global", 0, 0],
    + ["Australia", "Global", 0, 0],
    + ["Africa", "Global", 0, 0],
    + ["Brazil", "America", 11, 10],
    + ["USA", "America", 52, 31],
    + ["Mexico", "America", 24, 12],
    + ["Canada", "America", 16, -23],
    + ["France", "Europe", 42, -11],
    + ["Germany", "Europe", 31, -2],
    + ["Sweden", "Europe", 22, -13],
    + ["Italy", "Europe", 17, 4],
    + ["UK", "Europe", 21, -5],
    + ["China", "Asia", 36, 4],
    + ["Japan", "Asia", 20, -12],
    + ["India", "Asia", 40, 63],
    + ["Laos", "Asia", 4, 34],
    + ["Mongolia", "Asia", 1, -5],
    + ["Israel", "Asia", 12, 24],
    + ["Iran", "Asia", 18, 13],
    + ["Pakistan", "Asia", 11, -52],
    + ["Egypt", "Africa", 21, 0],
    + ["S. Africa", "Africa", 30, 43],
    + ["Sudan", "Africa", 12, 2],
    + ["Congo", "Africa", 10, 12],
    + ["Zaire", "Africa", 8, 10],
    + ],
    + stockPrice: [
    + ["Step", "Price"],
    + [0, 0],
    + [1, 10],
    + [2, 23],
    + [3, 17],
    + [4, 18],
    + [5, 9],
    + [6, 11],
    + [7, 27],
    + [8, 33],
    + [9, 40],
    + [10, 32],
    + [11, 35],
    + [12, 30],
    + [13, 40],
    + [14, 42],
    + [15, 47],
    + [16, 44],
    + [17, 48],
    + [18, 52],
    + [19, 54],
    + [20, 42],
    + [21, 55],
    + [22, 56],
    + [23, 57],
    + [24, 60],
    + [25, 50],
    + [26, 52],
    + [27, 51],
    + [28, 49],
    + [29, 53],
    + [30, 55],
    + [31, 60],
    + [32, 61],
    + [33, 59],
    + [34, 62],
    + [35, 65],
    + [36, 62],
    + [37, 58],
    + [38, 55],
    + [39, 61],
    + [40, 64],
    + [41, 65],
    + [42, 63],
    + [43, 66],
    + [44, 67],
    + [45, 69],
    + [46, 69],
    + [47, 70],
    + [48, 72],
    + [49, 68],
    + [50, 66],
    + [51, 65],
    + [52, 67],
    + [53, 70],
    + [54, 71],
    + [55, 72],
    + [56, 73],
    + [57, 75],
    + [58, 70],
    + [59, 68],
    + [60, 64],
    + [61, 60],
    + [62, 65],
    + [63, 67],
    + [64, 68],
    + [65, 69],
    + [66, 70],
    + [67, 72],
    + [68, 75],
    + [69, 80],
    + ],
    + }
    + window.DummyDataSets = DummyDataSets
    + //onsave jtree build produce jtable.browser.js
    + //onsave jtree build produce jtable.node.js
    + class PivotTable {
    + constructor(rows, inputColumns, outputColumns) {
    + this._columns = {}
    + this._rows = rows
    + inputColumns.forEach((col) => (this._columns[col.name] = col))
    + outputColumns.forEach((col) => (this._columns[col.name] = col))
    + }
    + _getGroups(allRows, groupByColNames) {
    + const rowsInGroups = new Map()
    + allRows.forEach((row) => {
    + const groupKey = groupByColNames.map((col) => row[col].toString().replace(/ /g, "")).join(" ")
    + if (!rowsInGroups.has(groupKey)) rowsInGroups.set(groupKey, [])
    + rowsInGroups.get(groupKey).push(row)
    + })
    + return rowsInGroups
    + }
    + getNewRows(groupByCols) {
    + // make new trees
    + const rowsInGroups = this._getGroups(this._rows, groupByCols)
    + // Any column in the group should be reused by the children
    + const columns = [
    + {
    + name: "count",
    + type: "number",
    + min: 0,
    + },
    + ]
    + groupByCols.forEach((colName) => columns.push(this._columns[colName]))
    + const colsToReduce = Object.values(this._columns).filter((col) => !!col.reduction)
    + colsToReduce.forEach((col) => columns.push(col))
    + // for each group
    + const newRows = []
    + const totalGroups = rowsInGroups.size
    + for (let [groupId, group] of rowsInGroups) {
    + const firstRow = group[0]
    + const newRow = {}
    + groupByCols.forEach((col) => {
    + newRow[col] = firstRow ? firstRow[col] : 0
    + })
    + newRow.count = group.length
    + // todo: add more reductions? count, stddev, median, variance.
    + colsToReduce.forEach((col) => {
    + const sourceColName = col.source
    + const values = group.map((row) => row[sourceColName]).filter((val) => typeof val === "number" && !isNaN(val))
    + const reduction = col.reduction
    + let reducedValue = firstRow[sourceColName]
    + if (reduction === "sum") reducedValue = values.reduce((prev, current) => prev + current, 0)
    + if (reduction === "max") reducedValue = Math.max(...values)
    + if (reduction === "min") reducedValue = Math.min(...values)
    + if (reduction === "mean") reducedValue = values.reduce((prev, current) => prev + current, 0) / values.length
    + newRow[col.name] = reducedValue
    + })
    + newRows.push(newRow)
    + }
    + // todo: add tests. figure out this api better.
    + Object.values(columns).forEach((col) => {
    + // For pivot columns, remove the source and reduction info for now. Treat things as immutable.
    + delete col.source
    + delete col.reduction
    + })
    + return {
    + rows: newRows,
    + columns,
    + }
    + }
    + }
    + var ComparisonOperators
    + ;(function (ComparisonOperators) {
    + ComparisonOperators["lessThan"] = "<"
    + ComparisonOperators["greaterThan"] = ">"
    + ComparisonOperators["lessThanOrEqual"] = "<="
    + ComparisonOperators["greaterThanOrEqual"] = ">="
    + ComparisonOperators["equal"] = "="
    + ComparisonOperators["notEqual"] = "!="
    + })(ComparisonOperators || (ComparisonOperators = {}))
    + // todo: remove detectAndAddParam?
    + // todo: remove rowclass param?
    + class Table {
    + constructor(rowsArray = [], columnsArrayOrMap = [], rowClass = Row, detectAndAddColumns = true, samplingSeed = Date.now()) {
    + this._columnsMap = {}
    + this._ctime = new jtree.TreeNode()._getProcessTimeInMilliseconds()
    + this._tableId = this._getUniqueId()
    + this._samplingSeed = samplingSeed
    + // if this is ALREADY CARDS, should we be a view?
    + this._rows = rowsArray.map((source) => (source instanceof Row ? source : new rowClass(source, this)))
    + // Add detected columns first, so they can be overwritten
    + if (detectAndAddColumns) this._getDetectedColumnNames().forEach((col) => this._registerColumn({ name: col }))
    + if (Array.isArray(columnsArrayOrMap)) columnsArrayOrMap.forEach((col) => this._registerColumn(col))
    + else if (columnsArrayOrMap) this._columnsMap = columnsArrayOrMap
    + }
    + _getUniqueId() {
    + Table._uniqueId++
    + return Table._uniqueId
    + }
    + _registerColumn(col) {
    + this._columnsMap[col.name] = new Column(col, this._getColumnValuesFromSourceAsAnyVector(col.source || col.name))
    + return this
    + }
    + _getColumnValuesFromSourceAsAnyVector(columnName) {
    + return this.getRows().map((row) => row.getRowOriginalValue(columnName))
    + }
    + // todo: ADD TYPINGS
    + _predictColumns(predictionHints, propertyNameToColumnNameMap = {}) {
    + // todo: use the available input table column names, coupled with column setting we are trying to predict.
    + // ie: "gender" should use "gender" col, if available
    + // check all the columns for one that matches all tests. if found, return it.
    + const columnsArray = this.getColumnsArray()
    + const tests = predictionHints.split(",")
    + const filterTests = tests.filter((test) => test.includes("=")).map((test) => test.split("="))
    + const filterFn = (col) => filterTests.every((test) => col[test[0]] !== undefined && col[test[0]]().toString() === test[1])
    + let colsThatPassed = columnsArray.filter((col) => filterFn(col))
    + const notIn = {}
    + const notEqualTests = tests
    + .filter((test) => test.startsWith("!"))
    + .map((test) => propertyNameToColumnNameMap[test.substr(1)])
    + .filter((identity) => identity)
    + .forEach((name) => {
    + notIn[name] = true
    + })
    + colsThatPassed = colsThatPassed.filter((col) => !notIn[col.getColumnName()])
    + // for now just 1 prop ranking.
    + const rankColumn = tests.find((test) => !test.includes("=") && !test.includes("!"))
    + let potentialCols = colsThatPassed
    + if (rankColumn) potentialCols = potentialCols.sort(jtree.Utils.makeSortByFn((col) => col[rankColumn]())).reverse()
    + return potentialCols
    + }
    + getRows() {
    + return this._rows
    + }
    + getFirstColumnAsString() {
    + return this.getRows()
    + .map((row) => row.getFirstValue())
    + .join("")
    + }
    + isBlankTable() {
    + return this.getRowCount() === 0 && this.getColumnCount() === 0
    + }
    + getRowCount() {
    + return this.getRows().length
    + }
    + getColumnCount() {
    + return this.getColumnNames().length
    + }
    + getColumnNames() {
    + return Object.keys(this.getColumnsMap())
    + }
    + getColumnsMap() {
    + return this._columnsMap
    + }
    + getColumnByName(name) {
    + return this.getColumnsMap()[name]
    + }
    + _getLowerCaseColumnsMap() {
    + const map = {}
    + Object.keys(this._columnsMap).forEach((key) => (map[key.toLowerCase()] = key))
    + return map
    + }
    + getTableCTime() {
    + return this._ctime
    + }
    + filterClonedRowsByScalar(columnName, comparisonOperator, scalarValueAsString) {
    + const column = this.getColumnByName(columnName)
    + let typedScalarValue = column.getPrimitiveTypeObj().getAsNativeJavascriptType(scalarValueAsString)
    + if (typedScalarValue instanceof Date) typedScalarValue = typedScalarValue.getTime() // todo: do I need this?
    + return new Table(
    + this.cloneNativeJavascriptTypedRows().filter((row) => {
    + let rowTypedValue = row[columnName]
    + if (rowTypedValue instanceof Date) rowTypedValue = rowTypedValue.getTime() // todo: do I need this?
    + if (comparisonOperator === ComparisonOperators.equal) return rowTypedValue == typedScalarValue
    + if (comparisonOperator === ComparisonOperators.notEqual) return rowTypedValue != typedScalarValue
    + if (comparisonOperator === ComparisonOperators.greaterThan) return rowTypedValue > typedScalarValue
    + if (comparisonOperator === ComparisonOperators.lessThan) return rowTypedValue < typedScalarValue
    + if (comparisonOperator === ComparisonOperators.lessThanOrEqual) return rowTypedValue <= typedScalarValue
    + if (comparisonOperator === ComparisonOperators.greaterThanOrEqual) return rowTypedValue >= typedScalarValue
    + }),
    + this.getColumnsArrayOfObjects(),
    + undefined,
    + false
    + )
    + }
    + getColumnsArray() {
    + return Object.values(this.getColumnsMap())
    + }
    + getColumnsArrayOfObjects() {
    + return this.getColumnsArray().map((col) => col.toObject())
    + }
    + getJavascriptNativeTypedValues() {
    + return this.getRows().map((row) => row.rowToObjectWithOnlyNativeJavascriptTypes())
    + }
    + toMatrix() {
    + return this.getRows().map((row) => row.toVector())
    + }
    + toNumericMatrix() {
    + // todo: right now it drops them. should we 1 hot them?
    + const numericNames = this.getColumnsArray()
    + .filter((col) => col.isNumeric())
    + .map((col) => col.getColumnName())
    + return this.getRows().map((row) => {
    + const obj = row.rowToObjectWithOnlyNativeJavascriptTypes()
    + return numericNames.map((name) => obj[name])
    + })
    + }
    + clone() {
    + return new Table(this.cloneNativeJavascriptTypedRows())
    + }
    + cloneNativeJavascriptTypedRows() {
    + return this.getRows()
    + .map((row) => row.rowToObjectWithOnlyNativeJavascriptTypes())
    + .map((obj) => Object.assign({}, obj))
    + }
    + fillMissing(columnName, value) {
    + const filled = this.cloneNativeJavascriptTypedRows().map((row) => {
    + if (jtree.Utils.isValueEmpty(row[columnName])) row[columnName] = value
    + return row
    + })
    + return new Table(filled, this.getColumnsArrayOfObjects())
    + }
    + getTableColumnByName(name) {
    + return this.getColumnsMap()[name]
    + }
    + _getUnionSample(sampleSet) {
    + const sample = {}
    + sampleSet.forEach((row) => {
    + row.getRowKeys().forEach((key) => {
    + if (!key) return
    + const currentVal = sample[key]
    + if (currentVal !== undefined && currentVal !== "") return
    + sample[key] = row.getRowOriginalValue(key)
    + })
    + })
    + return sample
    + }
    + _getSampleSet() {
    + const SAMPLE_SET_SIZE = 30 // todo: fix.
    + if (!this._sampleSet) this._sampleSet = jtree.Utils.sampleWithoutReplacement(this.getRows(), SAMPLE_SET_SIZE, this._samplingSeed)
    + return this._sampleSet
    + }
    + _getDetectedColumnNames() {
    + const columns = this.getColumnsMap()
    + // This is run AFTER we have all user definied columns, and AFTER we have all data.
    + // detect columns that appear in records
    + // todo: this is broken. if you only pull 30, and its a tree or other type with varying columsn, you
    + // will often miss columns.
    + return Object.keys(this._getUnionSample(this._getSampleSet()))
    + .map((columnName) => columnName.trim()) // todo: why do we filter empties?
    + .filter((identity) => identity)
    + .filter((col) => !columns[col]) // do not overwrite any custom columns
    + }
    + toTypeScriptInterface() {
    + const cols = this.getColumnsArray()
    + .map((col) => ` ${col.getColumnName()}: ${col.getPrimitiveTypeName()};`)
    + .join("\n")
    + return `interface Row {
    + ${cols}
    + }`
    + }
    + getColumnNamesAndTypes() {
    + return this._getColumnNamesAndTypes()
    + }
    + getColumnNamesAndTypesAndReductions() {
    + return this._getColumnNamesAndTypes(true)
    + }
    + _getColumnNamesAndTypes(withReductions = false) {
    + const columns = this.getColumnsMap()
    + return this.getColumnNames().map((name) => {
    + const column = columns[name]
    + const obj = {
    + Column: name,
    + JTableType: column.getPrimitiveTypeName(),
    + JavascriptType: column.getPrimitiveTypeObj().getJavascriptTypeName(),
    + }
    + if (withReductions) Object.assign(obj, column.getReductions())
    + return obj
    + })
    + }
    + getPredictionsForAPropertyNameToColumnNameMapGivenHintsNode(hintsNode, propertyNameToColumnNameMap) {
    + const results = {}
    + hintsNode
    + .map((columnHintNode) => this.getColumnNamePredictionsForProperty(columnHintNode.getFirstWord(), columnHintNode.getContent(), propertyNameToColumnNameMap))
    + .filter((pred) => pred.length)
    + .forEach((predictions) => {
    + const topPrediction = predictions[0]
    + results[topPrediction.propertyName] = topPrediction.columnName
    + })
    + return results
    + }
    + getColumnNamePredictionsForProperty(propertyName, predictionHints, propertyNameToColumnNameMap) {
    + const userDefinedColumnName = propertyNameToColumnNameMap[propertyName]
    + if (this.getColumnsMap()[userDefinedColumnName]) return [{ propertyName: propertyName, columnName: userDefinedColumnName }] // Table has a column named this, return okay.
    + // Table has a lowercase column named this. Return okay. Todo: do we want to do this?
    + if (userDefinedColumnName && this._getLowerCaseColumnsMap()[userDefinedColumnName.toLowerCase()]) return [this._getLowerCaseColumnsMap()[userDefinedColumnName.toLowerCase()]]
    + if (predictionHints) {
    + const potentialCols = this._predictColumns(predictionHints, propertyNameToColumnNameMap)
    + if (potentialCols.length) return [{ propertyName: propertyName, columnName: potentialCols[0].getColumnName() }]
    + }
    + const cols = this.getColumnsByImportance()
    + const name = cols.length && cols[0].getColumnName()
    + if (name) return [{ propertyName: propertyName, columnName: name }]
    + return []
    + }
    + toTree() {
    + return new jtree.TreeNode(this.getRows().map((row) => row.getRowSourceObject()))
    + }
    + filterRowsByFn(fn) {
    + return new Table(this.cloneNativeJavascriptTypedRows().filter((inputRow, index) => fn(inputRow, index)))
    + }
    + // todo: make more efficient?
    + // todo: preserve columns
    + addColumns(columnsToAdd) {
    + const inputColDefs = this.getColumnsMap()
    + return new Table(
    + this.cloneNativeJavascriptTypedRows().map((inputRow) => {
    + columnsToAdd.forEach((newCol) => {
    + let newValue
    + if (newCol.accessorFn) newValue = newCol.accessorFn(inputRow)
    + else newValue = Column.convertValueToNumeric(inputRow[newCol.source], inputColDefs[newCol.source].getPrimitiveTypeName(), newCol.type, newCol.mathFn)
    + inputRow[newCol.name] = newValue
    + })
    + return inputRow
    + })
    + )
    + }
    + // todo: can be made more effcicent
    + changeColumnType(columnName, newType) {
    + const cols = this.getColumnsArrayOfObjects()
    + cols.forEach((col) => {
    + if (col.name === columnName) col.type = newType
    + })
    + return new Table(this.cloneNativeJavascriptTypedRows(), cols, undefined, false)
    + }
    + renameColumns(nameMap) {
    + const rows = this.getRows()
    + .map((row) => row.rowToObjectWithOnlyNativeJavascriptTypes())
    + .map((obj) => {
    + Object.keys(nameMap).forEach((oldName) => {
    + const newName = nameMap[oldName]
    + if (newName === oldName) return
    + obj[newName] = obj[oldName]
    + delete obj[oldName]
    + })
    + return obj
    + })
    + const cols = this.getColumnsArrayOfObjects()
    + cols.forEach((col) => {
    + if (nameMap[col.name]) col.name = nameMap[col.name]
    + })
    + return new Table(rows, cols, undefined, false)
    + }
    + cloneWithCleanColumnNames() {
    + const nameMap = {}
    + const cols = this.getColumnsArrayOfObjects()
    + cols.forEach((col) => {
    + nameMap[col.name] = col.name.replace(/[^a-z0-9]/gi, "")
    + })
    + return this.renameColumns(nameMap)
    + }
    + // todo: can be made more effcicent
    + dropAllColumnsExcept(columnsToKeep) {
    + return new Table(
    + this.cloneNativeJavascriptTypedRows().map((inputRow, rowIndex) => {
    + const result = {}
    + columnsToKeep.forEach((name) => {
    + result[name] = inputRow[name]
    + })
    + return result
    + }),
    + columnsToKeep.map((colName) => this.getColumnByName(colName).toObject())
    + )
    + }
    + // todo: we don't need any cloning here--just create a new row, new rows array, new and add the pointers
    + // to same rows
    + addRow(rowWords) {
    + const rows = this.cloneNativeJavascriptTypedRows()
    + const newRow = {}
    + Object.keys(rows[0] || {}).forEach((key, index) => {
    + // todo: handle typings
    + newRow[key] = rowWords[index]
    + })
    + rows.push(newRow)
    + return new Table(rows, this.getColumnsMap())
    + }
    + _synthesizeRow(randomNumberFn) {
    + const row = {}
    + this.getColumnsArray().forEach((column) => {
    + row[column.getColumnName()] = column.synthesizeValue(randomNumberFn)
    + })
    + return row
    + }
    + synthesizeTable(rowcount, seed) {
    + const randomNumberFn = jtree.Utils.makeSemiRandomFn(seed)
    + const rows = []
    + while (rowcount) {
    + rows.push(this._synthesizeRow(randomNumberFn))
    + rowcount--
    + }
    + return new Table(
    + rows,
    + this.getColumnsArray().map((col) => col.toObject())
    + )
    + }
    + // todo: we don't need any cloning here--here create a new sorted array with poitners
    + // to same rows
    + shuffleRows() {
    + // todo: add seed!
    + // cellType randomSeed int
    + // description An integer to seed the random number generator with.
    + return new Table(jtree.Utils.shuffleInPlace(this.getRows().slice(0)), this.getColumnsMap())
    + }
    + reverseRows() {
    + const rows = this.getRows().slice(0)
    + rows.reverse()
    + return new Table(rows, this.getColumnsMap())
    + }
    + // Pivot is shorthand for group and reduce?
    + makePivotTable(groupByColumnNames, newCols) {
    + const inputColumns = this.getColumnsArrayOfObjects()
    + const colMap = {}
    + inputColumns.forEach((col) => (colMap[col.name] = true))
    + const groupByCols = groupByColumnNames.filter((col) => colMap[col])
    + const pivotTable = new PivotTable(this.getJavascriptNativeTypedValues(), inputColumns, newCols).getNewRows(groupByCols)
    + return new Table(pivotTable.rows, pivotTable.columns)
    + }
    + sortBy(colNames) {
    + const colAccessorFns = colNames.map((colName) => (row) => row.rowToObjectWithOnlyNativeJavascriptTypes()[colName])
    + const rows = this.getRows().sort(jtree.Utils.makeSortByFn(colAccessorFns))
    + return new Table(rows, this.getColumnsMap())
    + }
    + toDelimited(delimiter) {
    + return this.toTree().toDelimited(delimiter, this.getColumnNames())
    + }
    + toSimpleSchema() {
    + return this.getColumnsArray()
    + .map((col) => `${col.getColumnName()} ${col.getPrimitiveTypeName()}`)
    + .join("\n")
    + }
    + // todo: toProtoBuf, toSqlLite, toJsonSchema, toJsonLd, toCapnProto, toApacheArrow, toFlatBuffers
    + // guess which are the more important/informative/interesting columns
    + getColumnsByImportance() {
    + const columnsMap = this.getColumnsMap()
    + const aIsMoreImportant = -1
    + const bIsMoreImportant = 1
    + const cols = Object.keys(columnsMap).map((columnName) => columnsMap[columnName])
    + cols.sort((colA, colB) => {
    + if (colA.getTitlePotential() > colB.getTitlePotential()) return aIsMoreImportant
    + if (colB.getTitlePotential() > colA.getTitlePotential()) return bIsMoreImportant
    + if (colA.getBlankPercentage() > 0.5 || colB.getBlankPercentage() > 0.5) {
    + if (colA.getBlankPercentage() > colB.getBlankPercentage()) return bIsMoreImportant
    + else if (colB.getBlankPercentage() > colA.getBlankPercentage()) return aIsMoreImportant
    + }
    + if (colA.isTemporal() && !colB.isTemporal()) return aIsMoreImportant
    + if (!colA.isTemporal() && colB.isTemporal()) return bIsMoreImportant
    + if (colA.isLink() && !colB.isLink()) return bIsMoreImportant
    + else if (!colA.isLink() && colB.isLink()) return aIsMoreImportant
    + if (colA.isString() && !colB.isString()) return bIsMoreImportant
    + else if (!colA.isString() && colB.isString()) return aIsMoreImportant
    + if (colA.isString() && colB.isString()) {
    + if (colA.getEntropy() > 4 && colA.getEntropy() < 8 && colA.getEntropy() > colB.getEntropy()) return aIsMoreImportant
    + if (colA.getEstimatedTextLength() > colB.getEstimatedTextLength()) return bIsMoreImportant
    + else return aIsMoreImportant
    + }
    + return 0
    + })
    + return cols
    + }
    + }
    + Table._uniqueId = 0
    + window.Table = Table
    + window.ComparisonOperators = ComparisonOperators
    - if (_typeof(pass) === 'object' && pass !== null) {
    - // pass is optional and can be replaced with options
    - options = pass;
    - pass = '';
    + {
    + class stumpNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + errorNode,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    + blockquote: htmlTagNode,
    + colgroup: htmlTagNode,
    + datalist: htmlTagNode,
    + fieldset: htmlTagNode,
    + menuitem: htmlTagNode,
    + noscript: htmlTagNode,
    + optgroup: htmlTagNode,
    + progress: htmlTagNode,
    + styleTag: htmlTagNode,
    + template: htmlTagNode,
    + textarea: htmlTagNode,
    + titleTag: htmlTagNode,
    + address: htmlTagNode,
    + article: htmlTagNode,
    + caption: htmlTagNode,
    + details: htmlTagNode,
    + section: htmlTagNode,
    + summary: htmlTagNode,
    + button: htmlTagNode,
    + canvas: htmlTagNode,
    + dialog: htmlTagNode,
    + figure: htmlTagNode,
    + footer: htmlTagNode,
    + header: htmlTagNode,
    + hgroup: htmlTagNode,
    + iframe: htmlTagNode,
    + keygen: htmlTagNode,
    + legend: htmlTagNode,
    + object: htmlTagNode,
    + option: htmlTagNode,
    + output: htmlTagNode,
    + script: htmlTagNode,
    + select: htmlTagNode,
    + source: htmlTagNode,
    + strong: htmlTagNode,
    + aside: htmlTagNode,
    + embed: htmlTagNode,
    + input: htmlTagNode,
    + label: htmlTagNode,
    + meter: htmlTagNode,
    + param: htmlTagNode,
    + small: htmlTagNode,
    + table: htmlTagNode,
    + tbody: htmlTagNode,
    + tfoot: htmlTagNode,
    + thead: htmlTagNode,
    + track: htmlTagNode,
    + video: htmlTagNode,
    + abbr: htmlTagNode,
    + area: htmlTagNode,
    + base: htmlTagNode,
    + body: htmlTagNode,
    + code: htmlTagNode,
    + form: htmlTagNode,
    + head: htmlTagNode,
    + html: htmlTagNode,
    + link: htmlTagNode,
    + main: htmlTagNode,
    + mark: htmlTagNode,
    + menu: htmlTagNode,
    + meta: htmlTagNode,
    + ruby: htmlTagNode,
    + samp: htmlTagNode,
    + span: htmlTagNode,
    + time: htmlTagNode,
    + bdi: htmlTagNode,
    + bdo: htmlTagNode,
    + col: htmlTagNode,
    + del: htmlTagNode,
    + dfn: htmlTagNode,
    + div: htmlTagNode,
    + img: htmlTagNode,
    + ins: htmlTagNode,
    + kbd: htmlTagNode,
    + map: htmlTagNode,
    + nav: htmlTagNode,
    + pre: htmlTagNode,
    + rtc: htmlTagNode,
    + sub: htmlTagNode,
    + sup: htmlTagNode,
    + var: htmlTagNode,
    + wbr: htmlTagNode,
    + br: htmlTagNode,
    + dd: htmlTagNode,
    + dl: htmlTagNode,
    + dt: htmlTagNode,
    + em: htmlTagNode,
    + h1: htmlTagNode,
    + h2: htmlTagNode,
    + h3: htmlTagNode,
    + h4: htmlTagNode,
    + h5: htmlTagNode,
    + h6: htmlTagNode,
    + hr: htmlTagNode,
    + li: htmlTagNode,
    + ol: htmlTagNode,
    + rb: htmlTagNode,
    + rp: htmlTagNode,
    + rt: htmlTagNode,
    + td: htmlTagNode,
    + th: htmlTagNode,
    + tr: htmlTagNode,
    + ul: htmlTagNode,
    + a: htmlTagNode,
    + b: htmlTagNode,
    + i: htmlTagNode,
    + p: htmlTagNode,
    + q: htmlTagNode,
    + s: htmlTagNode,
    + u: htmlTagNode,
    + }),
    + [{ regex: /^$/, nodeConstructor: blankLineNode }]
    + )
    + }
    + compile() {
    + return this.toHtml()
    + }
    + _getHtmlJoinByCharacter() {
    + return ""
    + }
    + getHandGrammarProgram() {
    + if (!this._cachedHandGrammarProgramRoot)
    + this._cachedHandGrammarProgramRoot = new jtree.HandGrammarProgram(`tooling onsave jtree build produceLang stump
    + anyCell
    + keywordCell
    + emptyCell
    + extraCell
    + highlightScope invalid
    + anyHtmlContentCell
    + highlightScope string
    + attributeValueCell
    + highlightScope constant.language
    + htmlTagNameCell
    + highlightScope variable.function
    + extends keywordCell
    + enum a abbr address area article aside b base bdi bdo blockquote body br button canvas caption code col colgroup datalist dd del details dfn dialog div dl dt em embed fieldset figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins kbd keygen label legend li link main map mark menu menuitem meta meter nav noscript object ol optgroup option output p param pre progress q rb rp rt rtc ruby s samp script section select small source span strong styleTag sub summary sup table tbody td template textarea tfoot th thead time titleTag tr track u ul var video wbr
    + htmlAttributeNameCell
    + highlightScope entity.name.type
    + extends keywordCell
    + enum accept accept-charset accesskey action align alt async autocomplete autofocus autoplay bgcolor border charset checked class color cols colspan content contenteditable controls coords datetime default defer dir dirname disabled download draggable dropzone enctype for formaction headers height hidden high href hreflang http-equiv id ismap kind lang list loop low max maxlength media method min multiple muted name novalidate onabort onafterprint onbeforeprint onbeforeunload onblur oncanplay oncanplaythrough onchange onclick oncontextmenu oncopy oncuechange oncut ondblclick ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop ondurationchange onemptied onended onerror onfocus onhashchange oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart onmousedown onmousemove onmouseout onmouseover onmouseup onmousewheel onoffline ononline onpagehide onpageshow onpaste onpause onplay onplaying onpopstate onprogress onratechange onreset onresize onscroll onsearch onseeked onseeking onselect onstalled onstorage onsubmit onsuspend ontimeupdate ontoggle onunload onvolumechange onwaiting onwheel open optimum pattern placeholder poster preload readonly rel required reversed rows rowspan sandbox scope selected shape size sizes spellcheck src srcdoc srclang srcset start step style tabindex target title translate type usemap value width wrap
    + bernKeywordCell
    + enum bern
    + extends keywordCell
    + stumpNode
    + root
    + description A prefix Tree Language that compiles to HTML.
    + catchAllNodeType errorNode
    + inScope htmlTagNode blankLineNode
    + example
    + div
    + h1 hello world
    + compilesTo html
    + javascript
    + compile() {
    + return this.toHtml()
    -
    - if (!options) {
    - options = {
    - type: typeof btoa === 'function' ? 'basic' : 'auto'
    - };
    + _getHtmlJoinByCharacter() {
    + return ""
    -
    - var encoder = function encoder(string) {
    - if (typeof btoa === 'function') {
    - return btoa(string);
    - }
    -
    - throw new Error('Cannot use basic auth, btoa is not a function');
    - };
    -
    - return this._auth(user, pass, options, encoder);
    - };
    - /**
    - * Add query-string `val`.
    - *
    - * Examples:
    - *
    - * request.get('/shoes')
    - * .query('size=10')
    - * .query({ color: 'blue' })
    - *
    - * @param {Object|String} val
    - * @return {Request} for chaining
    - * @api public
    - */
    -
    -
    - Request.prototype.query = function (val) {
    - if (typeof val !== 'string') val = serialize(val);
    - if (val) this._query.push(val);
    - return this;
    - };
    - /**
    - * Queue the given `file` as an attachment to the specified `field`,
    - * with optional `options` (or filename).
    - *
    - * ``` js
    - * request.post('/upload')
    - * .attach('content', new Blob(['hey!'], { type: "text/html"}))
    - * .end(callback);
    - * ```
    - *
    - * @param {String} field
    - * @param {Blob|File} file
    - * @param {String|Object} options
    - * @return {Request} for chaining
    - * @api public
    - */
    -
    -
    - Request.prototype.attach = function (field, file, options) {
    - if (file) {
    - if (this._data) {
    - throw new Error("superagent can't mix .send() and .attach()");
    - }
    -
    - this._getFormData().append(field, file, options || file.name);
    + blankLineNode
    + pattern ^$
    + tags doNotSynthesize
    + cells emptyCell
    + javascript
    + _toHtml() {
    + return ""
    -
    - return this;
    - };
    -
    - Request.prototype._getFormData = function () {
    - if (!this._formData) {
    - this._formData = new root.FormData();
    + getTextContent() {return ""}
    + htmlTagNode
    + inScope bernNode htmlTagNode htmlAttributeNode blankLineNode
    + catchAllCellType anyHtmlContentCell
    + cells htmlTagNameCell
    + javascript
    + getTag() {
    + // we need to remove the "Tag" bit to handle the style and title attribute/tag conflict.
    + const firstWord = this.getFirstWord()
    + const map = {
    + titleTag: "title",
    + styleTag: "style"
    + }
    + return map[firstWord] || firstWord
    -
    - return this._formData;
    - };
    - /**
    - * Invoke the callback with `err` and `res`
    - * and handle arity check.
    - *
    - * @param {Error} err
    - * @param {Response} res
    - * @api private
    - */
    -
    -
    - Request.prototype.callback = function (err, res) {
    - if (this._shouldRetry(err, res)) {
    - return this._retry();
    + _getHtmlJoinByCharacter() {
    + return ""
    -
    - var fn = this._callback;
    - this.clearTimeout();
    -
    - if (err) {
    - if (this._maxRetries) err.retries = this._retries - 1;
    - this.emit('error', err);
    + toHtmlWithSuids() {
    + return this._toHtml(undefined, true)
    -
    - fn(err, res);
    - };
    - /**
    - * Invoke callback with x-domain error.
    - *
    - * @api private
    - */
    -
    -
    - Request.prototype.crossDomainError = function () {
    - var err = new Error('Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.');
    - err.crossDomain = true;
    - err.status = this.status;
    - err.method = this.method;
    - err.url = this.url;
    - this.callback(err);
    - }; // This only warns, because the request is still likely to work
    -
    -
    - Request.prototype.agent = function () {
    - console.warn('This is not supported in browser version of superagent');
    - return this;
    - };
    -
    - Request.prototype.buffer = Request.prototype.ca;
    - Request.prototype.ca = Request.prototype.agent; // This throws, because it can't send/receive data as expected
    -
    - Request.prototype.write = function () {
    - throw new Error('Streaming is not supported in browser version of superagent');
    - };
    -
    - Request.prototype.pipe = Request.prototype.write;
    - /**
    - * Check if `obj` is a host object,
    - * we don't want to serialize these :)
    - *
    - * @param {Object} obj host object
    - * @return {Boolean} is a host object
    - * @api private
    - */
    -
    - Request.prototype._isHost = function (obj) {
    - // Native objects stringify to [object File], [object Blob], [object FormData], etc.
    - return obj && _typeof(obj) === 'object' && !Array.isArray(obj) && Object.prototype.toString.call(obj) !== '[object Object]';
    - };
    - /**
    - * Initiate request, invoking callback `fn(res)`
    - * with an instanceof `Response`.
    - *
    - * @param {Function} fn
    - * @return {Request} for chaining
    - * @api public
    - */
    -
    -
    - Request.prototype.end = function (fn) {
    - if (this._endCalled) {
    - console.warn('Warning: .end() was called twice. This is not supported in superagent');
    + _getOneLiner() {
    + const oneLinerWords = this.getWordsFrom(1)
    + return oneLinerWords.length ? oneLinerWords.join(" ") : ""
    -
    - this._endCalled = true; // store callback
    -
    - this._callback = fn || noop; // querystring
    -
    - this._finalizeQueryString();
    -
    - this._end();
    - };
    -
    - Request.prototype._setUploadTimeout = function () {
    - var self = this; // upload timeout it's wokrs only if deadline timeout is off
    -
    - if (this._uploadTimeout && !this._uploadTimeoutTimer) {
    - this._uploadTimeoutTimer = setTimeout(function () {
    - self._timeoutError('Upload timeout of ', self._uploadTimeout, 'ETIMEDOUT');
    - }, this._uploadTimeout);
    + getTextContent() {
    + return this._getOneLiner()
    - }; // eslint-disable-next-line complexity
    -
    -
    - Request.prototype._end = function () {
    - if (this._aborted) return this.callback(new Error('The request has been aborted even before .end() was called'));
    - var self = this;
    - this.xhr = request.getXHR();
    - var xhr = this.xhr;
    - var data = this._formData || this._data;
    -
    - this._setTimeouts(); // state change
    -
    -
    - xhr.onreadystatechange = function () {
    - var readyState = xhr.readyState;
    -
    - if (readyState >= 2 && self._responseTimeoutTimer) {
    - clearTimeout(self._responseTimeoutTimer);
    - }
    -
    - if (readyState !== 4) {
    - return;
    - } // In IE9, reads to any property (e.g. status) off of an aborted XHR will
    - // result in the error "Could not complete the operation due to error c00c023f"
    -
    -
    - var status;
    -
    - try {
    - status = xhr.status;
    - } catch (err) {
    - status = 0;
    - }
    -
    - if (!status) {
    - if (self.timedout || self._aborted) return;
    - return self.crossDomainError();
    - }
    -
    - self.emit('end');
    - }; // progress
    -
    -
    - var handleProgress = function handleProgress(direction, e) {
    - if (e.total > 0) {
    - e.percent = e.loaded / e.total * 100;
    -
    - if (e.percent === 100) {
    - clearTimeout(self._uploadTimeoutTimer);
    - }
    - }
    -
    - e.direction = direction;
    - self.emit('progress', e);
    - };
    -
    - if (this.hasListeners('progress')) {
    - try {
    - xhr.addEventListener('progress', handleProgress.bind(null, 'download'));
    -
    - if (xhr.upload) {
    - xhr.upload.addEventListener('progress', handleProgress.bind(null, 'upload'));
    - }
    - } catch (err) {// Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.
    - // Reported here:
    - // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context
    - }
    + shouldCollapse() {
    + return this.has("collapse")
    -
    - if (xhr.upload) {
    - this._setUploadTimeout();
    - } // initiate request
    -
    -
    - try {
    - if (this.username && this.password) {
    - xhr.open(this.method, this.url, true, this.username, this.password);
    - } else {
    - xhr.open(this.method, this.url, true);
    - }
    - } catch (err) {
    - // see #1149
    - return this.callback(err);
    - } // CORS
    -
    -
    - if (this._withCredentials) xhr.withCredentials = true; // body
    -
    - if (!this._formData && this.method !== 'GET' && this.method !== 'HEAD' && typeof data !== 'string' && !this._isHost(data)) {
    - // serialize stuff
    - var contentType = this._header['content-type'];
    -
    - var _serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : ''];
    -
    - if (!_serialize && isJSON(contentType)) {
    - _serialize = request.serialize['application/json'];
    - }
    -
    - if (_serialize) data = _serialize(data);
    - } // set header fields
    -
    -
    - for (var field in this.header) {
    - if (this.header[field] === null) continue;
    - if (Object.prototype.hasOwnProperty.call(this.header, field)) xhr.setRequestHeader(field, this.header[field]);
    + _toHtml(indentCount, withSuid) {
    + const tag = this.getTag()
    + const children = this.map(child => child._toHtml(indentCount + 1, withSuid)).join("")
    + const attributesStr = this.filter(node => node.isAttributeNode)
    + .map(child => child.getAttribute())
    + .join("")
    + const indent = " ".repeat(indentCount)
    + const collapse = this.shouldCollapse()
    + const indentForChildNodes = !collapse && this.getChildInstancesOfNodeTypeId("htmlTagNode").length > 0
    + const suid = withSuid ? \` stumpUid="\${this._getUid()}"\` : ""
    + const oneLiner = this._getOneLiner()
    + return \`\${!collapse ? indent : ""}<\${tag}\${attributesStr}\${suid}>\${oneLiner}\${indentForChildNodes ? "\\n" : ""}\${children}\${collapse ? "" : "\\n"}\`
    -
    - if (this._responseType) {
    - xhr.responseType = this._responseType;
    - } // send stuff
    -
    -
    - this.emit('request', this); // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)
    - // We need null here if data is undefined
    -
    - xhr.send(typeof data === 'undefined' ? null : data);
    - };
    -
    - request.agent = function () {
    - return new Agent();
    - };
    -
    - ['GET', 'POST', 'OPTIONS', 'PATCH', 'PUT', 'DELETE'].forEach(function (method) {
    - Agent.prototypeethod.toLowerCase()] = function (url, fn) {
    - var req = new request.Request(method, url);
    -
    - this._setDefaults(req);
    -
    - if (fn) {
    - req.end(fn);
    - }
    -
    - return req;
    - };
    - });
    - Agent.prototype.del = Agent.prototype.delete;
    - /**
    - * GET `url` with optional callback `fn(res)`.
    - *
    - * @param {String} url
    - * @param {Mixed|Function} [data] or fn
    - * @param {Function} [fn]
    - * @return {Request}
    - * @api public
    - */
    -
    - request.get = function (url, data, fn) {
    - var req = request('GET', url);
    -
    - if (typeof data === 'function') {
    - fn = data;
    - data = null;
    + removeCssStumpNode() {
    + return this.removeStumpNode()
    -
    - if (data) req.query(data);
    - if (fn) req.end(fn);
    - return req;
    - };
    - /**
    - * HEAD `url` with optional callback `fn(res)`.
    - *
    - * @param {String} url
    - * @param {Mixed|Function} [data] or fn
    - * @param {Function} [fn]
    - * @return {Request}
    - * @api public
    - */
    -
    -
    - request.head = function (url, data, fn) {
    - var req = request('HEAD', url);
    -
    - if (typeof data === 'function') {
    - fn = data;
    - data = null;
    + removeStumpNode() {
    + this.getShadow().removeShadow()
    + return this.destroy()
    -
    - if (data) req.query(data);
    - if (fn) req.end(fn);
    - return req;
    - };
    - /**
    - * OPTIONS query to `url` with optional callback `fn(res)`.
    - *
    - * @param {String} url
    - * @param {Mixed|Function} [data] or fn
    - * @param {Function} [fn]
    - * @return {Request}
    - * @api public
    - */
    -
    -
    - request.options = function (url, data, fn) {
    - var req = request('OPTIONS', url);
    -
    - if (typeof data === 'function') {
    - fn = data;
    - data = null;
    + getNodeByGuid(guid) {
    + return this.getTopDownArray().find(node => node._getUid() === guid)
    -
    - if (data) req.send(data);
    - if (fn) req.end(fn);
    - return req;
    - };
    - /**
    - * DELETE `url` with optional `data` and callback `fn(res)`.
    - *
    - * @param {String} url
    - * @param {Mixed} [data]
    - * @param {Function} [fn]
    - * @return {Request}
    - * @api public
    - */
    -
    -
    - function del(url, data, fn) {
    - var req = request('DELETE', url);
    -
    - if (typeof data === 'function') {
    - fn = data;
    - data = null;
    + addClassToStumpNode(className) {
    + const classNode = this.touchNode("class")
    + const words = classNode.getWordsFrom(1)
    + // note: we call add on shadow regardless, because at the moment stump may have gotten out of
    + // sync with shadow, if things modified the dom. todo: cleanup.
    + this.getShadow().addClassToShadow(className)
    + if (words.includes(className)) return this
    + words.push(className)
    + classNode.setContent(words.join(this.getWordBreakSymbol()))
    + return this
    -
    - if (data) req.send(data);
    - if (fn) req.end(fn);
    - return req;
    - }
    -
    - request.del = del;
    - request.delete = del;
    - /**
    - * PATCH `url` with optional `data` and callback `fn(res)`.
    - *
    - * @param {String} url
    - * @param {Mixed} [data]
    - * @param {Function} [fn]
    - * @return {Request}
    - * @api public
    - */
    -
    - request.patch = function (url, data, fn) {
    - var req = request('PATCH', url);
    -
    - if (typeof data === 'function') {
    - fn = data;
    - data = null;
    + removeClassFromStumpNode(className) {
    + const classNode = this.getNode("class")
    + if (!classNode) return this
    + const newClasses = classNode.getWords().filter(word => word !== className)
    + if (!newClasses.length) classNode.destroy()
    + else classNode.setContent(newClasses.join(" "))
    + this.getShadow().removeClassFromShadow(className)
    + return this
    -
    - if (data) req.send(data);
    - if (fn) req.end(fn);
    - return req;
    - };
    - /**
    - * POST `url` with optional `data` and callback `fn(res)`.
    - *
    - * @param {String} url
    - * @param {Mixed} [data]
    - * @param {Function} [fn]
    - * @return {Request}
    - * @api public
    - */
    -
    -
    - request.post = function (url, data, fn) {
    - var req = request('POST', url);
    -
    - if (typeof data === 'function') {
    - fn = data;
    - data = null;
    + stumpNodeHasClass(className) {
    + const classNode = this.getNode("class")
    + return classNode && classNode.getWords().includes(className) ? true : false
    -
    - if (data) req.send(data);
    - if (fn) req.end(fn);
    - return req;
    - };
    - /**
    - * PUT `url` with optional `data` and callback `fn(res)`.
    - *
    - * @param {String} url
    - * @param {Mixed|Function} [data] or fn
    - * @param {Function} [fn]
    - * @return {Request}
    - * @api public
    - */
    -
    -
    - request.put = function (url, data, fn) {
    - var req = request('PUT', url);
    -
    - if (typeof data === 'function') {
    - fn = data;
    - data = null;
    + isStumpNodeCheckbox() {
    + return this.get("type") === "checkbox"
    -
    - if (data) req.send(data);
    - if (fn) req.end(fn);
    - return req;
    - };
    -
    - },{"./agent-base":3,"./is-object":4,"./request-base":6,"./response-base":7,"component-emitter":1,"fast-safe-stringify":2}],6:[function(require,module,exports){
    - "use strict";
    -
    - function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
    -
    - /**
    - * Module of mixed-in functions shared between node and client code
    - */
    - var isObject = require('./is-object');
    - /**
    - * Expose `RequestBase`.
    - */
    -
    -
    - module.exports = RequestBase;
    - /**
    - * Initialize a new `RequestBase`.
    - *
    - * @api public
    - */
    -
    - function RequestBase(obj) {
    - if (obj) return mixin(obj);
    - }
    - /**
    - * Mixin the prototype properties.
    - *
    - * @param {Object} obj
    - * @return {Object}
    - * @api private
    - */
    -
    -
    - function mixin(obj) {
    - for (var key in RequestBase.prototype) {
    - if (Object.prototype.hasOwnProperty.call(RequestBase.prototype, key)) obj[key] = RequestBase.prototype[key];
    + getShadow() {
    + if (!this._shadow) {
    + const shadowClass = this.getShadowClass()
    + this._shadow = new shadowClass(this)
    + }
    + return this._shadow
    -
    - return obj;
    - }
    - /**
    - * Clear previous timeout.
    - *
    - * @return {Request} for chaining
    - * @api public
    - */
    -
    -
    - RequestBase.prototype.clearTimeout = function () {
    - clearTimeout(this._timer);
    - clearTimeout(this._responseTimeoutTimer);
    - clearTimeout(this._uploadTimeoutTimer);
    - delete this._timer;
    - delete this._responseTimeoutTimer;
    - delete this._uploadTimeoutTimer;
    - return this;
    - };
    - /**
    - * Override default response body parser
    - *
    - * This function will be called to convert incoming data into request.body
    - *
    - * @param {Function}
    - * @api public
    - */
    -
    -
    - RequestBase.prototype.parse = function (fn) {
    - this._parser = fn;
    - return this;
    - };
    - /**
    - * Set format of binary response body.
    - * In browser valid formats are 'blob' and 'arraybuffer',
    - * which return Blob and ArrayBuffer, respectively.
    - *
    - * In Node all values result in Buffer.
    - *
    - * Examples:
    - *
    - * req.get('/')
    - * .responseType('blob')
    - * .end(callback);
    - *
    - * @param {String} val
    - * @return {Request} for chaining
    - * @api public
    - */
    -
    -
    - RequestBase.prototype.responseType = function (val) {
    - this._responseType = val;
    - return this;
    - };
    - /**
    - * Override default request body serializer
    - *
    - * This function will be called to convert data set via .send or .attach into payload to send
    - *
    - * @param {Function}
    - * @api public
    - */
    -
    -
    - RequestBase.prototype.serialize = function (fn) {
    - this._serializer = fn;
    - return this;
    - };
    - /**
    - * Set timeouts.
    - *
    - * - response timeout is time between sending request and receiving the first byte of the response. Includes DNS and connection time.
    - * - deadline is the time from start of the request to receiving response body in full. If the deadline is too short large files may not load at all on slow connections.
    - * - upload is the time since last bit of data was sent or received. This timeout works only if deadline timeout is off
    - *
    - * Value of 0 or false means no timeout.
    - *
    - * @param {Number|Object} ms or {response, deadline}
    - * @return {Request} for chaining
    - * @api public
    - */
    -
    -
    - RequestBase.prototype.timeout = function (options) {
    - if (!options || _typeof(options) !== 'object') {
    - this._timeout = options;
    - this._responseTimeout = 0;
    - this._uploadTimeout = 0;
    - return this;
    + insertCssChildNode(text, index) {
    + return this.insertChildNode(text, index)
    -
    - for (var option in options) {
    - if (Object.prototype.hasOwnProperty.call(options, option)) {
    - switch (option) {
    - case 'deadline':
    - this._timeout = options.deadline;
    - break;
    -
    - case 'response':
    - this._responseTimeout = options.response;
    - break;
    -
    - case 'upload':
    - this._uploadTimeout = options.upload;
    - break;
    -
    - default:
    - console.warn('Unknown timeout option', option);
    - }
    - }
    + insertChildNode(text, index) {
    + const singleNode = new jtree.TreeNode(text).getChildren()[0]
    + const newNode = this.insertLineAndChildren(singleNode.getLine(), singleNode.childrenToString(), index)
    + const stumpNodeIndex = this.getChildInstancesOfNodeTypeId("htmlTagNode").indexOf(newNode)
    + this.getShadow().insertHtmlNode(newNode, stumpNodeIndex)
    + return newNode
    -
    - return this;
    - };
    - /**
    - * Set number of retry attempts on error.
    - *
    - * Failed requests will be retried 'count' times if timeout or err.code >= 500.
    - *
    - * @param {Number} count
    - * @param {Function} [fn]
    - * @return {Request} for chaining
    - * @api public
    - */
    -
    -
    - RequestBase.prototype.retry = function (count, fn) {
    - // Default to 1 if no count passed or true
    - if (arguments.length === 0 || count === true) count = 1;
    - if (count <= 0) count = 0;
    - this._maxRetries = count;
    - this._retries = 0;
    - this._retryCallback = fn;
    - return this;
    - };
    -
    - var ERROR_CODES = ['ECONNRESET', 'ETIMEDOUT', 'EADDRINFO', 'ESOCKETTIMEDOUT'];
    - /**
    - * Determine if a request should be retried.
    - * (Borrowed from segmentio/superagent-retry)
    - *
    - * @param {Error} err an error
    - * @param {Response} [res] response
    - * @returns {Boolean} if segment should be retried
    - */
    -
    - RequestBase.prototype._shouldRetry = function (err, res) {
    - if (!this._maxRetries || this._retries++ >= this._maxRetries) {
    - return false;
    + isInputType() {
    + return ["input", "textarea"].includes(this.getTag()) || this.get("contenteditable") === "true"
    -
    - if (this._retryCallback) {
    - try {
    - var override = this._retryCallback(err, res);
    -
    - if (override === true) return true;
    - if (override === false) return false; // undefined falls back to defaults
    - } catch (err2) {
    - console.error(err2);
    - }
    + findStumpNodeByChild(line) {
    + return this.findStumpNodesByChild(line)[0]
    -
    - if (res && res.status && res.status >= 500 && res.status !== 501) return true;
    -
    - if (err) {
    - if (err.code && ERROR_CODES.indexOf(err.code) !== -1) return true; // Superagent timeout
    -
    - if (err.timeout && err.code === 'ECONNABORTED') return true;
    - if (err.crossDomain) return true;
    + findStumpNodeByChildString(line) {
    + return this.getTopDownArray().find(node =>
    + node
    + .map(child => child.getLine())
    + .join("\\n")
    + .includes(line)
    + )
    -
    - return false;
    - };
    - /**
    - * Retry request
    - *
    - * @return {Request} for chaining
    - * @api private
    - */
    -
    -
    - RequestBase.prototype._retry = function () {
    - this.clearTimeout(); // node
    -
    - if (this.req) {
    - this.req = null;
    - this.req = this.request();
    + findStumpNodeByFirstWord(firstWord) {
    + return this._findStumpNodesByBase(firstWord)[0]
    -
    - this._aborted = false;
    - this.timedout = false;
    - return this._end();
    - };
    - /**
    - * Promise support
    - *
    - * @param {Function} resolve
    - * @param {Function} [reject]
    - * @return {Request}
    - */
    -
    -
    - RequestBase.prototype.then = function (resolve, reject) {
    - var _this = this;
    -
    - if (!this._fullfilledPromise) {
    - var self = this;
    -
    - if (this._endCalled) {
    - console.warn('Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises');
    - }
    -
    - this._fullfilledPromise = new Promise(function (resolve, reject) {
    - self.on('abort', function () {
    - var err = new Error('Aborted');
    - err.code = 'ABORTED';
    - err.status = _this.status;
    - err.method = _this.method;
    - err.url = _this.url;
    - reject(err);
    - });
    - self.end(function (err, res) {
    - if (err) reject(err);else resolve(res);
    - });
    - });
    - }
    -
    - return this._fullfilledPromise.then(resolve, reject);
    - };
    -
    - RequestBase.prototype.catch = function (cb) {
    - return this.then(undefined, cb);
    - };
    - /**
    - * Allow for extension
    - */
    -
    -
    - RequestBase.prototype.use = function (fn) {
    - fn(this);
    - return this;
    - };
    -
    - RequestBase.prototype.ok = function (cb) {
    - if (typeof cb !== 'function') throw new Error('Callback required');
    - this._okCallback = cb;
    - return this;
    - };
    -
    - RequestBase.prototype._isResponseOK = function (res) {
    - if (!res) {
    - return false;
    + _findStumpNodesByBase(firstWord) {
    + return this.getTopDownArray().filter(node => node.doesExtend("htmlTagNode") && node.getFirstWord() === firstWord)
    -
    - if (this._okCallback) {
    - return this._okCallback(res);
    + hasLine(line) {
    + return this.getChildren().some(node => node.getLine() === line)
    -
    - return res.status >= 200 && res.status < 300;
    - };
    - /**
    - * Get request header `field`.
    - * Case-insensitive.
    - *
    - * @param {String} field
    - * @return {String}
    - * @api public
    - */
    -
    -
    - RequestBase.prototype.get = function (field) {
    - return this._header[field.toLowerCase()];
    - };
    - /**
    - * Get case-insensitive header `field` value.
    - * This is a deprecated internal API. Use `.get(field)` instead.
    - *
    - * (getHeader is no longer used internally by the superagent code base)
    - *
    - * @param {String} field
    - * @return {String}
    - * @api private
    - * @deprecated
    - */
    -
    -
    - RequestBase.prototype.getHeader = RequestBase.prototype.get;
    - /**
    - * Set header `field` to `val`, or multiple fields with one object.
    - * Case-insensitive.
    - *
    - * Examples:
    - *
    - * req.get('/')
    - * .set('Accept', 'application/json')
    - * .set('X-API-Key', 'foobar')
    - * .end(callback);
    - *
    - * req.get('/')
    - * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })
    - * .end(callback);
    - *
    - * @param {String|Object} field
    - * @param {String} val
    - * @return {Request} for chaining
    - * @api public
    - */
    -
    - RequestBase.prototype.set = function (field, val) {
    - if (isObject(field)) {
    - for (var key in field) {
    - if (Object.prototype.hasOwnProperty.call(field, key)) this.set(key, field[key]);
    - }
    -
    - return this;
    + findStumpNodesByChild(line) {
    + return this.getTopDownArray().filter(node => node.doesExtend("htmlTagNode") && node.hasLine(line))
    -
    - this._header[field.toLowerCase()] = val;
    - this.header[field] = val;
    - return this;
    - }; // eslint-disable-next-line valid-jsdoc
    -
    - /**
    - * Remove header `field`.
    - * Case-insensitive.
    - *
    - * Example:
    - *
    - * req.get('/')
    - * .unset('User-Agent')
    - * .end(callback);
    - *
    - * @param {String} field field name
    - */
    -
    -
    - RequestBase.prototype.unset = function (field) {
    - delete this._header[field.toLowerCase()];
    - delete this.header[field];
    - return this;
    - };
    - /**
    - * Write the field `name` and `val`, or multiple fields with one object
    - * for "multipart/form-data" request bodies.
    - *
    - * ``` js
    - * request.post('/upload')
    - * .field('foo', 'bar')
    - * .end(callback);
    - *
    - * request.post('/upload')
    - * .field({ foo: 'bar', baz: 'qux' })
    - * .end(callback);
    - * ```
    - *
    - * @param {String|Object} name name of field
    - * @param {String|Blob|File|Buffer|fs.ReadStream} val value of field
    - * @return {Request} for chaining
    - * @api public
    - */
    -
    -
    - RequestBase.prototype.field = function (name, val) {
    - // name should be either a string or an object.
    - if (name === null || undefined === name) {
    - throw new Error('.field(name, val) name can not be empty');
    + findStumpNodesWithClass(className) {
    + return this.getTopDownArray().filter(
    + node =>
    + node.doesExtend("htmlTagNode") &&
    + node.has("class") &&
    + node
    + .getNode("class")
    + .getWords()
    + .includes(className)
    + )
    -
    - if (this._data) {
    - throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");
    + getShadowClass() {
    + return this.getParent().getShadowClass()
    -
    - if (isObject(name)) {
    - for (var key in name) {
    - if (Object.prototype.hasOwnProperty.call(name, key)) this.field(key, name[key]);
    - }
    -
    - return this;
    + // todo: should not be here
    + getStumpNodeTreeComponent() {
    + return this._treeComponent || this.getParent().getStumpNodeTreeComponent()
    -
    - if (Array.isArray(val)) {
    - for (var i in val) {
    - if (Object.prototype.hasOwnProperty.call(val, i)) this.field(name, val[i]);
    - }
    -
    - return this;
    - } // val should be defined now
    -
    -
    - if (val === null || undefined === val) {
    - throw new Error('.field(name, val) val can not be empty');
    + // todo: should not be here
    + setStumpNodeTreeComponent(treeComponent) {
    + this._treeComponent = treeComponent
    + return this
    -
    - if (typeof val === 'boolean') {
    - val = String(val);
    + setStumpNodeCss(css) {
    + this.getShadow().setShadowCss(css)
    + return this
    -
    - this._getFormData().append(name, val);
    -
    - return this;
    - };
    - /**
    - * Abort the request, and clear potential timeout.
    - *
    - * @return {Request} request
    - * @api public
    - */
    -
    -
    - RequestBase.prototype.abort = function () {
    - if (this._aborted) {
    - return this;
    - }
    -
    - this._aborted = true;
    - if (this.xhr) this.xhr.abort(); // browser
    -
    - if (this.req) this.req.abort(); // node
    -
    - this.clearTimeout();
    - this.emit('abort');
    - return this;
    - };
    -
    - RequestBase.prototype._auth = function (user, pass, options, base64Encoder) {
    - switch (options.type) {
    - case 'basic':
    - this.set('Authorization', "Basic ".concat(base64Encoder("".concat(user, ":").concat(pass))));
    - break;
    -
    - case 'auto':
    - this.username = user;
    - this.password = pass;
    - break;
    -
    - case 'bearer':
    - // usage would be .auth(accessToken, { type: 'bearer' })
    - this.set('Authorization', "Bearer ".concat(user));
    - break;
    -
    - default:
    - break;
    - }
    -
    - return this;
    - };
    - /**
    - * Enable transmission of cookies with x-domain requests.
    - *
    - * Note that for this to work the origin must not be
    - * using "Access-Control-Allow-Origin" with a wildcard,
    - * and also must set "Access-Control-Allow-Credentials"
    - * to "true".
    - *
    - * @api public
    - */
    -
    -
    - RequestBase.prototype.withCredentials = function (on) {
    - // This is browser-only functionality. Node side is no-op.
    - if (on === undefined) on = true;
    - this._withCredentials = on;
    - return this;
    - };
    - /**
    - * Set the max redirects to `n`. Does nothing in browser XHR implementation.
    - *
    - * @param {Number} n
    - * @return {Request} for chaining
    - * @api public
    - */
    -
    -
    - RequestBase.prototype.redirects = function (n) {
    - this._maxRedirects = n;
    - return this;
    - };
    - /**
    - * Maximum size of buffered response body, in bytes. Counts uncompressed size.
    - * Default 200MB.
    - *
    - * @param {Number} n number of bytes
    - * @return {Request} for chaining
    - */
    -
    -
    - RequestBase.prototype.maxResponseSize = function (n) {
    - if (typeof n !== 'number') {
    - throw new TypeError('Invalid argument');
    - }
    -
    - this._maxResponseSize = n;
    - return this;
    - };
    - /**
    - * Convert to a plain javascript object (not JSON string) of scalar properties.
    - * Note as this method is designed to return a useful non-this value,
    - * it cannot be chained.
    - *
    - * @return {Object} describing method, url, and data of this request
    - * @api public
    - */
    -
    -
    - RequestBase.prototype.toJSON = function () {
    - return {
    - method: this.method,
    - url: this.url,
    - data: this._data,
    - headers: this._header
    - };
    - };
    - /**
    - * Send `data` as the request body, defaulting the `.type()` to "json" when
    - * an object is given.
    - *
    - * Examples:
    - *
    - * // manual json
    - * request.post('/user')
    - * .type('json')
    - * .send('{"name":"tj"}')
    - * .end(callback)
    - *
    - * // auto json
    - * request.post('/user')
    - * .send({ name: 'tj' })
    - * .end(callback)
    - *
    - * // manual x-www-form-urlencoded
    - * request.post('/user')
    - * .type('form')
    - * .send('name=tj')
    - * .end(callback)
    - *
    - * // auto x-www-form-urlencoded
    - * request.post('/user')
    - * .type('form')
    - * .send({ name: 'tj' })
    - * .end(callback)
    - *
    - * // defaults to x-www-form-urlencoded
    - * request.post('/user')
    - * .send('name=tobi')
    - * .send('species=ferret')
    - * .end(callback)
    - *
    - * @param {String|Object} data
    - * @return {Request} for chaining
    - * @api public
    - */
    - // eslint-disable-next-line complexity
    -
    -
    - RequestBase.prototype.send = function (data) {
    - var isObj = isObject(data);
    - var type = this._header['content-type'];
    -
    - if (this._formData) {
    - throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");
    + getStumpNodeCss(prop) {
    + return this.getShadow().getShadowCss(prop)
    -
    - if (isObj && !this._data) {
    - if (Array.isArray(data)) {
    - this._data = [];
    - } else if (!this._isHost(data)) {
    - this._data = {};
    - }
    - } else if (data && this._data && this._isHost(this._data)) {
    - throw new Error("Can't merge these send calls");
    - } // merge
    -
    -
    - if (isObj && isObject(this._data)) {
    - for (var key in data) {
    - if (Object.prototype.hasOwnProperty.call(data, key)) this._data[key] = data[key];
    - }
    - } else if (typeof data === 'string') {
    - // default to x-www-form-urlencoded
    - if (!type) this.type('form');
    - type = this._header['content-type'];
    -
    - if (type === 'application/x-www-form-urlencoded') {
    - this._data = this._data ? "".concat(this._data, "&").concat(data) : data;
    - } else {
    - this._data = (this._data || '') + data;
    - }
    - } else {
    - this._data = data;
    + getStumpNodeAttr(key) {
    + return this.get(key)
    -
    - if (!isObj || this._isHost(data)) {
    - return this;
    - } // default to json
    -
    -
    - if (!type) this.type('json');
    - return this;
    - };
    - /**
    - * Sort `querystring` by the sort function
    - *
    - *
    - * Examples:
    - *
    - * // default order
    - * request.get('/user')
    - * .query('name=Nick')
    - * .query('search=Manny')
    - * .sortQuery()
    - * .end(callback)
    - *
    - * // customized sort function
    - * request.get('/user')
    - * .query('name=Nick')
    - * .query('search=Manny')
    - * .sortQuery(function(a, b){
    - * return a.length - b.length;
    - * })
    - * .end(callback)
    - *
    - *
    - * @param {Function} sort
    - * @return {Request} for chaining
    - * @api public
    - */
    -
    -
    - RequestBase.prototype.sortQuery = function (sort) {
    - // _sort default to true but otherwise can be a function or boolean
    - this._sort = typeof sort === 'undefined' ? true : sort;
    - return this;
    - };
    - /**
    - * Compose querystring to append to req.url
    - *
    - * @api private
    - */
    -
    -
    - RequestBase.prototype._finalizeQueryString = function () {
    - var query = this._query.join('&');
    -
    - if (query) {
    - this.url += (this.url.indexOf('?') >= 0 ? '&' : '?') + query;
    + setStumpNodeAttr(key, value) {
    + // todo
    + return this
    -
    - this._query.length = 0; // Makes the call idempotent
    -
    - if (this._sort) {
    - var index = this.url.indexOf('?');
    -
    - if (index >= 0) {
    - var queryArr = this.url.substring(index + 1).split('&');
    -
    - if (typeof this._sort === 'function') {
    - queryArr.sort(this._sort);
    - } else {
    - queryArr.sort();
    - }
    -
    - this.url = this.url.substring(0, index) + '?' + queryArr.join('&');
    - }
    + toHtml() {
    + return this._toHtml()
    - }; // For backwards compat only
    -
    -
    - RequestBase.prototype._appendQueryString = function () {
    - console.warn('Unsupported');
    - };
    - /**
    - * Invoke callback with timeout error.
    - *
    - * @api private
    - */
    -
    -
    - RequestBase.prototype._timeoutError = function (reason, timeout, errno) {
    - if (this._aborted) {
    - return;
    + errorNode
    + baseNodeType errorNode
    + htmlAttributeNode
    + javascript
    + _toHtml() {
    + return ""
    -
    - var err = new Error("".concat(reason + timeout, "ms exceeded"));
    - err.timeout = timeout;
    - err.code = 'ECONNABORTED';
    - err.errno = errno;
    - this.timedout = true;
    - this.abort();
    - this.callback(err);
    - };
    -
    - RequestBase.prototype._setTimeouts = function () {
    - var self = this; // deadline
    -
    - if (this._timeout && !this._timer) {
    - this._timer = setTimeout(function () {
    - self._timeoutError('Timeout of ', self._timeout, 'ETIME');
    - }, this._timeout);
    - } // response timeout
    -
    -
    - if (this._responseTimeout && !this._responseTimeoutTimer) {
    - this._responseTimeoutTimer = setTimeout(function () {
    - self._timeoutError('Response timeout of ', self._responseTimeout, 'ETIMEDOUT');
    - }, this._responseTimeout);
    + getTextContent() {return ""}
    + getAttribute() {
    + return \` \${this.getFirstWord()}="\${this.getContent()}"\`
    - };
    -
    - },{"./is-object":4}],7:[function(require,module,exports){
    - "use strict";
    -
    - /**
    - * Module dependencies.
    - */
    - var utils = require('./utils');
    - /**
    - * Expose `ResponseBase`.
    - */
    -
    -
    - module.exports = ResponseBase;
    - /**
    - * Initialize a new `ResponseBase`.
    - *
    - * @api public
    - */
    -
    - function ResponseBase(obj) {
    - if (obj) return mixin(obj);
    - }
    - /**
    - * Mixin the prototype properties.
    - *
    - * @param {Object} obj
    - * @return {Object}
    - * @api private
    - */
    -
    -
    - function mixin(obj) {
    - for (var key in ResponseBase.prototype) {
    - if (Object.prototype.hasOwnProperty.call(ResponseBase.prototype, key)) obj[key] = ResponseBase.prototype[key];
    + boolean isAttributeNode true
    + boolean isTileAttribute true
    + catchAllNodeType errorNode
    + catchAllCellType attributeValueCell
    + cells htmlAttributeNameCell
    + stumpExtendedAttributeNameCell
    + extends htmlAttributeNameCell
    + enum collapse blurCommand changeCommand clickCommand contextMenuCommand doubleClickCommand lineClickCommand lineShiftClickCommand shiftClickCommand
    + stumpExtendedAttributeNode
    + description Node types not present in HTML but included in stump.
    + extends htmlAttributeNode
    + cells stumpExtendedAttributeNameCell
    + lineOfHtmlContentNode
    + boolean isTileAttribute true
    + catchAllNodeType lineOfHtmlContentNode
    + catchAllCellType anyHtmlContentCell
    + javascript
    + getTextContent() {return this.getLine()}
    + bernNode
    + boolean isTileAttribute true
    + todo Rename this node type
    + description This is a node where you can put any HTML content. It is called "bern" until someone comes up with a better name.
    + catchAllNodeType lineOfHtmlContentNode
    + javascript
    + _toHtml() {
    + return this.childrenToString()
    -
    - return obj;
    + getTextContent() {return ""}
    + cells bernKeywordCell`)
    + return this._cachedHandGrammarProgramRoot
    + }
    + static getNodeTypeMap() {
    + return {
    + stumpNode: stumpNode,
    + blankLineNode: blankLineNode,
    + htmlTagNode: htmlTagNode,
    + errorNode: errorNode,
    + htmlAttributeNode: htmlAttributeNode,
    + stumpExtendedAttributeNode: stumpExtendedAttributeNode,
    + lineOfHtmlContentNode: lineOfHtmlContentNode,
    + bernNode: bernNode,
    + }
    + }
    + }
    +
    + class blankLineNode extends jtree.GrammarBackedNode {
    + get emptyCell() {
    + return this.getWord(0)
    + }
    + _toHtml() {
    + return ""
    + }
    + getTextContent() {
    + return ""
    + }
    + }
    +
    + class htmlTagNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + undefined,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    + blockquote: htmlTagNode,
    + colgroup: htmlTagNode,
    + datalist: htmlTagNode,
    + fieldset: htmlTagNode,
    + menuitem: htmlTagNode,
    + noscript: htmlTagNode,
    + optgroup: htmlTagNode,
    + progress: htmlTagNode,
    + styleTag: htmlTagNode,
    + template: htmlTagNode,
    + textarea: htmlTagNode,
    + titleTag: htmlTagNode,
    + address: htmlTagNode,
    + article: htmlTagNode,
    + caption: htmlTagNode,
    + details: htmlTagNode,
    + section: htmlTagNode,
    + summary: htmlTagNode,
    + button: htmlTagNode,
    + canvas: htmlTagNode,
    + dialog: htmlTagNode,
    + figure: htmlTagNode,
    + footer: htmlTagNode,
    + header: htmlTagNode,
    + hgroup: htmlTagNode,
    + iframe: htmlTagNode,
    + keygen: htmlTagNode,
    + legend: htmlTagNode,
    + object: htmlTagNode,
    + option: htmlTagNode,
    + output: htmlTagNode,
    + script: htmlTagNode,
    + select: htmlTagNode,
    + source: htmlTagNode,
    + strong: htmlTagNode,
    + aside: htmlTagNode,
    + embed: htmlTagNode,
    + input: htmlTagNode,
    + label: htmlTagNode,
    + meter: htmlTagNode,
    + param: htmlTagNode,
    + small: htmlTagNode,
    + table: htmlTagNode,
    + tbody: htmlTagNode,
    + tfoot: htmlTagNode,
    + thead: htmlTagNode,
    + track: htmlTagNode,
    + video: htmlTagNode,
    + abbr: htmlTagNode,
    + area: htmlTagNode,
    + base: htmlTagNode,
    + body: htmlTagNode,
    + code: htmlTagNode,
    + form: htmlTagNode,
    + head: htmlTagNode,
    + html: htmlTagNode,
    + link: htmlTagNode,
    + main: htmlTagNode,
    + mark: htmlTagNode,
    + menu: htmlTagNode,
    + meta: htmlTagNode,
    + ruby: htmlTagNode,
    + samp: htmlTagNode,
    + span: htmlTagNode,
    + time: htmlTagNode,
    + bdi: htmlTagNode,
    + bdo: htmlTagNode,
    + col: htmlTagNode,
    + del: htmlTagNode,
    + dfn: htmlTagNode,
    + div: htmlTagNode,
    + img: htmlTagNode,
    + ins: htmlTagNode,
    + kbd: htmlTagNode,
    + map: htmlTagNode,
    + nav: htmlTagNode,
    + pre: htmlTagNode,
    + rtc: htmlTagNode,
    + sub: htmlTagNode,
    + sup: htmlTagNode,
    + var: htmlTagNode,
    + wbr: htmlTagNode,
    + br: htmlTagNode,
    + dd: htmlTagNode,
    + dl: htmlTagNode,
    + dt: htmlTagNode,
    + em: htmlTagNode,
    + h1: htmlTagNode,
    + h2: htmlTagNode,
    + h3: htmlTagNode,
    + h4: htmlTagNode,
    + h5: htmlTagNode,
    + h6: htmlTagNode,
    + hr: htmlTagNode,
    + li: htmlTagNode,
    + ol: htmlTagNode,
    + rb: htmlTagNode,
    + rp: htmlTagNode,
    + rt: htmlTagNode,
    + td: htmlTagNode,
    + th: htmlTagNode,
    + tr: htmlTagNode,
    + ul: htmlTagNode,
    + a: htmlTagNode,
    + b: htmlTagNode,
    + i: htmlTagNode,
    + p: htmlTagNode,
    + q: htmlTagNode,
    + s: htmlTagNode,
    + u: htmlTagNode,
    + oncanplaythrough: htmlAttributeNode,
    + ondurationchange: htmlAttributeNode,
    + onloadedmetadata: htmlAttributeNode,
    + contenteditable: htmlAttributeNode,
    + "accept-charset": htmlAttributeNode,
    + onbeforeunload: htmlAttributeNode,
    + onvolumechange: htmlAttributeNode,
    + onbeforeprint: htmlAttributeNode,
    + oncontextmenu: htmlAttributeNode,
    + autocomplete: htmlAttributeNode,
    + onafterprint: htmlAttributeNode,
    + onhashchange: htmlAttributeNode,
    + onloadeddata: htmlAttributeNode,
    + onmousewheel: htmlAttributeNode,
    + onratechange: htmlAttributeNode,
    + ontimeupdate: htmlAttributeNode,
    + oncuechange: htmlAttributeNode,
    + ondragenter: htmlAttributeNode,
    + ondragleave: htmlAttributeNode,
    + ondragstart: htmlAttributeNode,
    + onloadstart: htmlAttributeNode,
    + onmousedown: htmlAttributeNode,
    + onmousemove: htmlAttributeNode,
    + onmouseover: htmlAttributeNode,
    + placeholder: htmlAttributeNode,
    + formaction: htmlAttributeNode,
    + "http-equiv": htmlAttributeNode,
    + novalidate: htmlAttributeNode,
    + ondblclick: htmlAttributeNode,
    + ondragover: htmlAttributeNode,
    + onkeypress: htmlAttributeNode,
    + onmouseout: htmlAttributeNode,
    + onpagehide: htmlAttributeNode,
    + onpageshow: htmlAttributeNode,
    + onpopstate: htmlAttributeNode,
    + onprogress: htmlAttributeNode,
    + spellcheck: htmlAttributeNode,
    + accesskey: htmlAttributeNode,
    + autofocus: htmlAttributeNode,
    + draggable: htmlAttributeNode,
    + maxlength: htmlAttributeNode,
    + oncanplay: htmlAttributeNode,
    + ondragend: htmlAttributeNode,
    + onemptied: htmlAttributeNode,
    + oninvalid: htmlAttributeNode,
    + onkeydown: htmlAttributeNode,
    + onmouseup: htmlAttributeNode,
    + onoffline: htmlAttributeNode,
    + onplaying: htmlAttributeNode,
    + onseeking: htmlAttributeNode,
    + onstalled: htmlAttributeNode,
    + onstorage: htmlAttributeNode,
    + onsuspend: htmlAttributeNode,
    + onwaiting: htmlAttributeNode,
    + translate: htmlAttributeNode,
    + autoplay: htmlAttributeNode,
    + controls: htmlAttributeNode,
    + datetime: htmlAttributeNode,
    + disabled: htmlAttributeNode,
    + download: htmlAttributeNode,
    + dropzone: htmlAttributeNode,
    + hreflang: htmlAttributeNode,
    + multiple: htmlAttributeNode,
    + onchange: htmlAttributeNode,
    + ononline: htmlAttributeNode,
    + onresize: htmlAttributeNode,
    + onscroll: htmlAttributeNode,
    + onsearch: htmlAttributeNode,
    + onseeked: htmlAttributeNode,
    + onselect: htmlAttributeNode,
    + onsubmit: htmlAttributeNode,
    + ontoggle: htmlAttributeNode,
    + onunload: htmlAttributeNode,
    + readonly: htmlAttributeNode,
    + required: htmlAttributeNode,
    + reversed: htmlAttributeNode,
    + selected: htmlAttributeNode,
    + tabindex: htmlAttributeNode,
    + bgcolor: htmlAttributeNode,
    + charset: htmlAttributeNode,
    + checked: htmlAttributeNode,
    + colspan: htmlAttributeNode,
    + content: htmlAttributeNode,
    + default: htmlAttributeNode,
    + dirname: htmlAttributeNode,
    + enctype: htmlAttributeNode,
    + headers: htmlAttributeNode,
    + onabort: htmlAttributeNode,
    + onclick: htmlAttributeNode,
    + onended: htmlAttributeNode,
    + onerror: htmlAttributeNode,
    + onfocus: htmlAttributeNode,
    + oninput: htmlAttributeNode,
    + onkeyup: htmlAttributeNode,
    + onpaste: htmlAttributeNode,
    + onpause: htmlAttributeNode,
    + onreset: htmlAttributeNode,
    + onwheel: htmlAttributeNode,
    + optimum: htmlAttributeNode,
    + pattern: htmlAttributeNode,
    + preload: htmlAttributeNode,
    + rowspan: htmlAttributeNode,
    + sandbox: htmlAttributeNode,
    + srclang: htmlAttributeNode,
    + accept: htmlAttributeNode,
    + action: htmlAttributeNode,
    + border: htmlAttributeNode,
    + coords: htmlAttributeNode,
    + height: htmlAttributeNode,
    + hidden: htmlAttributeNode,
    + method: htmlAttributeNode,
    + onblur: htmlAttributeNode,
    + oncopy: htmlAttributeNode,
    + ondrag: htmlAttributeNode,
    + ondrop: htmlAttributeNode,
    + onload: htmlAttributeNode,
    + onplay: htmlAttributeNode,
    + poster: htmlAttributeNode,
    + srcdoc: htmlAttributeNode,
    + srcset: htmlAttributeNode,
    + target: htmlAttributeNode,
    + usemap: htmlAttributeNode,
    + align: htmlAttributeNode,
    + async: htmlAttributeNode,
    + class: htmlAttributeNode,
    + color: htmlAttributeNode,
    + defer: htmlAttributeNode,
    + ismap: htmlAttributeNode,
    + media: htmlAttributeNode,
    + muted: htmlAttributeNode,
    + oncut: htmlAttributeNode,
    + scope: htmlAttributeNode,
    + shape: htmlAttributeNode,
    + sizes: htmlAttributeNode,
    + start: htmlAttributeNode,
    + style: htmlAttributeNode,
    + title: htmlAttributeNode,
    + value: htmlAttributeNode,
    + width: htmlAttributeNode,
    + cols: htmlAttributeNode,
    + high: htmlAttributeNode,
    + href: htmlAttributeNode,
    + kind: htmlAttributeNode,
    + lang: htmlAttributeNode,
    + list: htmlAttributeNode,
    + loop: htmlAttributeNode,
    + name: htmlAttributeNode,
    + open: htmlAttributeNode,
    + rows: htmlAttributeNode,
    + size: htmlAttributeNode,
    + step: htmlAttributeNode,
    + type: htmlAttributeNode,
    + wrap: htmlAttributeNode,
    + alt: htmlAttributeNode,
    + dir: htmlAttributeNode,
    + for: htmlAttributeNode,
    + low: htmlAttributeNode,
    + max: htmlAttributeNode,
    + min: htmlAttributeNode,
    + rel: htmlAttributeNode,
    + src: htmlAttributeNode,
    + id: htmlAttributeNode,
    + lineShiftClickCommand: stumpExtendedAttributeNode,
    + contextMenuCommand: stumpExtendedAttributeNode,
    + doubleClickCommand: stumpExtendedAttributeNode,
    + shiftClickCommand: stumpExtendedAttributeNode,
    + lineClickCommand: stumpExtendedAttributeNode,
    + changeCommand: stumpExtendedAttributeNode,
    + clickCommand: stumpExtendedAttributeNode,
    + blurCommand: stumpExtendedAttributeNode,
    + collapse: stumpExtendedAttributeNode,
    + bern: bernNode,
    + }),
    + [{ regex: /^$/, nodeConstructor: blankLineNode }]
    + )
    + }
    + get htmlTagNameCell() {
    + return this.getWord(0)
    + }
    + get anyHtmlContentCell() {
    + return this.getWordsFrom(1)
    + }
    + getTag() {
    + // we need to remove the "Tag" bit to handle the style and title attribute/tag conflict.
    + const firstWord = this.getFirstWord()
    + const map = {
    + titleTag: "title",
    + styleTag: "style",
    + }
    + return map[firstWord] || firstWord
    + }
    + _getHtmlJoinByCharacter() {
    + return ""
    + }
    + toHtmlWithSuids() {
    + return this._toHtml(undefined, true)
    + }
    + _getOneLiner() {
    + const oneLinerWords = this.getWordsFrom(1)
    + return oneLinerWords.length ? oneLinerWords.join(" ") : ""
    + }
    + getTextContent() {
    + return this._getOneLiner()
    + }
    + shouldCollapse() {
    + return this.has("collapse")
    + }
    + _toHtml(indentCount, withSuid) {
    + const tag = this.getTag()
    + const children = this.map((child) => child._toHtml(indentCount + 1, withSuid)).join("")
    + const attributesStr = this.filter((node) => node.isAttributeNode)
    + .map((child) => child.getAttribute())
    + .join("")
    + const indent = " ".repeat(indentCount)
    + const collapse = this.shouldCollapse()
    + const indentForChildNodes = !collapse && this.getChildInstancesOfNodeTypeId("htmlTagNode").length > 0
    + const suid = withSuid ? ` stumpUid="${this._getUid()}"` : ""
    + const oneLiner = this._getOneLiner()
    + return `${!collapse ? indent : ""}<${tag}${attributesStr}${suid}>${oneLiner}${indentForChildNodes ? "\n" : ""}${children}${collapse ? "" : "\n"}`
    + }
    + removeCssStumpNode() {
    + return this.removeStumpNode()
    + }
    + removeStumpNode() {
    + this.getShadow().removeShadow()
    + return this.destroy()
    + }
    + getNodeByGuid(guid) {
    + return this.getTopDownArray().find((node) => node._getUid() === guid)
    + }
    + addClassToStumpNode(className) {
    + const classNode = this.touchNode("class")
    + const words = classNode.getWordsFrom(1)
    + // note: we call add on shadow regardless, because at the moment stump may have gotten out of
    + // sync with shadow, if things modified the dom. todo: cleanup.
    + this.getShadow().addClassToShadow(className)
    + if (words.includes(className)) return this
    + words.push(className)
    + classNode.setContent(words.join(this.getWordBreakSymbol()))
    + return this
    + }
    + removeClassFromStumpNode(className) {
    + const classNode = this.getNode("class")
    + if (!classNode) return this
    + const newClasses = classNode.getWords().filter((word) => word !== className)
    + if (!newClasses.length) classNode.destroy()
    + else classNode.setContent(newClasses.join(" "))
    + this.getShadow().removeClassFromShadow(className)
    + return this
    + }
    + stumpNodeHasClass(className) {
    + const classNode = this.getNode("class")
    + return classNode && classNode.getWords().includes(className) ? true : false
    + }
    + isStumpNodeCheckbox() {
    + return this.get("type") === "checkbox"
    + }
    + getShadow() {
    + if (!this._shadow) {
    + const shadowClass = this.getShadowClass()
    + this._shadow = new shadowClass(this)
    + }
    + return this._shadow
    + }
    + insertCssChildNode(text, index) {
    + return this.insertChildNode(text, index)
    + }
    + insertChildNode(text, index) {
    + const singleNode = new jtree.TreeNode(text).getChildren()[0]
    + const newNode = this.insertLineAndChildren(singleNode.getLine(), singleNode.childrenToString(), index)
    + const stumpNodeIndex = this.getChildInstancesOfNodeTypeId("htmlTagNode").indexOf(newNode)
    + this.getShadow().insertHtmlNode(newNode, stumpNodeIndex)
    + return newNode
    + }
    + isInputType() {
    + return ["input", "textarea"].includes(this.getTag()) || this.get("contenteditable") === "true"
    + }
    + findStumpNodeByChild(line) {
    + return this.findStumpNodesByChild(line)[0]
    + }
    + findStumpNodeByChildString(line) {
    + return this.getTopDownArray().find((node) =>
    + node
    + .map((child) => child.getLine())
    + .join("\n")
    + .includes(line)
    + )
    + }
    + findStumpNodeByFirstWord(firstWord) {
    + return this._findStumpNodesByBase(firstWord)[0]
    + }
    + _findStumpNodesByBase(firstWord) {
    + return this.getTopDownArray().filter((node) => node.doesExtend("htmlTagNode") && node.getFirstWord() === firstWord)
    + }
    + hasLine(line) {
    + return this.getChildren().some((node) => node.getLine() === line)
    + }
    + findStumpNodesByChild(line) {
    + return this.getTopDownArray().filter((node) => node.doesExtend("htmlTagNode") && node.hasLine(line))
    + }
    + findStumpNodesWithClass(className) {
    + return this.getTopDownArray().filter((node) => node.doesExtend("htmlTagNode") && node.has("class") && node.getNode("class").getWords().includes(className))
    + }
    + getShadowClass() {
    + return this.getParent().getShadowClass()
    + }
    + // todo: should not be here
    + getStumpNodeTreeComponent() {
    + return this._treeComponent || this.getParent().getStumpNodeTreeComponent()
    + }
    + // todo: should not be here
    + setStumpNodeTreeComponent(treeComponent) {
    + this._treeComponent = treeComponent
    + return this
    + }
    + setStumpNodeCss(css) {
    + this.getShadow().setShadowCss(css)
    + return this
    + }
    + getStumpNodeCss(prop) {
    + return this.getShadow().getShadowCss(prop)
    + }
    + getStumpNodeAttr(key) {
    + return this.get(key)
    + }
    + setStumpNodeAttr(key, value) {
    + // todo
    + return this
    + }
    + toHtml() {
    + return this._toHtml()
    + }
    + }
    +
    + class errorNode extends jtree.GrammarBackedNode {
    + getErrors() {
    + return this._getErrorNodeErrors()
    + }
    + }
    +
    + class htmlAttributeNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(errorNode, undefined, undefined)
    + }
    + get htmlAttributeNameCell() {
    + return this.getWord(0)
    + }
    + get attributeValueCell() {
    + return this.getWordsFrom(1)
    + }
    + get isTileAttribute() {
    + return true
    + }
    + get isAttributeNode() {
    + return true
    + }
    + _toHtml() {
    + return ""
    + }
    + getTextContent() {
    + return ""
    + }
    + getAttribute() {
    + return ` ${this.getFirstWord()}="${this.getContent()}"`
    + }
    + }
    +
    + class stumpExtendedAttributeNode extends htmlAttributeNode {
    + get stumpExtendedAttributeNameCell() {
    + return this.getWord(0)
    + }
    + }
    +
    + class lineOfHtmlContentNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(lineOfHtmlContentNode, undefined, undefined)
    + }
    + get anyHtmlContentCell() {
    + return this.getWordsFrom(0)
    + }
    + get isTileAttribute() {
    + return true
    + }
    + getTextContent() {
    + return this.getLine()
    + }
    + }
    +
    + class bernNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(lineOfHtmlContentNode, undefined, undefined)
    + }
    + get bernKeywordCell() {
    + return this.getWord(0)
    + }
    + get isTileAttribute() {
    + return true
    + }
    + _toHtml() {
    + return this.childrenToString()
    + }
    + getTextContent() {
    + return ""
    + }
    + }
    +
    + window.stumpNode = stumpNode
    - /**
    - * Get case-insensitive `field` value.
    - *
    - * @param {String} field
    - * @return {String}
    - * @api public
    - */
    -
    -
    - ResponseBase.prototype.get = function (field) {
    - return this.header[field.toLowerCase()];
    - };
    - /**
    - * Set header related properties:
    - *
    - * - `.type` the content type without params
    - *
    - * A response of "Content-Type: text/plain; charset=utf-8"
    - * will provide you with a `.type` of "text/plain".
    - *
    - * @param {Object} header
    - * @api private
    - */
    -
    -
    - ResponseBase.prototype._setHeaderProperties = function (header) {
    - // TODO: moar!
    - // TODO: make this a util
    - // content-type
    - var ct = header['content-type'] || '';
    - this.type = utils.type(ct); // params
    -
    - var params = utils.params(ct);
    -
    - for (var key in params) {
    - if (Object.prototype.hasOwnProperty.call(params, key)) this[key] = params[key];
    - }
    -
    - this.links = {}; // links
    -
    - try {
    - if (header.link) {
    - this.links = utils.parseLinks(header.link);
    - }
    - } catch (err) {// ignore
    - }
    - };
    - /**
    - * Set flags such as `.ok` based on `status`.
    - *
    - * For example a 2xx response will give you a `.ok` of __true__
    - * whereas 5xx will be __false__ and `.error` will be __true__. The
    - * `.clientError` and `.serverError` are also available to be more
    - * specific, and `.statusType` is the class of error ranging from 1..5
    - * sometimes useful for mapping respond colors etc.
    - *
    - * "sugar" properties are also defined for common cases. Currently providing:
    - *
    - * - .noContent
    - * - .badRequest
    - * - .unauthorized
    - * - .notAcceptable
    - * - .notFound
    - *
    - * @param {Number} status
    - * @api private
    - */
    -
    -
    - ResponseBase.prototype._setStatusProperties = function (status) {
    - var type = status / 100 | 0; // status / class
    -
    - this.statusCode = status;
    - this.status = this.statusCode;
    - this.statusType = type; // basics
    -
    - this.info = type === 1;
    - this.ok = type === 2;
    - this.redirect = type === 3;
    - this.clientError = type === 4;
    - this.serverError = type === 5;
    - this.error = type === 4 || type === 5 ? this.toError() : false; // sugar
    -
    - this.created = status === 201;
    - this.accepted = status === 202;
    - this.noContent = status === 204;
    - this.badRequest = status === 400;
    - this.unauthorized = status === 401;
    - this.notAcceptable = status === 406;
    - this.forbidden = status === 403;
    - this.notFound = status === 404;
    - this.unprocessableEntity = status === 422;
    - };
    -
    - },{"./utils":8}],8:[function(require,module,exports){
    - "use strict";
    -
    - /**
    - * Return the mime type for the given `str`.
    - *
    - * @param {String} str
    - * @return {String}
    - * @api private
    - */
    - exports.type = function (str) {
    - return str.split(/ *; */).shift();
    - };
    - /**
    - * Return header field parameters.
    - *
    - * @param {String} str
    - * @return {Object}
    - * @api private
    - */
    -
    -
    - exports.params = function (str) {
    - return str.split(/ *; */).reduce(function (obj, str) {
    - var parts = str.split(/ *= */);
    - var key = parts.shift();
    - var val = parts.shift();
    - if (key && val) obj[key] = val;
    - return obj;
    - }, {});
    - };
    - /**
    - * Parse Link header fields.
    - *
    - * @param {String} str
    - * @return {Object}
    - * @api private
    - */
    -
    -
    - exports.parseLinks = function (str) {
    - return str.split(/ *, */).reduce(function (obj, str) {
    - var parts = str.split(/ *; */);
    - var url = parts[0].slice(1, -1);
    - var rel = parts[1].split(/ *= */)[1].slice(1, -1);
    - obj[rel] = url;
    - return obj;
    - }, {});
    - };
    - /**
    - * Strip content related fields from `header`.
    - *
    - * @param {Object} header
    - * @return {Object} header
    - * @api private
    - */
    -
    -
    - exports.cleanHeader = function (header, changesOrigin) {
    - delete header['content-type'];
    - delete header['content-length'];
    - delete header['transfer-encoding'];
    - delete header.host; // secuirty
    -
    - if (changesOrigin) {
    - delete header.authorization;
    - delete header.cookie;
    - }
    -
    - return header;
    - };
    -
    - },{}]},{},[5])(5)
    - });
    - ;
    -
    - /* mousetrap v1.6.3 craig.is/killing/mice */
    - (function(q,u,c){function v(a,b,g){a.addEventListener?a.addEventListener(b,g,!1):a.attachEvent("on"+b,g)}function z(a){if("keypress"==a.type){var b=String.fromCharCode(a.which);a.shiftKey||(b=b.toLowerCase());return b}return n[a.which]?n[a.which]:r[a.which]?r[a.which]:String.fromCharCode(a.which).toLowerCase()}function F(a){var b=[];a.shiftKey&&b.push("shift");a.altKey&&b.push("alt");a.ctrlKey&&b.push("ctrl");a.metaKey&&b.push("meta");return b}function w(a){return"shift"==a||"ctrl"==a||"alt"==a||
    - "meta"==a}function A(a,b){var g,d=[];var e=a;"+"===e?e=["+"]:(e=e.replace(/\+{2}/g,"+plus"),e=e.split("+"));for(g=0;gc||n.hasOwnProperty(c)&&(p[n[c]]=c)}g=p[e]?"keydown":"keypress"}"keypress"==g&&d.length&&(g="keydown");return{key:m,modifiers:d,action:g}}function D(a,b){return null===a||a===u?!1:a===b?!0:D(a.parentNode,b)}function d(a){function b(a){a=
    - a||{};var b=!1,l;for(l in p)a[l]?b=!0:p[l]=0;b||(x=!1)}function g(a,b,t,f,g,d){var l,E=[],h=t.type;if(!k._callbacks[a])return[];"keyup"==h&&w(a)&&(b=[a]);for(l=0;l
    - b.target||b.srcElement,c,f)||!1!==a(b,c)||(b.preventDefault?b.preventDefault():b.returnValue=!1,b.stopPropagation?b.stopPropagation():b.cancelBubble=!0)}function e(a){"number"!==typeof a.which&&(a.which=a.keyCode);var b=z(a);b&&("keyup"==a.type&&y===b?y=!1:k.handleKey(b,F(a),a))}function m(a,g,t,f){function h(c){return function(){x=c;++p[a];clearTimeout(q);q=setTimeout(b,1E3)}}function l(g){c(t,g,a);"keyup"!==f&&(y=z(g));setTimeout(b,10)}for(var d=p[a]=0;d
    - A(g[d+1]).action);n(g[d],e,f,a,d)}}function n(a,b,c,f,d){k._directMap[a+":"+c]=b;a=a.replace(/\s+/g," ");var e=a.split(" ");1
    - d,e){var f=g(a,d,e),h;d={};var k=0,l=!1;for(h=0;h
    - 18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},r={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},C={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},B={option:"alt",command:"meta","return":"enter",
    - escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},p;for(c=1;20>c;++c)n[111+c]="f"+c;for(c=0;9>=c;++c)n[c+96]=c.toString();d.prototype.bind=function(a,b,c){a=a instanceof Array?a:[a];this._bindMultiple.call(this,a,b,c);return this};d.prototype.unbind=function(a,b){return this.bind.call(this,a,function(){},b)};d.prototype.trigger=function(a,b){if(this._directMap[a+":"+b])this._directMap[a+":"+b]({},a);return this};d.prototype.reset=function(){this._callbacks={};
    - this._directMap={};return this};d.prototype.stopCallback=function(a,b){if(-1<(" "+b.className+" ").indexOf(" mousetrap ")||D(b,this.target))return!1;if("composedPath"in a&&"function"===typeof a.composedPath){var c=a.composedPath()[0];c!==a.target&&(b=c)}return"INPUT"==b.tagName||"SELECT"==b.tagName||"TEXTAREA"==b.tagName||b.isContentEditable};d.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)};d.addKeycodes=function(a){for(var b in a)a.hasOwnProperty(b)&&(n[b]=a[b]);p=null};
    - d.init=function(){var a=d(u),b;for(b in a)"_"!==b.charAt(0)&&(d[b]=function(b){return function(){return a[b].apply(a,arguments)}}(b))};d.init();q.Mousetrap=d;"undefined"!==typeof module&&module.exports&&(module.exports=d);"function"===typeof define&&define.amd&&define(function(){return d})}})("undefined"!==typeof window?window:null,"undefined"!==typeof window?document:null);
    - ;
    -
    - /*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */
    - !function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(m.childNodes),m.childNodes),t.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&((e?e.ownerDocument||e:m)!==C&&T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!A[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&U.test(t)){(s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=k),o=(l=h(t)).length;while(o--)l[o]="#"+s+" "+xe(l[o]);c=l.join(","),f=ee.test(t)&&ye(e.parentNode)||e}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){A(t,!0)}finally{s===k&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[k]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:m;return r!==C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),m!==C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=k,!C.getElementsByName||!C.getElementsByName(k).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("sallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+k+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+k+"+*").length||v.push(".#.+[+~]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",$)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e===C||e.ownerDocument===m&&y(m,e)?-1:t===C||t.ownerDocument===m&&y(m,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===C?-1:t===C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]===m?-1:s[r]===m?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if((e.ownerDocument||e)!==C&&T(e),d.matchesSelector&&E&&!A[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){A(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=p[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&p(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?k.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?k.grep(e,function(e){return e===n!==r}):"string"!=typeof n?k.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(k.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:L.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof k?t[0]:t,k.merge(this,k.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),D.test(r[1])&&k.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(k):k.makeArray(e,this)}).prototype=k.fn,q=k(E);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}k.fn.extend({has:function(e){var t=k(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;nx",y.noCloneChecked=!!me.cloneNode(!0).lastChild.defaultValue;var Te=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ee=/^([^.]*)(?:\.(.+)|)/;function ke(){return!0}function Se(){return!1}function Ne(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ae(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ae(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Se;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return k().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=k.guid++)),e.each(function(){k.event.add(this,t,i,r,n)})}function De(e,i,o){o?(Q.set(e,i,!1),k.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Q.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(k.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Q.set(this,i,r),t=o(this,i),this[i](),r!==(n=Q.get(this,i))||t?Q.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Q.set(this,i,{value:k.event.trigger(k.extend(r[0],k.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Q.get(e,i)&&k.event.add(e,i,ke)}k.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.get(t);if(v){n.handler&&(n=(o=n).handler,i=o.selector),i&&k.find.matchesSelector(ie,i),n.guid||(n.guid=k.guid++),(u=v.events)||(u=v.events={}),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof k&&k.event.triggered!==e.type?k.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(R)||[""]).length;while(l--)d=g=(s=Ee.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=k.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=k.event.special[d]||{},c=k.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&k.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),k.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.hasData(e)&&Q.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(R)||[""]).length;while(l--)if(d=g=(s=Ee.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=k.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||k.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)k.event.remove(e,d+t[l],n,r,!0);k.isEmptyObject(u)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=k.event.fix(e),u=new Array(arguments.length),l=(Q.get(this,"events")||{})[s.type]||[],c=k.event.special[s.type]||{};for(u[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,qe=/\s*$/g;function Oe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function Pe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Me(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(Q.hasData(e)&&(o=Q.access(e),a=Q.set(t,o),l=o.events))for(i in delete a.handle,a.events={},l)for(n=0,r=l[i].length;n")},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=oe(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||k.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Vt,Gt=[],Yt=/(=)\?(?=&|$)|\?\?/;k.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Gt.pop()||k.expando+"_"+kt++;return this[e]=!0,e}}),k.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Yt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Yt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Yt,"$1"+r):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||k.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?k(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Gt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Vt=E.implementation.createHTMLDocument("").body).innerHTML="
    ",2===Vt.childNodes.length),k.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=D.exec(e))?[t.createElement(i[1])]:(i=we([e],t,o),o&&o.length&&k(o).remove(),k.merge([],i.childNodes)));var r,i,o},k.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(k.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},k.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){k.fn[t]=function(e){return this.on(t,e)}}),k.expr.pseudos.animated=function(t){return k.grep(k.timers,function(e){return t===e.elem}).length},k.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=k.css(e,"position"),c=k(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=k.css(e,"top"),u=k.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,k.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},k.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){k.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===k.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===k.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=k(e).offset()).top+=k.css(e,"borderTopWidth",!0),i.left+=k.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-k.css(r,"marginTop",!0),left:t.left-i.left-k.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===k.css(e,"position"))e=e.offsetParent;return e||ie})}}),k.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;k.fn[t]=function(e){return _(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),k.each(["top","left"],function(e,n){k.cssHooks[n]=ze(y.pixelPosition,function(e,t){if(t)return t=_e(e,n),$e.test(t)?k(e).position()[n]+"px":t})}),k.each({Height:"height",Width:"width"},function(a,s){k.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){k.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return _(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?k.css(e,t,i):k.style(e,t,n,i)},s,n?e:void 0,n)}})}),k.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){k.fn[n]=function(e,t){return 0
    - ;
    -
    - // CodeMirror, copyright (c) by Marijn Haverbeke and others
    - // Distributed under an MIT license: https://codemirror.net/LICENSE
    -
    - // This is CodeMirror (https://codemirror.net), a code editor
    - // implemented in JavaScript on top of the browser's DOM.
    - //
    - // You can find some technical background for some of the code below
    - // at http://marijnhaverbeke.nl/blog/#cm-internals .
    -
    - (function (global, factory) {
    - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
    - typeof define === 'function' && define.amd ? define(factory) :
    - (global.CodeMirror = factory());
    - }(this, (function () { 'use strict';
    -
    - // Kludges for bugs and behavior differences that can't be feature
    - // detected are enabled based on userAgent etc sniffing.
    - var userAgent = navigator.userAgent;
    - var platform = navigator.platform;
    -
    - var gecko = /gecko\/\d/i.test(userAgent);
    - var ie_upto10 = /MSIE \d/.test(userAgent);
    - var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
    - var edge = /Edge\/(\d+)/.exec(userAgent);
    - var ie = ie_upto10 || ie_11up || edge;
    - var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
    - var webkit = !edge && /WebKit\//.test(userAgent);
    - var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
    - var chrome = !edge && /Chrome\//.test(userAgent);
    - var presto = /Opera\//.test(userAgent);
    - var safari = /Apple Computer/.test(navigator.vendor);
    - var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
    - var phantom = /PhantomJS/.test(userAgent);
    -
    - var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent);
    - var android = /Android/.test(userAgent);
    - // This is woefully incomplete. Suggestions for alternative methods welcome.
    - var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
    - var mac = ios || /Mac/.test(platform);
    - var chromeOS = /\bCrOS\b/.test(userAgent);
    - var windows = /win/i.test(platform);
    -
    - var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
    - if (presto_version) { presto_version = Number(presto_version[1]); }
    - if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
    - // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
    - var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
    - var captureRightClick = gecko || (ie && ie_version >= 9);
    -
    - function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
    -
    - var rmClass = function(node, cls) {
    - var current = node.className;
    - var match = classTest(cls).exec(current);
    - if (match) {
    - var after = current.slice(match.index + match[0].length);
    - node.className = current.slice(0, match.index) + (after ? match[1] + after : "");
    - }
    - };
    -
    - function removeChildren(e) {
    - for (var count = e.childNodes.length; count > 0; --count)
    - { e.removeChild(e.firstChild); }
    - return e
    - }
    -
    - function removeChildrenAndAdd(parent, e) {
    - return removeChildren(parent).appendChild(e)
    - }
    -
    - function elt(tag, content, className, style) {
    - var e = document.createElement(tag);
    - if (className) { e.className = className; }
    - if (style) { e.style.cssText = style; }
    - if (typeof content == "string") { e.appendChild(document.createTextNode(content)); }
    - else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }
    - return e
    - }
    - // wrapper for elt, which removes the elt from the accessibility tree
    - function eltP(tag, content, className, style) {
    - var e = elt(tag, content, className, style);
    - e.setAttribute("role", "presentation");
    - return e
    - }
    -
    - var range;
    - if (document.createRange) { range = function(node, start, end, endNode) {
    - var r = document.createRange();
    - r.setEnd(endNode || node, end);
    - r.setStart(node, start);
    - return r
    - }; }
    - else { range = function(node, start, end) {
    - var r = document.body.createTextRange();
    - try { r.moveToElementText(node.parentNode); }
    - catch(e) { return r }
    - r.collapse(true);
    - r.moveEnd("character", end);
    - r.moveStart("character", start);
    - return r
    - }; }
    -
    - function contains(parent, child) {
    - if (child.nodeType == 3) // Android browser always returns false when child is a textnode
    - { child = child.parentNode; }
    - if (parent.contains)
    - { return parent.contains(child) }
    - do {
    - if (child.nodeType == 11) { child = child.host; }
    - if (child == parent) { return true }
    - } while (child = child.parentNode)
    - }
    -
    - function activeElt() {
    - // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
    - // IE < 10 will throw when accessed while the page is loading or in an iframe.
    - // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
    - var activeElement;
    - try {
    - activeElement = document.activeElement;
    - } catch(e) {
    - activeElement = document.body || null;
    - }
    - while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
    - { activeElement = activeElement.shadowRoot.activeElement; }
    - return activeElement
    - }
    -
    - function addClass(node, cls) {
    - var current = node.className;
    - if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls; }
    - }
    - function joinClasses(a, b) {
    - var as = a.split(" ");
    - for (var i = 0; i < as.length; i++)
    - { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i]; } }
    - return b
    - }
    -
    - var selectInput = function(node) { node.select(); };
    - if (ios) // Mobile Safari apparently has a bug where select() is broken.
    - { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }
    - else if (ie) // Suppress mysterious IE10 errors
    - { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }
    -
    - function bind(f) {
    - var args = Array.prototype.slice.call(arguments, 1);
    - return function(){return f.apply(null, args)}
    + {
    + class fireNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + errorNode,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    + block: blockNode,
    + function: functionNode,
    + if: ifNode,
    + while: whileNode,
    + divide: divideNode,
    + modulo: moduloNode,
    + multiply: multiplyNode,
    + substract: substractNode,
    + add: addNode,
    + greaterThan: greaterThanNode,
    + greaterThanOrEqual: greaterThanOrEqualNode,
    + lessThan: lessThanNode,
    + lessThanOrEqual: lessThanOrEqualNode,
    + sum: sumNode,
    + boolean: booleanNode,
    + callFunctionAndSet: callFunctionAndSetNode,
    + callMethodAndSet: callMethodAndSetNode,
    + join: joinNode,
    + mutableNumber: mutableNumberNode,
    + number: numberNode,
    + numbers: numbersNode,
    + string: stringNode,
    + callFunction: callFunctionNode,
    + decrement: decrementNode,
    + dumpIdentifier: dumpIdentifierNode,
    + export: exportNode,
    + increment: incrementNode,
    + printNumber: printNumberNode,
    + printString: printStringNode,
    + require: requireNode,
    + return: returnNode,
    + "#!": hashbangNode,
    + }),
    + undefined
    + )
    + }
    + async execute() {
    + let outputLines = []
    + const _originalConsoleLog = console.log
    + const tempConsoleLog = (...params) => outputLines.push(params)
    + console.log = tempConsoleLog
    + const compiled = this.compile("js")
    + eval(compiled)
    + console.log = _originalConsoleLog
    + console.log(outputLines.join("\n"))
    + return outputLines
    + }
    + getHandGrammarProgram() {
    + if (!this._cachedHandGrammarProgramRoot)
    + this._cachedHandGrammarProgramRoot = new jtree.HandGrammarProgram(`tooling onsave jtree build produceLang fire
    + todo Explore best ways to add polymorphism
    + anyCell
    + booleanCell
    + enum false true
    + filepathCell
    + identifierCell
    + regex [$A-Za-z_][0-9a-zA-Z_$]*
    + highlightScope variable
    + examples myVarA someVarB
    + numberCell
    + regex \\-?[0-9]*\\.?[0-9]*
    + highlightScope constant.numeric
    + numberIdentifierCell
    + extends identifierCell
    + hashBangCell
    + highlightScope comment
    + hashBangKeywordCell
    + highlightScope comment
    + stringCell
    + highlightScope string
    + booleanIdentifierCell
    + extends identifierCell
    + functionIdentifierCell
    + extends identifierCell
    + identifiersCell
    + extends identifierCell
    + instanceIdentifierCell
    + extends identifierCell
    + methodIdentifierCell
    + extends identifierCell
    + resultIdentifierCell
    + extends identifierCell
    + keywordCell
    + highlightScope keyword
    + stringIdentifierCell
    + extends identifierCell
    + stringCellsCell
    + extends stringCell
    + leftNumberCell
    + extends numberCell
    + leftAnyCell
    + extends anyCell
    + fireNode
    + root
    + description A useless prefix Tree Language that compiles to Javascript for testing Tree Notation features.
    + compilesTo js
    + inScope hashbangNode abstractTerminalNode abstractNonTerminalNode
    + catchAllNodeType errorNode
    + javascript
    + async execute() {
    + let outputLines = []
    + const _originalConsoleLog = console.log
    + const tempConsoleLog = (...params) => outputLines.push(params)
    + console.log = tempConsoleLog
    + const compiled = this.compile("js")
    + eval(compiled)
    + console.log = _originalConsoleLog
    + console.log(outputLines.join("\\n"))
    + return outputLines
    -
    - function copyObj(obj, target, overwrite) {
    - if (!target) { target = {}; }
    - for (var prop in obj)
    - { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
    - { target[prop] = obj[prop]; } }
    - return target
    - }
    -
    - // Counts the column offset in a string, taking tabs into account.
    - // Used mostly to find indentation.
    - function countColumn(string, end, tabSize, startIndex, startValue) {
    - if (end == null) {
    - end = string.search(/[^\s\u00a0]/);
    - if (end == -1) { end = string.length; }
    - }
    - for (var i = startIndex || 0, n = startValue || 0;;) {
    - var nextTab = string.indexOf("\t", i);
    - if (nextTab < 0 || nextTab >= end)
    - { return n + (end - i) }
    - n += nextTab - i;
    - n += tabSize - (n % tabSize);
    - i = nextTab + 1;
    - }
    - }
    -
    - var Delayed = function() {this.id = null;};
    - Delayed.prototype.set = function (ms, f) {
    - clearTimeout(this.id);
    - this.id = setTimeout(f, ms);
    - };
    -
    - function indexOf(array, elt) {
    - for (var i = 0; i < array.length; ++i)
    - { if (array[i] == elt) { return i } }
    - return -1
    - }
    -
    - // Number of pixels added to scroller and sizer to hide scrollbar
    - var scrollerGap = 30;
    -
    - // Returned or thrown by various protocols to signal 'I'm not
    - // handling this'.
    - var Pass = {toString: function(){return "CodeMirror.Pass"}};
    -
    - // Reused option objects for setSelection & friends
    - var sel_dontScroll = {scroll: false}, sel_mouse = {origin: "*mouse"}, sel_move = {origin: "+move"};
    -
    - // The inverse of countColumn -- find the offset that corresponds to
    - // a particular column.
    - function findColumn(string, goal, tabSize) {
    - for (var pos = 0, col = 0;;) {
    - var nextTab = string.indexOf("\t", pos);
    - if (nextTab == -1) { nextTab = string.length; }
    - var skipped = nextTab - pos;
    - if (nextTab == string.length || col + skipped >= goal)
    - { return pos + Math.min(skipped, goal - col) }
    - col += nextTab - pos;
    - col += tabSize - (col % tabSize);
    - pos = nextTab + 1;
    - if (col >= goal) { return pos }
    - }
    - }
    -
    - var spaceStrs = [""];
    - function spaceStr(n) {
    - while (spaceStrs.length <= n)
    - { spaceStrs.push(lst(spaceStrs) + " "); }
    - return spaceStrs[n]
    - }
    -
    - function lst(arr) { return arr[arr.length-1] }
    -
    - function map(array, f) {
    - var out = [];
    - for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }
    - return out
    - }
    -
    - function insertSorted(array, value, score) {
    - var pos = 0, priority = score(value);
    - while (pos < array.length && score(array[pos]) <= priority) { pos++; }
    - array.splice(pos, 0, value);
    - }
    -
    - function nothing() {}
    -
    - function createObj(base, props) {
    - var inst;
    - if (Object.create) {
    - inst = Object.create(base);
    - } else {
    - nothing.prototype = base;
    - inst = new nothing();
    - }
    - if (props) { copyObj(props, inst); }
    - return inst
    - }
    -
    - var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
    - function isWordCharBasic(ch) {
    - return /\w/.test(ch) || ch > "\x80" &&
    - (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
    - }
    - function isWordChar(ch, helper) {
    - if (!helper) { return isWordCharBasic(ch) }
    - if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
    - return helper.test(ch)
    - }
    -
    - function isEmpty(obj) {
    - for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
    - return true
    - }
    -
    - // Extending unicode characters. A series of a non-extending char +
    - // any number of extending chars is treated as a single unit as far
    - // as editing and measuring is concerned. This is not fully correct,
    - // since some scripts/fonts/browsers also treat other configurations
    - // of code points as a group.
    - var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;
    - function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
    -
    - // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
    - function skipExtendingChars(str, pos, dir) {
    - while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }
    - return pos
    - }
    -
    - // Returns the value from the range [`from`; `to`] that satisfies
    - // `pred` and is closest to `from`. Assumes that at least `to`
    - // satisfies `pred`. Supports `from` being greater than `to`.
    - function findFirst(pred, from, to) {
    - // At any point we are certain `to` satisfies `pred`, don't know
    - // whether `from` does.
    - var dir = from > to ? -1 : 1;
    - for (;;) {
    - if (from == to) { return from }
    - var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF);
    - if (mid == from) { return pred(mid) ? from : to }
    - if (pred(mid)) { to = mid; }
    - else { from = mid + dir; }
    - }
    - }
    -
    - // BIDI HELPERS
    -
    - function iterateBidiSections(order, from, to, f) {
    - if (!order) { return f(from, to, "ltr", 0) }
    - var found = false;
    - for (var i = 0; i < order.length; ++i) {
    - var part = order[i];
    - if (part.from < to && part.to > from || from == to && part.to == from) {
    - f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr", i);
    - found = true;
    - }
    - }
    - if (!found) { f(from, to, "ltr"); }
    - }
    -
    - var bidiOther = null;
    - function getBidiPartAt(order, ch, sticky) {
    - var found;
    - bidiOther = null;
    - for (var i = 0; i < order.length; ++i) {
    - var cur = order[i];
    - if (cur.from < ch && cur.to > ch) { return i }
    - if (cur.to == ch) {
    - if (cur.from != cur.to && sticky == "before") { found = i; }
    - else { bidiOther = i; }
    - }
    - if (cur.from == ch) {
    - if (cur.from != cur.to && sticky != "before") { found = i; }
    - else { bidiOther = i; }
    - }
    - }
    - return found != null ? found : bidiOther
    - }
    -
    - // Bidirectional ordering algorithm
    - // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
    - // that this (partially) implements.
    -
    - // One-char codes used for character types:
    - // L (L): Left-to-Right
    - // R (R): Right-to-Left
    - // r (AL): Right-to-Left Arabic
    - // 1 (EN): European Number
    - // + (ES): European Number Separator
    - // % (ET): European Number Terminator
    - // n (AN): Arabic Number
    - // , (CS): Common Number Separator
    - // m (NSM): Non-Spacing Mark
    - // b (BN): Boundary Neutral
    - // s (B): Paragraph Separator
    - // t (S): Segment Separator
    - // w (WS): Whitespace
    - // N (ON): Other Neutrals
    -
    - // Returns null if characters are ordered as they appear
    - // (left-to-right), or an array of sections ({from, to, level}
    - // objects) in the order in which they occur visually.
    - var bidiOrdering = (function() {
    - // Character types for codepoints 0 to 0xff
    - var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";
    - // Character types for codepoints 0x600 to 0x6f9
    - var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";
    - function charType(code) {
    - if (code <= 0xf7) { return lowTypes.charAt(code) }
    - else if (0x590 <= code && code <= 0x5f4) { return "R" }
    - else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
    - else if (0x6ee <= code && code <= 0x8ac) { return "r" }
    - else if (0x2000 <= code && code <= 0x200b) { return "w" }
    - else if (code == 0x200c) { return "b" }
    - else { return "L" }
    - }
    -
    - var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
    - var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
    -
    - function BidiSpan(level, from, to) {
    - this.level = level;
    - this.from = from; this.to = to;
    - }
    -
    - return function(str, direction) {
    - var outerType = direction == "ltr" ? "L" : "R";
    -
    - if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
    - var len = str.length, types = [];
    - for (var i = 0; i < len; ++i)
    - { types.push(charType(str.charCodeAt(i))); }
    -
    - // W1. Examine each non-spacing mark (NSM) in the level run, and
    - // change the type of the NSM to the type of the previous
    - // character. If the NSM is at the start of the level run, it will
    - // get the type of sor.
    - for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
    - var type = types[i$1];
    - if (type == "m") { types[i$1] = prev; }
    - else { prev = type; }
    - }
    -
    - // W2. Search backwards from each instance of a European number
    - // until the first strong type (R, L, AL, or sor) is found. If an
    - // AL is found, change the type of the European number to Arabic
    - // number.
    - // W3. Change all ALs to R.
    - for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
    - var type$1 = types[i$2];
    - if (type$1 == "1" && cur == "r") { types[i$2] = "n"; }
    - else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R"; } }
    - }
    -
    - // W4. A single European separator between two European numbers
    - // changes to a European number. A single common separator between
    - // two numbers of the same type changes to that type.
    - for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
    - var type$2 = types[i$3];
    - if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1"; }
    - else if (type$2 == "," && prev$1 == types[i$3+1] &&
    - (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1; }
    - prev$1 = type$2;
    - }
    -
    - // W5. A sequence of European terminators adjacent to European
    - // numbers changes to all European numbers.
    - // W6. Otherwise, separators and terminators change to Other
    - // Neutral.
    - for (var i$4 = 0; i$4 < len; ++i$4) {
    - var type$3 = types[i$4];
    - if (type$3 == ",") { types[i$4] = "N"; }
    - else if (type$3 == "%") {
    - var end = (void 0);
    - for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
    - var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N";
    - for (var j = i$4; j < end; ++j) { types[j] = replace; }
    - i$4 = end - 1;
    - }
    - }
    -
    - // W7. Search backwards from each instance of a European number
    - // until the first strong type (R, L, or sor) is found. If an L is
    - // found, then change the type of the European number to L.
    - for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
    - var type$4 = types[i$5];
    - if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L"; }
    - else if (isStrong.test(type$4)) { cur$1 = type$4; }
    - }
    -
    - // N1. A sequence of neutrals takes the direction of the
    - // surrounding strong text if the text on both sides has the same
    - // direction. European and Arabic numbers act as if they were R in
    - // terms of their influence on neutrals. Start-of-level-run (sor)
    - // and end-of-level-run (eor) are used at level run boundaries.
    - // N2. Any remaining neutrals take the embedding direction.
    - for (var i$6 = 0; i$6 < len; ++i$6) {
    - if (isNeutral.test(types[i$6])) {
    - var end$1 = (void 0);
    - for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
    - var before = (i$6 ? types[i$6-1] : outerType) == "L";
    - var after = (end$1 < len ? types[end$1] : outerType) == "L";
    - var replace$1 = before == after ? (before ? "L" : "R") : outerType;
    - for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }
    - i$6 = end$1 - 1;
    - }
    - }
    -
    - // Here we depart from the documented algorithm, in order to avoid
    - // building up an actual levels array. Since there are only three
    - // levels (0, 1, 2) in an implementation that doesn't take
    - // explicit embedding into account, we can build up the order on
    - // the fly, without following the level-based algorithm.
    - var order = [], m;
    - for (var i$7 = 0; i$7 < len;) {
    - if (countsAsLeft.test(types[i$7])) {
    - var start = i$7;
    - for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
    - order.push(new BidiSpan(0, start, i$7));
    - } else {
    - var pos = i$7, at = order.length;
    - for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
    - for (var j$2 = pos; j$2 < i$7;) {
    - if (countsAsNum.test(types[j$2])) {
    - if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); }
    - var nstart = j$2;
    - for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
    - order.splice(at, 0, new BidiSpan(2, nstart, j$2));
    - pos = j$2;
    - } else { ++j$2; }
    - }
    - if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }
    - }
    - }
    - if (direction == "ltr") {
    - if (order[0].level == 1 && (m = str.match(/^\s+/))) {
    - order[0].from = m[0].length;
    - order.unshift(new BidiSpan(0, 0, m[0].length));
    - }
    - if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
    - lst(order).to -= m[0].length;
    - order.push(new BidiSpan(0, len - m[0].length, len));
    - }
    - }
    -
    - return direction == "rtl" ? order.reverse() : order
    - }
    - })();
    -
    - // Get the bidi ordering for the given line (and cache it). Returns
    - // false for lines that are fully left-to-right, and an array of
    - // BidiSpan objects otherwise.
    - function getOrder(line, direction) {
    - var order = line.order;
    - if (order == null) { order = line.order = bidiOrdering(line.text, direction); }
    - return order
    - }
    -
    - // EVENT HANDLING
    -
    - // Lightweight event framework. on/off also work on DOM nodes,
    - // registering native DOM handlers.
    -
    - var noHandlers = [];
    -
    - var on = function(emitter, type, f) {
    - if (emitter.addEventListener) {
    - emitter.addEventListener(type, f, false);
    - } else if (emitter.attachEvent) {
    - emitter.attachEvent("on" + type, f);
    - } else {
    - var map$$1 = emitter._handlers || (emitter._handlers = {});
    - map$$1[type] = (map$$1[type] || noHandlers).concat(f);
    - }
    - };
    -
    - function getHandlers(emitter, type) {
    - return emitter._handlers && emitter._handlers[type] || noHandlers
    - }
    -
    - function off(emitter, type, f) {
    - if (emitter.removeEventListener) {
    - emitter.removeEventListener(type, f, false);
    - } else if (emitter.detachEvent) {
    - emitter.detachEvent("on" + type, f);
    - } else {
    - var map$$1 = emitter._handlers, arr = map$$1 && map$$1[type];
    - if (arr) {
    - var index = indexOf(arr, f);
    - if (index > -1)
    - { map$$1[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }
    - }
    - }
    - }
    -
    - function signal(emitter, type /*, values...*/) {
    - var handlers = getHandlers(emitter, type);
    - if (!handlers.length) { return }
    - var args = Array.prototype.slice.call(arguments, 2);
    - for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }
    - }
    -
    - // The DOM events that CodeMirror handles can be overridden by
    - // registering a (non-DOM) handler on the editor for the event name,
    - // and preventDefault-ing the event in that handler.
    - function signalDOMEvent(cm, e, override) {
    - if (typeof e == "string")
    - { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }
    - signal(cm, override || e.type, cm, e);
    - return e_defaultPrevented(e) || e.codemirrorIgnore
    - }
    -
    - function signalCursorActivity(cm) {
    - var arr = cm._handlers && cm._handlers.cursorActivity;
    - if (!arr) { return }
    - var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);
    - for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
    - { set.push(arr[i]); } }
    - }
    -
    - function hasHandler(emitter, type) {
    - return getHandlers(emitter, type).length > 0
    - }
    -
    - // Add on and off methods to a constructor's prototype, to make
    - // registering events on such objects more convenient.
    - function eventMixin(ctor) {
    - ctor.prototype.on = function(type, f) {on(this, type, f);};
    - ctor.prototype.off = function(type, f) {off(this, type, f);};
    - }
    -
    - // Due to the fact that we still support jurassic IE versions, some
    - // compatibility wrappers are needed.
    -
    - function e_preventDefault(e) {
    - if (e.preventDefault) { e.preventDefault(); }
    - else { e.returnValue = false; }
    - }
    - function e_stopPropagation(e) {
    - if (e.stopPropagation) { e.stopPropagation(); }
    - else { e.cancelBubble = true; }
    - }
    - function e_defaultPrevented(e) {
    - return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
    - }
    - function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
    -
    - function e_target(e) {return e.target || e.srcElement}
    - function e_button(e) {
    - var b = e.which;
    - if (b == null) {
    - if (e.button & 1) { b = 1; }
    - else if (e.button & 2) { b = 3; }
    - else if (e.button & 4) { b = 2; }
    - }
    - if (mac && e.ctrlKey && b == 1) { b = 3; }
    - return b
    - }
    -
    - // Detect drag-and-drop
    - var dragAndDrop = function() {
    - // There is *some* kind of drag-and-drop support in IE6-8, but I
    - // couldn't get it to work yet.
    - if (ie && ie_version < 9) { return false }
    - var div = elt('div');
    - return "draggable" in div || "dragDrop" in div
    - }();
    -
    - var zwspSupported;
    - function zeroWidthElement(measure) {
    - if (zwspSupported == null) {
    - var test = elt("span", "\u200b");
    - removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
    - if (measure.firstChild.offsetHeight != 0)
    - { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }
    - }
    - var node = zwspSupported ? elt("span", "\u200b") :
    - elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
    - node.setAttribute("cm-text", "");
    - return node
    - }
    -
    - // Feature-detect IE's crummy client rect reporting for bidi text
    - var badBidiRects;
    - function hasBadBidiRects(measure) {
    - if (badBidiRects != null) { return badBidiRects }
    - var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
    - var r0 = range(txt, 0, 1).getBoundingClientRect();
    - var r1 = range(txt, 1, 2).getBoundingClientRect();
    - removeChildren(measure);
    - if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
    - return badBidiRects = (r1.right - r0.right < 3)
    - }
    -
    - // See if "".split is the broken IE version, if so, provide an
    - // alternative way to split lines.
    - var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
    - var pos = 0, result = [], l = string.length;
    - while (pos <= l) {
    - var nl = string.indexOf("\n", pos);
    - if (nl == -1) { nl = string.length; }
    - var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
    - var rt = line.indexOf("\r");
    - if (rt != -1) {
    - result.push(line.slice(0, rt));
    - pos += rt + 1;
    - } else {
    - result.push(line);
    - pos = nl + 1;
    - }
    - }
    - return result
    - } : function (string) { return string.split(/\r\n?|\n/); };
    -
    - var hasSelection = window.getSelection ? function (te) {
    - try { return te.selectionStart != te.selectionEnd }
    - catch(e) { return false }
    - } : function (te) {
    - var range$$1;
    - try {range$$1 = te.ownerDocument.selection.createRange();}
    - catch(e) {}
    - if (!range$$1 || range$$1.parentElement() != te) { return false }
    - return range$$1.compareEndPoints("StartToEnd", range$$1) != 0
    - };
    -
    - var hasCopyEvent = (function () {
    - var e = elt("div");
    - if ("oncopy" in e) { return true }
    - e.setAttribute("oncopy", "return;");
    - return typeof e.oncopy == "function"
    - })();
    -
    - var badZoomedRects = null;
    - function hasBadZoomedRects(measure) {
    - if (badZoomedRects != null) { return badZoomedRects }
    - var node = removeChildrenAndAdd(measure, elt("span", "x"));
    - var normal = node.getBoundingClientRect();
    - var fromRange = range(node, 0, 1).getBoundingClientRect();
    - return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
    - }
    -
    - // Known modes, by name and by MIME
    - var modes = {}, mimeModes = {};
    -
    - // Extra arguments are stored as the mode's dependencies, which is
    - // used by (legacy) mechanisms like loadmode.js to automatically
    - // load a mode. (Preferred mechanism is the require/define calls.)
    - function defineMode(name, mode) {
    - if (arguments.length > 2)
    - { mode.dependencies = Array.prototype.slice.call(arguments, 2); }
    - modes[name] = mode;
    - }
    -
    - function defineMIME(mime, spec) {
    - mimeModesime] = spec;
    - }
    -
    - // Given a MIME type, a {name, ...options} config object, or a name
    - // string, return a mode config object.
    - function resolveMode(spec) {
    - if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
    - spec = mimeModes[spec];
    - } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
    - var found = mimeModes[spec.name];
    - if (typeof found == "string") { found = {name: found}; }
    - spec = createObj(found, spec);
    - spec.name = found.name;
    - } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
    - return resolveMode("application/xml")
    - } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
    - return resolveMode("application/json")
    - }
    - if (typeof spec == "string") { return {name: spec} }
    - else { return spec || {name: "null"} }
    - }
    -
    - // Given a mode spec (anything that resolveMode accepts), find and
    - // initialize an actual mode object.
    - function getMode(options, spec) {
    - spec = resolveMode(spec);
    - var mfactory = modes[spec.name];
    - if (!mfactory) { return getMode(options, "text/plain") }
    - var modeObj = mfactory(options, spec);
    - if (modeExtensions.hasOwnProperty(spec.name)) {
    - var exts = modeExtensions[spec.name];
    - for (var prop in exts) {
    - if (!exts.hasOwnProperty(prop)) { continue }
    - if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; }
    - modeObj[prop] = exts[prop];
    - }
    - }
    - modeObj.name = spec.name;
    - if (spec.helperType) { modeObj.helperType = spec.helperType; }
    - if (spec.modeProps) { for (var prop$1 in spec.modeProps)
    - { modeObj[prop$1] = spec.modeProps[prop$1]; } }
    -
    - return modeObj
    - }
    -
    - // This can be used to attach properties to mode objects from
    - // outside the actual mode definition.
    - var modeExtensions = {};
    - function extendMode(mode, properties) {
    - var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensionsode] : (modeExtensionsode] = {});
    - copyObj(properties, exts);
    - }
    -
    - function copyState(mode, state) {
    - if (state === true) { return state }
    - if (mode.copyState) { return mode.copyState(state) }
    - var nstate = {};
    - for (var n in state) {
    - var val = state[n];
    - if (val instanceof Array) { val = val.concat([]); }
    - nstate[n] = val;
    - }
    - return nstate
    - }
    -
    - // Given a mode and a state (for that mode), find the inner mode and
    - // state at the position that the state refers to.
    - function innerMode(mode, state) {
    - var info;
    - while (mode.innerMode) {
    - info = mode.innerMode(state);
    - if (!info || info.mode == mode) { break }
    - state = info.state;
    - mode = info.mode;
    - }
    - return info || {mode: mode, state: state}
    - }
    -
    - function startState(mode, a1, a2) {
    - return mode.startState ? mode.startState(a1, a2) : true
    - }
    -
    - // STRING STREAM
    -
    - // Fed to the mode parsers, provides helper functions to make
    - // parsers more succinct.
    -
    - var StringStream = function(string, tabSize, lineOracle) {
    - this.pos = this.start = 0;
    - this.string = string;
    - this.tabSize = tabSize || 8;
    - this.lastColumnPos = this.lastColumnValue = 0;
    - this.lineStart = 0;
    - this.lineOracle = lineOracle;
    - };
    -
    - StringStream.prototype.eol = function () {return this.pos >= this.string.length};
    - StringStream.prototype.sol = function () {return this.pos == this.lineStart};
    - StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
    - StringStream.prototype.next = function () {
    - if (this.pos < this.string.length)
    - { return this.string.charAt(this.pos++) }
    - };
    - StringStream.prototype.eat = function (match) {
    - var ch = this.string.charAt(this.pos);
    - var ok;
    - if (typeof match == "string") { ok = ch == match; }
    - else { ok = ch && (match.test ? match.test(ch) : match(ch)); }
    - if (ok) {++this.pos; return ch}
    - };
    - StringStream.prototype.eatWhile = function (match) {
    - var start = this.pos;
    - while (this.eat(match)){}
    - return this.pos > start
    - };
    - StringStream.prototype.eatSpace = function () {
    - var this$1 = this;
    -
    - var start = this.pos;
    - while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos; }
    - return this.pos > start
    - };
    - StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
    - StringStream.prototype.skipTo = function (ch) {
    - var found = this.string.indexOf(ch, this.pos);
    - if (found > -1) {this.pos = found; return true}
    - };
    - StringStream.prototype.backUp = function (n) {this.pos -= n;};
    - StringStream.prototype.column = function () {
    - if (this.lastColumnPos < this.start) {
    - this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
    - this.lastColumnPos = this.start;
    - }
    - return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
    - };
    - StringStream.prototype.indentation = function () {
    - return countColumn(this.string, null, this.tabSize) -
    - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
    - };
    - StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
    - if (typeof pattern == "string") {
    - var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };
    - var substr = this.string.substr(this.pos, pattern.length);
    - if (cased(substr) == cased(pattern)) {
    - if (consume !== false) { this.pos += pattern.length; }
    - return true
    - }
    - } else {
    - var match = this.string.slice(this.pos).match(pattern);
    - if (match && match.index > 0) { return null }
    - if (match && consume !== false) { this.pos += match[0].length; }
    - return match
    - }
    - };
    - StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
    - StringStream.prototype.hideFirstChars = function (n, inner) {
    - this.lineStart += n;
    - try { return inner() }
    - finally { this.lineStart -= n; }
    - };
    - StringStream.prototype.lookAhead = function (n) {
    - var oracle = this.lineOracle;
    - return oracle && oracle.lookAhead(n)
    - };
    - StringStream.prototype.baseToken = function () {
    - var oracle = this.lineOracle;
    - return oracle && oracle.baseToken(this.pos)
    - };
    -
    - // Find the line object corresponding to the given line number.
    - function getLine(doc, n) {
    - n -= doc.first;
    - if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
    - var chunk = doc;
    - while (!chunk.lines) {
    - for (var i = 0;; ++i) {
    - var child = chunk.children[i], sz = child.chunkSize();
    - if (n < sz) { chunk = child; break }
    - n -= sz;
    - }
    - }
    - return chunk.lines[n]
    - }
    -
    - // Get the part of a document between two positions, as an array of
    - // strings.
    - function getBetween(doc, start, end) {
    - var out = [], n = start.line;
    - doc.iter(start.line, end.line + 1, function (line) {
    - var text = line.text;
    - if (n == end.line) { text = text.slice(0, end.ch); }
    - if (n == start.line) { text = text.slice(start.ch); }
    - out.push(text);
    - ++n;
    - });
    - return out
    - }
    - // Get the lines between from and to, as array of strings.
    - function getLines(doc, from, to) {
    - var out = [];
    - doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value
    - return out
    - }
    -
    - // Update the height of a line, propagating the height change
    - // upwards to parent nodes.
    - function updateLineHeight(line, height) {
    - var diff = height - line.height;
    - if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }
    - }
    -
    - // Given a line object, find its line number by walking up through
    - // its parent links.
    - function lineNo(line) {
    - if (line.parent == null) { return null }
    - var cur = line.parent, no = indexOf(cur.lines, line);
    - for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
    - for (var i = 0;; ++i) {
    - if (chunk.children[i] == cur) { break }
    - no += chunk.children[i].chunkSize();
    - }
    - }
    - return no + cur.first
    - }
    -
    - // Find the line at the given vertical position, using the height
    - // information in the document tree.
    - function lineAtHeight(chunk, h) {
    - var n = chunk.first;
    - outer: do {
    - for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
    - var child = chunk.children[i$1], ch = child.height;
    - if (h < ch) { chunk = child; continue outer }
    - h -= ch;
    - n += child.chunkSize();
    - }
    - return n
    - } while (!chunk.lines)
    - var i = 0;
    - for (; i < chunk.lines.length; ++i) {
    - var line = chunk.lines[i], lh = line.height;
    - if (h < lh) { break }
    - h -= lh;
    - }
    - return n + i
    - }
    -
    - function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
    -
    - function lineNumberFor(options, i) {
    - return String(options.lineNumberFormatter(i + options.firstLineNumber))
    - }
    -
    - // A Pos instance represents a position within the text.
    - function Pos(line, ch, sticky) {
    - if ( sticky === void 0 ) sticky = null;
    -
    - if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
    - this.line = line;
    - this.ch = ch;
    - this.sticky = sticky;
    - }
    -
    - // Compare two positions, return 0 if they are the same, a negative
    - // number when a is less, and a positive number otherwise.
    - function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
    -
    - function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
    -
    - function copyPos(x) {return Pos(x.line, x.ch)}
    - function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
    - function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
    -
    - // Most of the external API clips given positions to make sure they
    - // actually exist within the document.
    - function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
    - function clipPos(doc, pos) {
    - if (pos.line < doc.first) { return Pos(doc.first, 0) }
    - var last = doc.first + doc.size - 1;
    - if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
    - return clipToLen(pos, getLine(doc, pos.line).text.length)
    - }
    - function clipToLen(pos, linelen) {
    - var ch = pos.ch;
    - if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
    - else if (ch < 0) { return Pos(pos.line, 0) }
    - else { return pos }
    - }
    - function clipPosArray(doc, array) {
    - var out = [];
    - for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }
    - return out
    - }
    -
    - var SavedContext = function(state, lookAhead) {
    - this.state = state;
    - this.lookAhead = lookAhead;
    - };
    -
    - var Context = function(doc, state, line, lookAhead) {
    - this.state = state;
    - this.doc = doc;
    - this.line = line;
    - this.maxLookAhead = lookAhead || 0;
    - this.baseTokens = null;
    - this.baseTokenPos = 1;
    - };
    -
    - Context.prototype.lookAhead = function (n) {
    - var line = this.doc.getLine(this.line + n);
    - if (line != null && n > this.maxLookAhead) { this.maxLookAhead = n; }
    - return line
    - };
    -
    - Context.prototype.baseToken = function (n) {
    - var this$1 = this;
    -
    - if (!this.baseTokens) { return null }
    - while (this.baseTokens[this.baseTokenPos] <= n)
    - { this$1.baseTokenPos += 2; }
    - var type = this.baseTokens[this.baseTokenPos + 1];
    - return {type: type && type.replace(/( |^)overlay .*/, ""),
    - size: this.baseTokens[this.baseTokenPos] - n}
    - };
    -
    - Context.prototype.nextLine = function () {
    - this.line++;
    - if (this.maxLookAhead > 0) { this.maxLookAhead--; }
    - };
    -
    - Context.fromSaved = function (doc, saved, line) {
    - if (saved instanceof SavedContext)
    - { return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead) }
    - else
    - { return new Context(doc, copyState(doc.mode, saved), line) }
    - };
    -
    - Context.prototype.save = function (copy) {
    - var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state;
    - return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state
    - };
    -
    -
    - // Compute a style array (an array starting with a mode generation
    - // -- for invalidation -- followed by pairs of end positions and
    - // style strings), which is used to highlight the tokens on the
    - // line.
    - function highlightLine(cm, line, context, forceToEnd) {
    - // A styles array always starts with a number identifying the
    - // mode/overlays that it is based on (for easy invalidation).
    - var st = [cm.state.modeGen], lineClasses = {};
    - // Compute the base array of styles
    - runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },
    - lineClasses, forceToEnd);
    - var state = context.state;
    -
    - // Run overlays, adjust style array.
    - var loop = function ( o ) {
    - context.baseTokens = st;
    - var overlay = cm.state.overlays[o], i = 1, at = 0;
    - context.state = true;
    - runMode(cm, line.text, overlay.mode, context, function (end, style) {
    - var start = i;
    - // Ensure there's a token end at the current position, and that i points at it
    - while (at < end) {
    - var i_end = st[i];
    - if (i_end > end)
    - { st.splice(i, 1, end, st[i+1], i_end); }
    - i += 2;
    - at = Math.min(end, i_end);
    - }
    - if (!style) { return }
    - if (overlay.opaque) {
    - st.splice(start, i - start, end, "overlay " + style);
    - i = start + 2;
    - } else {
    - for (; start < i; start += 2) {
    - var cur = st[start+1];
    - st[start+1] = (cur ? cur + " " : "") + "overlay " + style;
    - }
    - }
    - }, lineClasses);
    - context.state = state;
    - context.baseTokens = null;
    - context.baseTokenPos = 1;
    - };
    -
    - for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );
    -
    - return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
    - }
    -
    - function getLineStyles(cm, line, updateFrontier) {
    - if (!line.styles || line.styles[0] != cm.state.modeGen) {
    - var context = getContextBefore(cm, lineNo(line));
    - var resetState = line.text.length > cm.options.maxHighlightLength && copyState(cm.doc.mode, context.state);
    - var result = highlightLine(cm, line, context);
    - if (resetState) { context.state = resetState; }
    - line.stateAfter = context.save(!resetState);
    - line.styles = result.styles;
    - if (result.classes) { line.styleClasses = result.classes; }
    - else if (line.styleClasses) { line.styleClasses = null; }
    - if (updateFrontier === cm.doc.highlightFrontier)
    - { cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier); }
    - }
    - return line.styles
    - }
    -
    - function getContextBefore(cm, n, precise) {
    - var doc = cm.doc, display = cm.display;
    - if (!doc.mode.startState) { return new Context(doc, true, n) }
    - var start = findStartLine(cm, n, precise);
    - var saved = start > doc.first && getLine(doc, start - 1).stateAfter;
    - var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start);
    -
    - doc.iter(start, n, function (line) {
    - processLine(cm, line.text, context);
    - var pos = context.line;
    - line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null;
    - context.nextLine();
    - });
    - if (precise) { doc.modeFrontier = context.line; }
    - return context
    - }
    -
    - // Lightweight form of highlight -- proceed over this line and
    - // update state, but don't save a style array. Used for lines that
    - // aren't currently visible.
    - function processLine(cm, text, context, startAt) {
    - var mode = cm.doc.mode;
    - var stream = new StringStream(text, cm.options.tabSize, context);
    - stream.start = stream.pos = startAt || 0;
    - if (text == "") { callBlankLine(mode, context.state); }
    - while (!stream.eol()) {
    - readToken(mode, stream, context.state);
    - stream.start = stream.pos;
    - }
    - }
    -
    - function callBlankLine(mode, state) {
    - if (mode.blankLine) { return mode.blankLine(state) }
    - if (!mode.innerMode) { return }
    - var inner = innerMode(mode, state);
    - if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
    - }
    -
    - function readToken(mode, stream, state, inner) {
    - for (var i = 0; i < 10; i++) {
    - if (inner) { inner[0] = innerMode(mode, state).mode; }
    - var style = mode.token(stream, state);
    - if (stream.pos > stream.start) { return style }
    - }
    - throw new Error("Mode " + mode.name + " failed to advance stream.")
    - }
    -
    - var Token = function(stream, type, state) {
    - this.start = stream.start; this.end = stream.pos;
    - this.string = stream.current();
    - this.type = type || null;
    - this.state = state;
    - };
    -
    - // Utility for getTokenAt and getLineTokens
    - function takeToken(cm, pos, precise, asArray) {
    - var doc = cm.doc, mode = doc.mode, style;
    - pos = clipPos(doc, pos);
    - var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise);
    - var stream = new StringStream(line.text, cm.options.tabSize, context), tokens;
    - if (asArray) { tokens = []; }
    - while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
    - stream.start = stream.pos;
    - style = readToken(mode, stream, context.state);
    - if (asArray) { tokens.push(new Token(stream, style, copyState(doc.mode, context.state))); }
    - }
    - return asArray ? tokens : new Token(stream, style, context.state)
    - }
    -
    - function extractLineClasses(type, output) {
    - if (type) { for (;;) {
    - var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/);
    - if (!lineClass) { break }
    - type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);
    - var prop = lineClass[1] ? "bgClass" : "textClass";
    - if (output[prop] == null)
    - { output[prop] = lineClass[2]; }
    - else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop]))
    - { output[prop] += " " + lineClass[2]; }
    - } }
    - return type
    - }
    -
    - // Run the given mode's parser over a line, calling f for each token.
    - function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {
    - var flattenSpans = mode.flattenSpans;
    - if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }
    - var curStart = 0, curStyle = null;
    - var stream = new StringStream(text, cm.options.tabSize, context), style;
    - var inner = cm.options.addModeClass && [null];
    - if (text == "") { extractLineClasses(callBlankLine(mode, context.state), lineClasses); }
    - while (!stream.eol()) {
    - if (stream.pos > cm.options.maxHighlightLength) {
    - flattenSpans = false;
    - if (forceToEnd) { processLine(cm, text, context, stream.pos); }
    - stream.pos = text.length;
    - style = null;
    - } else {
    - style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses);
    - }
    - if (inner) {
    - var mName = inner[0].name;
    - if (mName) { style = "m-" + (style ? mName + " " + style : mName); }
    - }
    - if (!flattenSpans || curStyle != style) {
    - while (curStart < stream.start) {
    - curStart = Math.min(stream.start, curStart + 5000);
    - f(curStart, curStyle);
    - }
    - curStyle = style;
    - }
    - stream.start = stream.pos;
    - }
    - while (curStart < stream.pos) {
    - // Webkit seems to refuse to render text nodes longer than 57444
    - // characters, and returns inaccurate measurements in nodes
    - // starting around 5000 chars.
    - var pos = Math.min(stream.pos, curStart + 5000);
    - f(pos, curStyle);
    - curStart = pos;
    - }
    - }
    -
    - // Finds the line to start with when starting a parse. Tries to
    - // find a line with a stateAfter, so that it can start with a
    - // valid state. If that fails, it returns the line with the
    - // smallest indentation, which tends to need the least context to
    - // parse correctly.
    - function findStartLine(cm, n, precise) {
    - var minindent, minline, doc = cm.doc;
    - var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
    - for (var search = n; search > lim; --search) {
    - if (search <= doc.first) { return doc.first }
    - var line = getLine(doc, search - 1), after = line.stateAfter;
    - if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))
    - { return search }
    - var indented = countColumn(line.text, null, cm.options.tabSize);
    - if (minline == null || minindent > indented) {
    - minline = search - 1;
    - minindent = indented;
    - }
    - }
    - return minline
    - }
    -
    - function retreatFrontier(doc, n) {
    - doc.modeFrontier = Math.min(doc.modeFrontier, n);
    - if (doc.highlightFrontier < n - 10) { return }
    - var start = doc.first;
    - for (var line = n - 1; line > start; line--) {
    - var saved = getLine(doc, line).stateAfter;
    - // change is on 3
    - // state on line 1 looked ahead 2 -- so saw 3
    - // test 1 + 2 < 3 should cover this
    - if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {
    - start = line + 1;
    - break
    - }
    - }
    - doc.highlightFrontier = Math.min(doc.highlightFrontier, start);
    - }
    -
    - // Optimize some code when these features are not used.
    - var sawReadOnlySpans = false, sawCollapsedSpans = false;
    -
    - function seeReadOnlySpans() {
    - sawReadOnlySpans = true;
    - }
    -
    - function seeCollapsedSpans() {
    - sawCollapsedSpans = true;
    - }
    -
    - // TEXTMARKER SPANS
    -
    - function MarkedSpan(marker, from, to) {
    - this.marker = marker;
    - this.from = from; this.to = to;
    - }
    -
    - // Search an array of spans for a span matching the given marker.
    - function getMarkedSpanFor(spans, marker) {
    - if (spans) { for (var i = 0; i < spans.length; ++i) {
    - var span = spans[i];
    - if (span.marker == marker) { return span }
    - } }
    - }
    - // Remove a span from an array, returning undefined if no spans are
    - // left (we don't store arrays for lines without spans).
    - function removeMarkedSpan(spans, span) {
    - var r;
    - for (var i = 0; i < spans.length; ++i)
    - { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }
    - return r
    - }
    - // Add a span to a line.
    - function addMarkedSpan(line, span) {
    - line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
    - span.marker.attachLine(line);
    - }
    -
    - // Used for the algorithm that adjusts markers for a change in the
    - // document. These functions cut an array of spans at a given
    - // character position, returning an array of remaining chunks (or
    - // undefined if nothing remains).
    - function markedSpansBefore(old, startCh, isInsert) {
    - var nw;
    - if (old) { for (var i = 0; i < old.length; ++i) {
    - var span = old[i], marker = span.marker;
    - var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
    - if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
    - var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)
    - ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));
    - }
    - } }
    - return nw
    - }
    - function markedSpansAfter(old, endCh, isInsert) {
    - var nw;
    - if (old) { for (var i = 0; i < old.length; ++i) {
    - var span = old[i], marker = span.marker;
    - var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
    - if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
    - var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)
    - ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
    - span.to == null ? null : span.to - endCh));
    - }
    - } }
    - return nw
    - }
    -
    - // Given a change object, compute the new set of marker spans that
    - // cover the line in which the change took place. Removes spans
    - // entirely within the change, reconnects spans belonging to the
    - // same marker that appear on both sides of the change, and cuts off
    - // spans partially within the change. Returns an array of span
    - // arrays with one element for each line in (after) the change.
    - function stretchSpansOverChange(doc, change) {
    - if (change.full) { return null }
    - var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
    - var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
    - if (!oldFirst && !oldLast) { return null }
    -
    - var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;
    - // Get the spans that 'stick out' on both sides
    - var first = markedSpansBefore(oldFirst, startCh, isInsert);
    - var last = markedSpansAfter(oldLast, endCh, isInsert);
    -
    - // Next, merge those two ends
    - var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
    - if (first) {
    - // Fix up .to properties of first
    - for (var i = 0; i < first.length; ++i) {
    - var span = first[i];
    - if (span.to == null) {
    - var found = getMarkedSpanFor(last, span.marker);
    - if (!found) { span.to = startCh; }
    - else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }
    - }
    - }
    - }
    - if (last) {
    - // Fix up .from in last (or move them into first in case of sameLine)
    - for (var i$1 = 0; i$1 < last.length; ++i$1) {
    - var span$1 = last[i$1];
    - if (span$1.to != null) { span$1.to += offset; }
    - if (span$1.from == null) {
    - var found$1 = getMarkedSpanFor(first, span$1.marker);
    - if (!found$1) {
    - span$1.from = offset;
    - if (sameLine) { (first || (first = [])).push(span$1); }
    - }
    - } else {
    - span$1.from += offset;
    - if (sameLine) { (first || (first = [])).push(span$1); }
    - }
    - }
    - }
    - // Make sure we didn't create any zero-length spans
    - if (first) { first = clearEmptySpans(first); }
    - if (last && last != first) { last = clearEmptySpans(last); }
    -
    - var newMarkers = [first];
    - if (!sameLine) {
    - // Fill gap with whole-line-spans
    - var gap = change.text.length - 2, gapMarkers;
    - if (gap > 0 && first)
    - { for (var i$2 = 0; i$2 < first.length; ++i$2)
    - { if (first[i$2].to == null)
    - { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }
    - for (var i$3 = 0; i$3 < gap; ++i$3)
    - { newMarkers.push(gapMarkers); }
    - newMarkers.push(last);
    - }
    - return newMarkers
    - }
    -
    - // Remove spans that are empty and don't have a clearWhenEmpty
    - // option of false.
    - function clearEmptySpans(spans) {
    - for (var i = 0; i < spans.length; ++i) {
    - var span = spans[i];
    - if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
    - { spans.splice(i--, 1); }
    - }
    - if (!spans.length) { return null }
    - return spans
    - }
    -
    - // Used to 'clip' out readOnly ranges when making a change.
    - function removeReadOnlyRanges(doc, from, to) {
    - var markers = null;
    - doc.iter(from.line, to.line + 1, function (line) {
    - if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
    - var mark = line.markedSpans[i].marker;
    - if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
    - { (markers || (markers = [])).push(mark); }
    - } }
    - });
    - if (!markers) { return null }
    - var parts = [{from: from, to: to}];
    - for (var i = 0; i < markers.length; ++i) {
    - var mk = markers[i], m = mk.find(0);
    - for (var j = 0; j < parts.length; ++j) {
    - var p = parts[j];
    - if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
    - var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);
    - if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
    - { newParts.push({from: p.from, to: m.from}); }
    - if (dto > 0 || !mk.inclusiveRight && !dto)
    - { newParts.push({from: m.to, to: p.to}); }
    - parts.splice.apply(parts, newParts);
    - j += newParts.length - 3;
    - }
    - }
    - return parts
    - }
    -
    - // Connect or disconnect spans from a line.
    - function detachMarkedSpans(line) {
    - var spans = line.markedSpans;
    - if (!spans) { return }
    - for (var i = 0; i < spans.length; ++i)
    - { spans[i].marker.detachLine(line); }
    - line.markedSpans = null;
    - }
    - function attachMarkedSpans(line, spans) {
    - if (!spans) { return }
    - for (var i = 0; i < spans.length; ++i)
    - { spans[i].marker.attachLine(line); }
    - line.markedSpans = spans;
    - }
    -
    - // Helpers used when computing which overlapping collapsed span
    - // counts as the larger one.
    - function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
    - function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
    -
    - // Returns a number indicating which of two overlapping collapsed
    - // spans is larger (and thus includes the other). Falls back to
    - // comparing ids when the spans cover exactly the same range.
    - function compareCollapsedMarkers(a, b) {
    - var lenDiff = a.lines.length - b.lines.length;
    - if (lenDiff != 0) { return lenDiff }
    - var aPos = a.find(), bPos = b.find();
    - var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);
    - if (fromCmp) { return -fromCmp }
    - var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);
    - if (toCmp) { return toCmp }
    - return b.id - a.id
    - }
    -
    - // Find out whether a line ends or starts in a collapsed span. If
    - // so, return the marker for that span.
    - function collapsedSpanAtSide(line, start) {
    - var sps = sawCollapsedSpans && line.markedSpans, found;
    - if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
    - sp = sps[i];
    - if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
    - (!found || compareCollapsedMarkers(found, sp.marker) < 0))
    - { found = sp.marker; }
    - } }
    - return found
    - }
    - function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
    - function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
    -
    - function collapsedSpanAround(line, ch) {
    - var sps = sawCollapsedSpans && line.markedSpans, found;
    - if (sps) { for (var i = 0; i < sps.length; ++i) {
    - var sp = sps[i];
    - if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) &&
    - (!found || compareCollapsedMarkers(found, sp.marker) < 0)) { found = sp.marker; }
    - } }
    - return found
    - }
    -
    - // Test whether there exists a collapsed span that partially
    - // overlaps (covers the start or end, but not both) of a new span.
    - // Such overlap is not allowed.
    - function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {
    - var line = getLine(doc, lineNo$$1);
    - var sps = sawCollapsedSpans && line.markedSpans;
    - if (sps) { for (var i = 0; i < sps.length; ++i) {
    - var sp = sps[i];
    - if (!sp.marker.collapsed) { continue }
    - var found = sp.marker.find(0);
    - var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
    - var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
    - if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
    - if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
    - fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
    - { return true }
    - } }
    - }
    -
    - // A visual line is a line as drawn on the screen. Folding, for
    - // example, can cause multiple logical lines to appear on the same
    - // visual line. This finds the start of the visual line that the
    - // given line is part of (usually that is the line itself).
    - function visualLine(line) {
    - var merged;
    - while (merged = collapsedSpanAtStart(line))
    - { line = merged.find(-1, true).line; }
    - return line
    - }
    -
    - function visualLineEnd(line) {
    - var merged;
    - while (merged = collapsedSpanAtEnd(line))
    - { line = merged.find(1, true).line; }
    - return line
    - }
    -
    - // Returns an array of logical lines that continue the visual line
    - // started by the argument, or undefined if there are no such lines.
    - function visualLineContinued(line) {
    - var merged, lines;
    - while (merged = collapsedSpanAtEnd(line)) {
    - line = merged.find(1, true).line
    - ;(lines || (lines = [])).push(line);
    - }
    - return lines
    - }
    -
    - // Get the line number of the start of the visual line that the
    - // given line number is part of.
    - function visualLineNo(doc, lineN) {
    - var line = getLine(doc, lineN), vis = visualLine(line);
    - if (line == vis) { return lineN }
    - return lineNo(vis)
    - }
    -
    - // Get the line number of the start of the next visual line after
    - // the given line.
    - function visualLineEndNo(doc, lineN) {
    - if (lineN > doc.lastLine()) { return lineN }
    - var line = getLine(doc, lineN), merged;
    - if (!lineIsHidden(doc, line)) { return lineN }
    - while (merged = collapsedSpanAtEnd(line))
    - { line = merged.find(1, true).line; }
    - return lineNo(line) + 1
    - }
    -
    - // Compute whether a line is hidden. Lines count as hidden when they
    - // are part of a visual line that starts with another line, or when
    - // they are entirely covered by collapsed, non-widget span.
    - function lineIsHidden(doc, line) {
    - var sps = sawCollapsedSpans && line.markedSpans;
    - if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
    - sp = sps[i];
    - if (!sp.marker.collapsed) { continue }
    - if (sp.from == null) { return true }
    - if (sp.marker.widgetNode) { continue }
    - if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
    - { return true }
    - } }
    - }
    - function lineIsHiddenInner(doc, line, span) {
    - if (span.to == null) {
    - var end = span.marker.find(1, true);
    - return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
    - }
    - if (span.marker.inclusiveRight && span.to == line.text.length)
    - { return true }
    - for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
    - sp = line.markedSpans[i];
    - if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
    - (sp.to == null || sp.to != span.from) &&
    - (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
    - lineIsHiddenInner(doc, line, sp)) { return true }
    - }
    - }
    -
    - // Find the height above the given line.
    - function heightAtLine(lineObj) {
    - lineObj = visualLine(lineObj);
    -
    - var h = 0, chunk = lineObj.parent;
    - for (var i = 0; i < chunk.lines.length; ++i) {
    - var line = chunk.lines[i];
    - if (line == lineObj) { break }
    - else { h += line.height; }
    - }
    - for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
    - for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
    - var cur = p.children[i$1];
    - if (cur == chunk) { break }
    - else { h += cur.height; }
    - }
    - }
    - return h
    - }
    -
    - // Compute the character length of a line, taking into account
    - // collapsed ranges (see markText) that might hide parts, and join
    - // other lines onto it.
    - function lineLength(line) {
    - if (line.height == 0) { return 0 }
    - var len = line.text.length, merged, cur = line;
    - while (merged = collapsedSpanAtStart(cur)) {
    - var found = merged.find(0, true);
    - cur = found.from.line;
    - len += found.from.ch - found.to.ch;
    - }
    - cur = line;
    - while (merged = collapsedSpanAtEnd(cur)) {
    - var found$1 = merged.find(0, true);
    - len -= cur.text.length - found$1.from.ch;
    - cur = found$1.to.line;
    - len += cur.text.length - found$1.to.ch;
    - }
    - return len
    - }
    -
    - // Find the longest line in the document.
    - function findMaxLine(cm) {
    - var d = cm.display, doc = cm.doc;
    - d.maxLine = getLine(doc, doc.first);
    - d.maxLineLength = lineLength(d.maxLine);
    - d.maxLineChanged = true;
    - doc.iter(function (line) {
    - var len = lineLength(line);
    - if (len > d.maxLineLength) {
    - d.maxLineLength = len;
    - d.maxLine = line;
    - }
    - });
    - }
    -
    - // LINE DATA STRUCTURE
    -
    - // Line objects. These hold state related to a line, including
    - // highlighting info (the styles array).
    - var Line = function(text, markedSpans, estimateHeight) {
    - this.text = text;
    - attachMarkedSpans(this, markedSpans);
    - this.height = estimateHeight ? estimateHeight(this) : 1;
    - };
    -
    - Line.prototype.lineNo = function () { return lineNo(this) };
    - eventMixin(Line);
    -
    - // Change the content (text, markers) of a line. Automatically
    - // invalidates cached information and tries to re-estimate the
    - // line's height.
    - function updateLine(line, text, markedSpans, estimateHeight) {
    - line.text = text;
    - if (line.stateAfter) { line.stateAfter = null; }
    - if (line.styles) { line.styles = null; }
    - if (line.order != null) { line.order = null; }
    - detachMarkedSpans(line);
    - attachMarkedSpans(line, markedSpans);
    - var estHeight = estimateHeight ? estimateHeight(line) : 1;
    - if (estHeight != line.height) { updateLineHeight(line, estHeight); }
    - }
    -
    - // Detach a line from the document tree and its markers.
    - function cleanUpLine(line) {
    - line.parent = null;
    - detachMarkedSpans(line);
    - }
    -
    - // Convert a style as returned by a mode (either null, or a string
    - // containing one or more styles) to a CSS style. This is cached,
    - // and also looks for line-wide styles.
    - var styleToClassCache = {}, styleToClassCacheWithMode = {};
    - function interpretTokenStyle(style, options) {
    - if (!style || /^\s*$/.test(style)) { return null }
    - var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
    - return cache[style] ||
    - (cache[style] = style.replace(/\S+/g, "cm-$&"))
    - }
    -
    - // Render the DOM representation of the text of a line. Also builds
    - // up a 'line map', which points at the DOM nodes that represent
    - // specific stretches of text, and is used by the measuring code.
    - // The returned object contains the DOM node, this map, and
    - // information about line-wide styles that were set by the mode.
    - function buildLineContent(cm, lineView) {
    - // The padding-right forces the element to have a 'border', which
    - // is needed on Webkit to be able to get line-level bounding
    - // rectangles for it (in measureChar).
    - var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null);
    - var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
    - col: 0, pos: 0, cm: cm,
    - trailingSpace: false,
    - splitSpaces: cm.getOption("lineWrapping")};
    - lineView.measure = {};
    -
    - // Iterate over the logical lines that make up this visual line.
    - for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
    - var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);
    - builder.pos = 0;
    - builder.addToken = buildToken;
    - // Optionally wire in some hacks into the token-rendering
    - // algorithm, to deal with browser quirks.
    - if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
    - { builder.addToken = buildTokenBadBidi(builder.addToken, order); }
    - builder.map = [];
    - var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);
    - insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));
    - if (line.styleClasses) {
    - if (line.styleClasses.bgClass)
    - { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); }
    - if (line.styleClasses.textClass)
    - { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); }
    - }
    -
    - // Ensure at least a single node is present, for measuring.
    - if (builder.map.length == 0)
    - { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }
    -
    - // Store the map and a cache object for the current logical line
    - if (i == 0) {
    - lineView.measure.map = builder.map;
    - lineView.measure.cache = {};
    - } else {
    - (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
    - ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});
    - }
    - }
    -
    - // See issue #2901
    - if (webkit) {
    - var last = builder.content.lastChild;
    - if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
    - { builder.content.className = "cm-tab-wrap-hack"; }
    - }
    -
    - signal(cm, "renderLine", cm, lineView.line, builder.pre);
    - if (builder.pre.className)
    - { builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); }
    -
    - return builder
    - }
    -
    - function defaultSpecialCharPlaceholder(ch) {
    - var token = elt("span", "\u2022", "cm-invalidchar");
    - token.title = "\\u" + ch.charCodeAt(0).toString(16);
    - token.setAttribute("aria-label", token.title);
    - return token
    - }
    -
    - // Build up the DOM representation for a single token, and add it to
    - // the line map. Takes care to render special characters separately.
    - function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {
    - if (!text) { return }
    - var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;
    - var special = builder.cm.state.specialChars, mustWrap = false;
    - var content;
    - if (!special.test(text)) {
    - builder.col += text.length;
    - content = document.createTextNode(displayText);
    - builder.map.push(builder.pos, builder.pos + text.length, content);
    - if (ie && ie_version < 9) { mustWrap = true; }
    - builder.pos += text.length;
    - } else {
    - content = document.createDocumentFragment();
    - var pos = 0;
    - while (true) {
    - special.lastIndex = pos;
    - var m = special.exec(text);
    - var skipped = m ? m.index - pos : text.length - pos;
    - if (skipped) {
    - var txt = document.createTextNode(displayText.slice(pos, pos + skipped));
    - if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])); }
    - else { content.appendChild(txt); }
    - builder.map.push(builder.pos, builder.pos + skipped, txt);
    - builder.col += skipped;
    - builder.pos += skipped;
    - }
    - if (!m) { break }
    - pos += skipped + 1;
    - var txt$1 = (void 0);
    - if (m[0] == "\t") {
    - var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
    - txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
    - txt$1.setAttribute("role", "presentation");
    - txt$1.setAttribute("cm-text", "\t");
    - builder.col += tabWidth;
    - } else if (m[0] == "\r" || m[0] == "\n") {
    - txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"));
    - txt$1.setAttribute("cm-text", m[0]);
    - builder.col += 1;
    - } else {
    - txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);
    - txt$1.setAttribute("cm-text", m[0]);
    - if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])); }
    - else { content.appendChild(txt$1); }
    - builder.col += 1;
    - }
    - builder.map.push(builder.pos, builder.pos + 1, txt$1);
    - builder.pos++;
    - }
    - }
    - builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;
    - if (style || startStyle || endStyle || mustWrap || css) {
    - var fullStyle = style || "";
    - if (startStyle) { fullStyle += startStyle; }
    - if (endStyle) { fullStyle += endStyle; }
    - var token = elt("span", [content], fullStyle, css);
    - if (attributes) {
    - for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != "style" && attr != "class")
    - { token.setAttribute(attr, attributes[attr]); } }
    - }
    - return builder.content.appendChild(token)
    - }
    - builder.content.appendChild(content);
    - }
    -
    - // Change some spaces to NBSP to prevent the browser from collapsing
    - // trailing spaces at the end of a line when rendering text (issue #1362).
    - function splitSpaces(text, trailingBefore) {
    - if (text.length > 1 && !/ /.test(text)) { return text }
    - var spaceBefore = trailingBefore, result = "";
    - for (var i = 0; i < text.length; i++) {
    - var ch = text.charAt(i);
    - if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
    - { ch = "\u00a0"; }
    - result += ch;
    - spaceBefore = ch == " ";
    - }
    - return result
    - }
    -
    - // Work around nonsense dimensions being reported for stretches of
    - // right-to-left text.
    - function buildTokenBadBidi(inner, order) {
    - return function (builder, text, style, startStyle, endStyle, css, attributes) {
    - style = style ? style + " cm-force-border" : "cm-force-border";
    - var start = builder.pos, end = start + text.length;
    - for (;;) {
    - // Find the part that overlaps with the start of this text
    - var part = (void 0);
    - for (var i = 0; i < order.length; i++) {
    - part = order[i];
    - if (part.to > start && part.from <= start) { break }
    - }
    - if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, css, attributes) }
    - inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes);
    - startStyle = null;
    - text = text.slice(part.to - start);
    - start = part.to;
    - }
    - }
    - }
    -
    - function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
    - var widget = !ignoreWidget && marker.widgetNode;
    - if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }
    - if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
    - if (!widget)
    - { widget = builder.content.appendChild(document.createElement("span")); }
    - widget.setAttribute("cm-marker", marker.id);
    - }
    - if (widget) {
    - builder.cm.display.input.setUneditable(widget);
    - builder.content.appendChild(widget);
    - }
    - builder.pos += size;
    - builder.trailingSpace = false;
    - }
    -
    - // Outputs a number of spans to make up a line, taking highlighting
    - // and marked text into account.
    - function insertLineContent(line, builder, styles) {
    - var spans = line.markedSpans, allText = line.text, at = 0;
    - if (!spans) {
    - for (var i$1 = 1; i$1 < styles.length; i$1+=2)
    - { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }
    - return
    - }
    -
    - var len = allText.length, pos = 0, i = 1, text = "", style, css;
    - var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;
    - for (;;) {
    - if (nextChange == pos) { // Update current marker set
    - spanStyle = spanEndStyle = spanStartStyle = css = "";
    - attributes = null;
    - collapsed = null; nextChange = Infinity;
    - var foundBookmarks = [], endStyles = (void 0);
    - for (var j = 0; j < spans.length; ++j) {
    - var sp = spans[j], m = sp.marker;
    - if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
    - foundBookmarks.push(m);
    - } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
    - if (sp.to != null && sp.to != pos && nextChange > sp.to) {
    - nextChange = sp.to;
    - spanEndStyle = "";
    - }
    - if (m.className) { spanStyle += " " + m.className; }
    - if (m.css) { css = (css ? css + ";" : "") + m.css; }
    - if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; }
    - if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }
    - // support for the old title property
    - // https://github.com/codemirror/CodeMirror/pull/5673
    - if (m.title) { (attributes || (attributes = {})).title = m.title; }
    - if (m.attributes) {
    - for (var attr in m.attributes)
    - { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }
    - }
    - if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
    - { collapsed = sp; }
    - } else if (sp.from > pos && nextChange > sp.from) {
    - nextChange = sp.from;
    - }
    - }
    - if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
    - { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } }
    -
    - if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)
    - { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }
    - if (collapsed && (collapsed.from || 0) == pos) {
    - buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
    - collapsed.marker, collapsed.from == null);
    - if (collapsed.to == null) { return }
    - if (collapsed.to == pos) { collapsed = false; }
    - }
    - }
    - if (pos >= len) { break }
    -
    - var upto = Math.min(len, nextChange);
    - while (true) {
    - if (text) {
    - var end = pos + text.length;
    - if (!collapsed) {
    - var tokenText = end > upto ? text.slice(0, upto - pos) : text;
    - builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
    - spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", css, attributes);
    - }
    - if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
    - pos = end;
    - spanStartStyle = "";
    - }
    - text = allText.slice(at, at = styles[i++]);
    - style = interpretTokenStyle(styles[i++], builder.cm.options);
    - }
    - }
    - }
    -
    -
    - // These objects are used to represent the visible (currently drawn)
    - // part of the document. A LineView may correspond to multiple
    - // logical lines, if those are connected by collapsed ranges.
    - function LineView(doc, line, lineN) {
    - // The starting line
    - this.line = line;
    - // Continuing lines, if any
    - this.rest = visualLineContinued(line);
    - // Number of logical lines in this visual line
    - this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;
    - this.node = this.text = null;
    - this.hidden = lineIsHidden(doc, line);
    - }
    -
    - // Create a range of LineView objects for the given lines.
    - function buildViewArray(cm, from, to) {
    - var array = [], nextPos;
    - for (var pos = from; pos < to; pos = nextPos) {
    - var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);
    - nextPos = pos + view.size;
    - array.push(view);
    - }
    - return array
    - }
    -
    - var operationGroup = null;
    -
    - function pushOperation(op) {
    - if (operationGroup) {
    - operationGroup.ops.push(op);
    - } else {
    - op.ownsGroup = operationGroup = {
    - ops: [op],
    - delayedCallbacks: []
    - };
    - }
    - }
    -
    - function fireCallbacksForOps(group) {
    - // Calls delayed callbacks and cursorActivity handlers until no
    - // new ones appear
    - var callbacks = group.delayedCallbacks, i = 0;
    - do {
    - for (; i < callbacks.length; i++)
    - { callbacks[i].call(null); }
    - for (var j = 0; j < group.ops.length; j++) {
    - var op = group.ops[j];
    - if (op.cursorActivityHandlers)
    - { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
    - { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }
    - }
    - } while (i < callbacks.length)
    - }
    -
    - function finishOperation(op, endCb) {
    - var group = op.ownsGroup;
    - if (!group) { return }
    -
    - try { fireCallbacksForOps(group); }
    - finally {
    - operationGroup = null;
    - endCb(group);
    - }
    - }
    -
    - var orphanDelayedCallbacks = null;
    -
    - // Often, we want to signal events at a point where we are in the
    - // middle of some work, but don't want the handler to start calling
    - // other methods on the editor, which might be in an inconsistent
    - // state or simply not expect any other events to happen.
    - // signalLater looks whether there are any handlers, and schedules
    - // them to be executed when the last operation ends, or, if no
    - // operation is active, when a timeout fires.
    - function signalLater(emitter, type /*, values...*/) {
    - var arr = getHandlers(emitter, type);
    - if (!arr.length) { return }
    - var args = Array.prototype.slice.call(arguments, 2), list;
    - if (operationGroup) {
    - list = operationGroup.delayedCallbacks;
    - } else if (orphanDelayedCallbacks) {
    - list = orphanDelayedCallbacks;
    - } else {
    - list = orphanDelayedCallbacks = [];
    - setTimeout(fireOrphanDelayed, 0);
    - }
    - var loop = function ( i ) {
    - list.push(function () { return arr[i].apply(null, args); });
    - };
    -
    - for (var i = 0; i < arr.length; ++i)
    - loop( i );
    - }
    -
    - function fireOrphanDelayed() {
    - var delayed = orphanDelayedCallbacks;
    - orphanDelayedCallbacks = null;
    - for (var i = 0; i < delayed.length; ++i) { delayed[i](); }
    - }
    -
    - // When an aspect of a line changes, a string is added to
    - // lineView.changes. This updates the relevant part of the line's
    - // DOM structure.
    - function updateLineForChanges(cm, lineView, lineN, dims) {
    - for (var j = 0; j < lineView.changes.length; j++) {
    - var type = lineView.changes[j];
    - if (type == "text") { updateLineText(cm, lineView); }
    - else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); }
    - else if (type == "class") { updateLineClasses(cm, lineView); }
    - else if (type == "widget") { updateLineWidgets(cm, lineView, dims); }
    - }
    - lineView.changes = null;
    - }
    -
    - // Lines with gutter elements, widgets or a background class need to
    - // be wrapped, and have the extra elements added to the wrapper div
    - function ensureLineWrapped(lineView) {
    - if (lineView.node == lineView.text) {
    - lineView.node = elt("div", null, null, "position: relative");
    - if (lineView.text.parentNode)
    - { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }
    - lineView.node.appendChild(lineView.text);
    - if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }
    - }
    - return lineView.node
    - }
    -
    - function updateLineBackground(cm, lineView) {
    - var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass;
    - if (cls) { cls += " CodeMirror-linebackground"; }
    - if (lineView.background) {
    - if (cls) { lineView.background.className = cls; }
    - else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }
    - } else if (cls) {
    - var wrap = ensureLineWrapped(lineView);
    - lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild);
    - cm.display.input.setUneditable(lineView.background);
    - }
    - }
    -
    - // Wrapper around buildLineContent which will reuse the structure
    - // in display.externalMeasured when possible.
    - function getLineContent(cm, lineView) {
    - var ext = cm.display.externalMeasured;
    - if (ext && ext.line == lineView.line) {
    - cm.display.externalMeasured = null;
    - lineView.measure = ext.measure;
    - return ext.built
    - }
    - return buildLineContent(cm, lineView)
    - }
    -
    - // Redraw the line's text. Interacts with the background and text
    - // classes because the mode may output tokens that influence these
    - // classes.
    - function updateLineText(cm, lineView) {
    - var cls = lineView.text.className;
    - var built = getLineContent(cm, lineView);
    - if (lineView.text == lineView.node) { lineView.node = built.pre; }
    - lineView.text.parentNode.replaceChild(built.pre, lineView.text);
    - lineView.text = built.pre;
    - if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
    - lineView.bgClass = built.bgClass;
    - lineView.textClass = built.textClass;
    - updateLineClasses(cm, lineView);
    - } else if (cls) {
    - lineView.text.className = cls;
    - }
    - }
    -
    - function updateLineClasses(cm, lineView) {
    - updateLineBackground(cm, lineView);
    - if (lineView.line.wrapClass)
    - { ensureLineWrapped(lineView).className = lineView.line.wrapClass; }
    - else if (lineView.node != lineView.text)
    - { lineView.node.className = ""; }
    - var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass;
    - lineView.text.className = textClass || "";
    - }
    -
    - function updateLineGutter(cm, lineView, lineN, dims) {
    - if (lineView.gutter) {
    - lineView.node.removeChild(lineView.gutter);
    - lineView.gutter = null;
    - }
    - if (lineView.gutterBackground) {
    - lineView.node.removeChild(lineView.gutterBackground);
    - lineView.gutterBackground = null;
    - }
    - if (lineView.line.gutterClass) {
    - var wrap = ensureLineWrapped(lineView);
    - lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
    - ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"));
    - cm.display.input.setUneditable(lineView.gutterBackground);
    - wrap.insertBefore(lineView.gutterBackground, lineView.text);
    - }
    - var markers = lineView.line.gutterMarkers;
    - if (cm.options.lineNumbers || markers) {
    - var wrap$1 = ensureLineWrapped(lineView);
    - var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"));
    - cm.display.input.setUneditable(gutterWrap);
    - wrap$1.insertBefore(gutterWrap, lineView.text);
    - if (lineView.line.gutterClass)
    - { gutterWrap.className += " " + lineView.line.gutterClass; }
    - if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
    - { lineView.lineNumber = gutterWrap.appendChild(
    - elt("div", lineNumberFor(cm.options, lineN),
    - "CodeMirror-linenumber CodeMirror-gutter-elt",
    - ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))); }
    - if (markers) { for (var k = 0; k < cm.display.gutterSpecs.length; ++k) {
    - var id = cm.display.gutterSpecs[k].className, found = markers.hasOwnProperty(id) && markers[id];
    - if (found)
    - { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
    - ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))); }
    - } }
    - }
    - }
    -
    - function updateLineWidgets(cm, lineView, dims) {
    - if (lineView.alignable) { lineView.alignable = null; }
    - for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
    - next = node.nextSibling;
    - if (node.className == "CodeMirror-linewidget")
    - { lineView.node.removeChild(node); }
    - }
    - insertLineWidgets(cm, lineView, dims);
    - }
    -
    - // Build a line's DOM representation from scratch
    - function buildLineElement(cm, lineView, lineN, dims) {
    - var built = getLineContent(cm, lineView);
    - lineView.text = lineView.node = built.pre;
    - if (built.bgClass) { lineView.bgClass = built.bgClass; }
    - if (built.textClass) { lineView.textClass = built.textClass; }
    -
    - updateLineClasses(cm, lineView);
    - updateLineGutter(cm, lineView, lineN, dims);
    - insertLineWidgets(cm, lineView, dims);
    - return lineView.node
    - }
    -
    - // A lineView may contain multiple logical lines (when merged by
    - // collapsed spans). The widgets for all of them need to be drawn.
    - function insertLineWidgets(cm, lineView, dims) {
    - insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);
    - if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
    - { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }
    - }
    -
    - function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
    - if (!line.widgets) { return }
    - var wrap = ensureLineWrapped(lineView);
    - for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
    - var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
    - if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); }
    - positionLineWidget(widget, node, lineView, dims);
    - cm.display.input.setUneditable(node);
    - if (allowAbove && widget.above)
    - { wrap.insertBefore(node, lineView.gutter || lineView.text); }
    - else
    - { wrap.appendChild(node); }
    - signalLater(widget, "redraw");
    - }
    - }
    -
    - function positionLineWidget(widget, node, lineView, dims) {
    - if (widget.noHScroll) {
    - (lineView.alignable || (lineView.alignable = [])).push(node);
    - var width = dims.wrapperWidth;
    - node.style.left = dims.fixedPos + "px";
    - if (!widget.coverGutter) {
    - width -= dims.gutterTotalWidth;
    - node.style.paddingLeft = dims.gutterTotalWidth + "px";
    - }
    - node.style.width = width + "px";
    - }
    - if (widget.coverGutter) {
    - node.style.zIndex = 5;
    - node.style.position = "relative";
    - if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px"; }
    - }
    - }
    -
    - function widgetHeight(widget) {
    - if (widget.height != null) { return widget.height }
    - var cm = widget.doc.cm;
    - if (!cm) { return 0 }
    - if (!contains(document.body, widget.node)) {
    - var parentStyle = "position: relative;";
    - if (widget.coverGutter)
    - { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; }
    - if (widget.noHScroll)
    - { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; }
    - removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle));
    - }
    - return widget.height = widget.node.parentNode.offsetHeight
    - }
    -
    - // Return true when the given mouse event happened in a widget
    - function eventInWidget(display, e) {
    - for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
    - if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
    - (n.parentNode == display.sizer && n != display.mover))
    - { return true }
    - }
    - }
    -
    - // POSITION MEASUREMENT
    -
    - function paddingTop(display) {return display.lineSpace.offsetTop}
    - function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
    - function paddingH(display) {
    - if (display.cachedPaddingH) { return display.cachedPaddingH }
    - var e = removeChildrenAndAdd(display.measure, elt("pre", "x", "CodeMirror-line-like"));
    - var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
    - var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
    - if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }
    - return data
    - }
    -
    - function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
    - function displayWidth(cm) {
    - return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
    - }
    - function displayHeight(cm) {
    - return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
    - }
    -
    - // Ensure the lineView.wrapping.heights array is populated. This is
    - // an array of bottom offsets for the lines that make up a drawn
    - // line. When lineWrapping is on, there might be more than one
    - // height.
    - function ensureLineHeights(cm, lineView, rect) {
    - var wrapping = cm.options.lineWrapping;
    - var curWidth = wrapping && displayWidth(cm);
    - if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
    - var heights = lineView.measure.heights = [];
    - if (wrapping) {
    - lineView.measure.width = curWidth;
    - var rects = lineView.text.firstChild.getClientRects();
    - for (var i = 0; i < rects.length - 1; i++) {
    - var cur = rects[i], next = rects[i + 1];
    - if (Math.abs(cur.bottom - next.bottom) > 2)
    - { heights.push((cur.bottom + next.top) / 2 - rect.top); }
    - }
    - }
    - heights.push(rect.bottom - rect.top);
    - }
    - }
    -
    - // Find a line map (mapping character offsets to text nodes) and a
    - // measurement cache for the given line number. (A line view might
    - // contain multiple lines when collapsed ranges are present.)
    - function mapFromLineView(lineView, line, lineN) {
    - if (lineView.line == line)
    - { return {map: lineView.measure.map, cache: lineView.measure.cache} }
    - for (var i = 0; i < lineView.rest.length; i++)
    - { if (lineView.rest[i] == line)
    - { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
    - for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
    - { if (lineNo(lineView.rest[i$1]) > lineN)
    - { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
    - }
    -
    - // Render a line into the hidden node display.externalMeasured. Used
    - // when measurement is needed for a line that's not in the viewport.
    - function updateExternalMeasurement(cm, line) {
    - line = visualLine(line);
    - var lineN = lineNo(line);
    - var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);
    - view.lineN = lineN;
    - var built = view.built = buildLineContent(cm, view);
    - view.text = built.pre;
    - removeChildrenAndAdd(cm.display.lineMeasure, built.pre);
    - return view
    - }
    -
    - // Get a {top, bottom, left, right} box (in line-local coordinates)
    - // for a given character.
    - function measureChar(cm, line, ch, bias) {
    - return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
    - }
    -
    - // Find a line view that corresponds to the given line number.
    - function findViewForLine(cm, lineN) {
    - if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
    - { return cm.display.view[findViewIndex(cm, lineN)] }
    - var ext = cm.display.externalMeasured;
    - if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
    - { return ext }
    - }
    -
    - // Measurement can be split in two steps, the set-up work that
    - // applies to the whole line, and the measurement of the actual
    - // character. Functions like coordsChar, that need to do a lot of
    - // measurements in a row, can thus ensure that the set-up work is
    - // only done once.
    - function prepareMeasureForLine(cm, line) {
    - var lineN = lineNo(line);
    - var view = findViewForLine(cm, lineN);
    - if (view && !view.text) {
    - view = null;
    - } else if (view && view.changes) {
    - updateLineForChanges(cm, view, lineN, getDimensions(cm));
    - cm.curOp.forceUpdate = true;
    - }
    - if (!view)
    - { view = updateExternalMeasurement(cm, line); }
    -
    - var info = mapFromLineView(view, line, lineN);
    - return {
    - line: line, view: view, rect: null,
    - map: info.map, cache: info.cache, before: info.before,
    - hasHeights: false
    - }
    - }
    -
    - // Given a prepared measurement object, measures the position of an
    - // actual character (or fetches it from the cache).
    - function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
    - if (prepared.before) { ch = -1; }
    - var key = ch + (bias || ""), found;
    - if (prepared.cache.hasOwnProperty(key)) {
    - found = prepared.cache[key];
    - } else {
    - if (!prepared.rect)
    - { prepared.rect = prepared.view.text.getBoundingClientRect(); }
    - if (!prepared.hasHeights) {
    - ensureLineHeights(cm, prepared.view, prepared.rect);
    - prepared.hasHeights = true;
    - }
    - found = measureCharInner(cm, prepared, ch, bias);
    - if (!found.bogus) { prepared.cache[key] = found; }
    - }
    - return {left: found.left, right: found.right,
    - top: varHeight ? found.rtop : found.top,
    - bottom: varHeight ? found.rbottom : found.bottom}
    - }
    -
    - var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
    -
    - function nodeAndOffsetInLineMap(map$$1, ch, bias) {
    - var node, start, end, collapse, mStart, mEnd;
    - // First, search the line map for the text node corresponding to,
    - // or closest to, the target character.
    - for (var i = 0; i < map$$1.length; i += 3) {
    - mStart = map$$1[i];
    - mEnd = map$$1[i + 1];
    - if (ch < mStart) {
    - start = 0; end = 1;
    - collapse = "left";
    - } else if (ch < mEnd) {
    - start = ch - mStart;
    - end = start + 1;
    - } else if (i == map$$1.length - 3 || ch == mEnd && map$$1[i + 3] > ch) {
    - end = mEnd - mStart;
    - start = end - 1;
    - if (ch >= mEnd) { collapse = "right"; }
    - }
    - if (start != null) {
    - node = map$$1[i + 2];
    - if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
    - { collapse = bias; }
    - if (bias == "left" && start == 0)
    - { while (i && map$$1[i - 2] == map$$1[i - 3] && map$$1[i - 1].insertLeft) {
    - node = map$$1[(i -= 3) + 2];
    - collapse = "left";
    - } }
    - if (bias == "right" && start == mEnd - mStart)
    - { while (i < map$$1.length - 3 && map$$1[i + 3] == map$$1[i + 4] && !map$$1[i + 5].insertLeft) {
    - node = map$$1[(i += 3) + 2];
    - collapse = "right";
    - } }
    - break
    - }
    - }
    - return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
    - }
    -
    - function getUsefulRect(rects, bias) {
    - var rect = nullRect;
    - if (bias == "left") { for (var i = 0; i < rects.length; i++) {
    - if ((rect = rects[i]).left != rect.right) { break }
    - } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
    - if ((rect = rects[i$1]).left != rect.right) { break }
    - } }
    - return rect
    - }
    -
    - function measureCharInner(cm, prepared, ch, bias) {
    - var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);
    - var node = place.node, start = place.start, end = place.end, collapse = place.collapse;
    -
    - var rect;
    - if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
    - for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
    - while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }
    - while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }
    - if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
    - { rect = node.parentNode.getBoundingClientRect(); }
    - else
    - { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }
    - if (rect.left || rect.right || start == 0) { break }
    - end = start;
    - start = start - 1;
    - collapse = "right";
    - }
    - if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }
    - } else { // If it is a widget, simply get the box for the whole widget.
    - if (start > 0) { collapse = bias = "right"; }
    - var rects;
    - if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
    - { rect = rects[bias == "right" ? rects.length - 1 : 0]; }
    - else
    - { rect = node.getBoundingClientRect(); }
    - }
    - if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
    - var rSpan = node.parentNode.getClientRects()[0];
    - if (rSpan)
    - { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }
    - else
    - { rect = nullRect; }
    - }
    -
    - var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;
    - var mid = (rtop + rbot) / 2;
    - var heights = prepared.view.measure.heights;
    - var i = 0;
    - for (; i < heights.length - 1; i++)
    - { if (mid < heights[i]) { break } }
    - var top = i ? heights[i - 1] : 0, bot = heights[i];
    - var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
    - right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
    - top: top, bottom: bot};
    - if (!rect.left && !rect.right) { result.bogus = true; }
    - if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }
    -
    - return result
    - }
    -
    - // Work around problem with bounding client rects on ranges being
    - // returned incorrectly when zoomed on IE10 and below.
    - function maybeUpdateRectForZooming(measure, rect) {
    - if (!window.screen || screen.logicalXDPI == null ||
    - screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
    - { return rect }
    - var scaleX = screen.logicalXDPI / screen.deviceXDPI;
    - var scaleY = screen.logicalYDPI / screen.deviceYDPI;
    - return {left: rect.left * scaleX, right: rect.right * scaleX,
    - top: rect.top * scaleY, bottom: rect.bottom * scaleY}
    - }
    -
    - function clearLineMeasurementCacheFor(lineView) {
    - if (lineView.measure) {
    - lineView.measure.cache = {};
    - lineView.measure.heights = null;
    - if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
    - { lineView.measure.caches[i] = {}; } }
    - }
    - }
    -
    - function clearLineMeasurementCache(cm) {
    - cm.display.externalMeasure = null;
    - removeChildren(cm.display.lineMeasure);
    - for (var i = 0; i < cm.display.view.length; i++)
    - { clearLineMeasurementCacheFor(cm.display.view[i]); }
    - }
    -
    - function clearCaches(cm) {
    - clearLineMeasurementCache(cm);
    - cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
    - if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }
    - cm.display.lineNumChars = null;
    - }
    -
    - function pageScrollX() {
    - // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206
    - // which causes page_Offset and bounding client rects to use
    - // different reference viewports and invalidate our calculations.
    - if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) }
    - return window.pageXOffset || (document.documentElement || document.body).scrollLeft
    - }
    - function pageScrollY() {
    - if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) }
    - return window.pageYOffset || (document.documentElement || document.body).scrollTop
    - }
    -
    - function widgetTopHeight(lineObj) {
    - var height = 0;
    - if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above)
    - { height += widgetHeight(lineObj.widgets[i]); } } }
    - return height
    - }
    -
    - // Converts a {top, bottom, left, right} box from line-local
    - // coordinates into another coordinate system. Context may be one of
    - // "line", "div" (display.lineDiv), "local"./null (editor), "window",
    - // or "page".
    - function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
    - if (!includeWidgets) {
    - var height = widgetTopHeight(lineObj);
    - rect.top += height; rect.bottom += height;
    - }
    - if (context == "line") { return rect }
    - if (!context) { context = "local"; }
    - var yOff = heightAtLine(lineObj);
    - if (context == "local") { yOff += paddingTop(cm.display); }
    - else { yOff -= cm.display.viewOffset; }
    - if (context == "page" || context == "window") {
    - var lOff = cm.display.lineSpace.getBoundingClientRect();
    - yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
    - var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
    - rect.left += xOff; rect.right += xOff;
    - }
    - rect.top += yOff; rect.bottom += yOff;
    - return rect
    - }
    -
    - // Coverts a box from "div" coords to another coordinate system.
    - // Context may be "window", "page", "div", or "local"./null.
    - function fromCoordSystem(cm, coords, context) {
    - if (context == "div") { return coords }
    - var left = coords.left, top = coords.top;
    - // First move into "page" coordinate system
    - if (context == "page") {
    - left -= pageScrollX();
    - top -= pageScrollY();
    - } else if (context == "local" || !context) {
    - var localBox = cm.display.sizer.getBoundingClientRect();
    - left += localBox.left;
    - top += localBox.top;
    - }
    -
    - var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
    - return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
    - }
    -
    - function charCoords(cm, pos, context, lineObj, bias) {
    - if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }
    - return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
    - }
    -
    - // Returns a box for a given cursor position, which may have an
    - // 'other' property containing the position of the secondary cursor
    - // on a bidi boundary.
    - // A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
    - // and after `char - 1` in writing order of `char - 1`
    - // A cursor Pos(line, char, "after") is on the same visual line as `char`
    - // and before `char` in writing order of `char`
    - // Examples (upper-case letters are RTL, lower-case are LTR):
    - // Pos(0, 1, ...)
    - // before after
    - // ab a|b a|b
    - // aB a|B aB|
    - // Ab |Ab A|b
    - // AB B|A B|A
    - // Every position after the last character on a line is considered to stick
    - // to the last character on the line.
    - function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
    - lineObj = lineObj || getLine(cm.doc, pos.line);
    - if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
    - function get(ch, right) {
    - var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight);
    - if (right) { m.left = m.right; } else { m.right = m.left; }
    - return intoCoordSystem(cm, lineObj, m, context)
    - }
    - var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;
    - if (ch >= lineObj.text.length) {
    - ch = lineObj.text.length;
    - sticky = "before";
    - } else if (ch <= 0) {
    - ch = 0;
    - sticky = "after";
    - }
    - if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }
    -
    - function getBidi(ch, partPos, invert) {
    - var part = order[partPos], right = part.level == 1;
    - return get(invert ? ch - 1 : ch, right != invert)
    - }
    - var partPos = getBidiPartAt(order, ch, sticky);
    - var other = bidiOther;
    - var val = getBidi(ch, partPos, sticky == "before");
    - if (other != null) { val.other = getBidi(ch, other, sticky != "before"); }
    - return val
    - }
    -
    - // Used to cheaply estimate the coordinates for a position. Used for
    - // intermediate scroll updates.
    - function estimateCoords(cm, pos) {
    - var left = 0;
    - pos = clipPos(cm.doc, pos);
    - if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }
    - var lineObj = getLine(cm.doc, pos.line);
    - var top = heightAtLine(lineObj) + paddingTop(cm.display);
    - return {left: left, right: left, top: top, bottom: top + lineObj.height}
    - }
    -
    - // Positions returned by coordsChar contain some extra information.
    - // xRel is the relative x position of the input coordinates compared
    - // to the found position (so xRel > 0 means the coordinates are to
    - // the right of the character position, for example). When outside
    - // is true, that means the coordinates lie outside the line's
    - // vertical range.
    - function PosWithInfo(line, ch, sticky, outside, xRel) {
    - var pos = Pos(line, ch, sticky);
    - pos.xRel = xRel;
    - if (outside) { pos.outside = outside; }
    - return pos
    - }
    -
    - // Compute the character position closest to the given coordinates.
    - // Input must be lineSpace-local ("div" coordinate system).
    - function coordsChar(cm, x, y) {
    - var doc = cm.doc;
    - y += cm.display.viewOffset;
    - if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }
    - var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
    - if (lineN > last)
    - { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }
    - if (x < 0) { x = 0; }
    -
    - var lineObj = getLine(doc, lineN);
    - for (;;) {
    - var found = coordsCharInner(cm, lineObj, lineN, x, y);
    - var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));
    - if (!collapsed) { return found }
    - var rangeEnd = collapsed.find(1);
    - if (rangeEnd.line == lineN) { return rangeEnd }
    - lineObj = getLine(doc, lineN = rangeEnd.line);
    - }
    - }
    -
    - function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
    - y -= widgetTopHeight(lineObj);
    - var end = lineObj.text.length;
    - var begin = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y; }, end, 0);
    - end = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch).top > y; }, begin, end);
    - return {begin: begin, end: end}
    - }
    -
    - function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
    - if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
    - var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top;
    - return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
    - }
    -
    - // Returns true if the given side of a box is after the given
    - // coordinates, in top-to-bottom, left-to-right order.
    - function boxIsAfter(box, x, y, left) {
    - return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x
    - }
    -
    - function coordsCharInner(cm, lineObj, lineNo$$1, x, y) {
    - // Move y into line-local coordinate space
    - y -= heightAtLine(lineObj);
    - var preparedMeasure = prepareMeasureForLine(cm, lineObj);
    - // When directly calling `measureCharPrepared`, we have to adjust
    - // for the widgets at this line.
    - var widgetHeight$$1 = widgetTopHeight(lineObj);
    - var begin = 0, end = lineObj.text.length, ltr = true;
    -
    - var order = getOrder(lineObj, cm.doc.direction);
    - // If the line isn't plain left-to-right text, first figure out
    - // which bidi section the coordinates fall into.
    - if (order) {
    - var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)
    - (cm, lineObj, lineNo$$1, preparedMeasure, order, x, y);
    - ltr = part.level != 1;
    - // The awkward -1 offsets are needed because findFirst (called
    - // on these below) will treat its first bound as inclusive,
    - // second as exclusive, but we want to actually address the
    - // characters in the part's range
    - begin = ltr ? part.from : part.to - 1;
    - end = ltr ? part.to : part.from - 1;
    - }
    -
    - // A binary search to find the first character whose bounding box
    - // starts after the coordinates. If we run across any whose box wrap
    - // the coordinates, store that.
    - var chAround = null, boxAround = null;
    - var ch = findFirst(function (ch) {
    - var box = measureCharPrepared(cm, preparedMeasure, ch);
    - box.top += widgetHeight$$1; box.bottom += widgetHeight$$1;
    - if (!boxIsAfter(box, x, y, false)) { return false }
    - if (box.top <= y && box.left <= x) {
    - chAround = ch;
    - boxAround = box;
    - }
    - return true
    - }, begin, end);
    -
    - var baseX, sticky, outside = false;
    - // If a box around the coordinates was found, use that
    - if (boxAround) {
    - // Distinguish coordinates nearer to the left or right side of the box
    - var atLeft = x - boxAround.left < boxAround.right - x, atStart = atLeft == ltr;
    - ch = chAround + (atStart ? 0 : 1);
    - sticky = atStart ? "after" : "before";
    - baseX = atLeft ? boxAround.left : boxAround.right;
    - } else {
    - // (Adjust for extended bound, if necessary.)
    - if (!ltr && (ch == end || ch == begin)) { ch++; }
    - // To determine which side to associate with, get the box to the
    - // left of the character and compare it's vertical position to the
    - // coordinates
    - sticky = ch == 0 ? "after" : ch == lineObj.text.length ? "before" :
    - (measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight$$1 <= y) == ltr ?
    - "after" : "before";
    - // Now get accurate coordinates for this place, in order to get a
    - // base X position
    - var coords = cursorCoords(cm, Pos(lineNo$$1, ch, sticky), "line", lineObj, preparedMeasure);
    - baseX = coords.left;
    - outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0;
    - }
    -
    - ch = skipExtendingChars(lineObj.text, ch, 1);
    - return PosWithInfo(lineNo$$1, ch, sticky, outside, x - baseX)
    - }
    -
    - function coordsBidiPart(cm, lineObj, lineNo$$1, preparedMeasure, order, x, y) {
    - // Bidi parts are sorted left-to-right, and in a non-line-wrapping
    - // situation, we can take this ordering to correspond to the visual
    - // ordering. This finds the first part whose end is after the given
    - // coordinates.
    - var index = findFirst(function (i) {
    - var part = order[i], ltr = part.level != 1;
    - return boxIsAfter(cursorCoords(cm, Pos(lineNo$$1, ltr ? part.to : part.from, ltr ? "before" : "after"),
    - "line", lineObj, preparedMeasure), x, y, true)
    - }, 0, order.length - 1);
    - var part = order[index];
    - // If this isn't the first part, the part's start is also after
    - // the coordinates, and the coordinates aren't on the same line as
    - // that start, move one part back.
    - if (index > 0) {
    - var ltr = part.level != 1;
    - var start = cursorCoords(cm, Pos(lineNo$$1, ltr ? part.from : part.to, ltr ? "after" : "before"),
    - "line", lineObj, preparedMeasure);
    - if (boxIsAfter(start, x, y, true) && start.top > y)
    - { part = order[index - 1]; }
    - }
    - return part
    - }
    -
    - function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {
    - // In a wrapped line, rtl text on wrapping boundaries can do things
    - // that don't correspond to the ordering in our `order` array at
    - // all, so a binary search doesn't work, and we want to return a
    - // part that only spans one line so that the binary search in
    - // coordsCharInner is safe. As such, we first find the extent of the
    - // wrapped line, and then do a flat search in which we discard any
    - // spans that aren't on the line.
    - var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y);
    - var begin = ref.begin;
    - var end = ref.end;
    - if (/\s/.test(lineObj.text.charAt(end - 1))) { end--; }
    - var part = null, closestDist = null;
    - for (var i = 0; i < order.length; i++) {
    - var p = order[i];
    - if (p.from >= end || p.to <= begin) { continue }
    - var ltr = p.level != 1;
    - var endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right;
    - // Weigh against spans ending before this, so that they are only
    - // picked if nothing ends after
    - var dist = endX < x ? x - endX + 1e9 : endX - x;
    - if (!part || closestDist > dist) {
    - part = p;
    - closestDist = dist;
    - }
    - }
    - if (!part) { part = order[order.length - 1]; }
    - // Clip the part to the wrapped line.
    - if (part.from < begin) { part = {from: begin, to: part.to, level: part.level}; }
    - if (part.to > end) { part = {from: part.from, to: end, level: part.level}; }
    - return part
    - }
    -
    - var measureText;
    - // Compute the default text height.
    - function textHeight(display) {
    - if (display.cachedTextHeight != null) { return display.cachedTextHeight }
    - if (measureText == null) {
    - measureText = elt("pre", null, "CodeMirror-line-like");
    - // Measure a bunch of lines, for browsers that compute
    - // fractional heights.
    - for (var i = 0; i < 49; ++i) {
    - measureText.appendChild(document.createTextNode("x"));
    - measureText.appendChild(elt("br"));
    - }
    - measureText.appendChild(document.createTextNode("x"));
    - }
    - removeChildrenAndAdd(display.measure, measureText);
    - var height = measureText.offsetHeight / 50;
    - if (height > 3) { display.cachedTextHeight = height; }
    - removeChildren(display.measure);
    - return height || 1
    - }
    -
    - // Compute the default character width.
    - function charWidth(display) {
    - if (display.cachedCharWidth != null) { return display.cachedCharWidth }
    - var anchor = elt("span", "xxxxxxxxxx");
    - var pre = elt("pre", [anchor], "CodeMirror-line-like");
    - removeChildrenAndAdd(display.measure, pre);
    - var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
    - if (width > 2) { display.cachedCharWidth = width; }
    - return width || 10
    - }
    -
    - // Do a bulk-read of the DOM positions and sizes needed to draw the
    - // view, so that we don't interleave reading and writing to the DOM.
    - function getDimensions(cm) {
    - var d = cm.display, left = {}, width = {};
    - var gutterLeft = d.gutters.clientLeft;
    - for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
    - var id = cm.display.gutterSpecs[i].className;
    - left[id] = n.offsetLeft + n.clientLeft + gutterLeft;
    - width[id] = n.clientWidth;
    - }
    - return {fixedPos: compensateForHScroll(d),
    - gutterTotalWidth: d.gutters.offsetWidth,
    - gutterLeft: left,
    - gutterWidth: width,
    - wrapperWidth: d.wrapper.clientWidth}
    - }
    -
    - // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
    - // but using getBoundingClientRect to get a sub-pixel-accurate
    - // result.
    - function compensateForHScroll(display) {
    - return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
    - }
    -
    - // Returns a function that estimates the height of a line, to use as
    - // first approximation until the line becomes visible (and is thus
    - // properly measurable).
    - function estimateHeight(cm) {
    - var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
    - var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
    - return function (line) {
    - if (lineIsHidden(cm.doc, line)) { return 0 }
    -
    - var widgetsHeight = 0;
    - if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
    - if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }
    - } }
    -
    - if (wrapping)
    - { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }
    - else
    - { return widgetsHeight + th }
    - }
    - }
    -
    - function estimateLineHeights(cm) {
    - var doc = cm.doc, est = estimateHeight(cm);
    - doc.iter(function (line) {
    - var estHeight = est(line);
    - if (estHeight != line.height) { updateLineHeight(line, estHeight); }
    - });
    - }
    -
    - // Given a mouse event, find the corresponding position. If liberal
    - // is false, it checks whether a gutter or scrollbar was clicked,
    - // and returns null if it was. forRect is used by rectangular
    - // selections, and tries to estimate a character position even for
    - // coordinates beyond the right of the text.
    - function posFromMouse(cm, e, liberal, forRect) {
    - var display = cm.display;
    - if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }
    -
    - var x, y, space = display.lineSpace.getBoundingClientRect();
    - // Fails unpredictably on IE[67] when mouse is dragged around quickly.
    - try { x = e.clientX - space.left; y = e.clientY - space.top; }
    - catch (e) { return null }
    - var coords = coordsChar(cm, x, y), line;
    - if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
    - var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
    - coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
    - }
    - return coords
    - }
    -
    - // Find the view element corresponding to a given line. Return null
    - // when the line isn't visible.
    - function findViewIndex(cm, n) {
    - if (n >= cm.display.viewTo) { return null }
    - n -= cm.display.viewFrom;
    - if (n < 0) { return null }
    - var view = cm.display.view;
    - for (var i = 0; i < view.length; i++) {
    - n -= view[i].size;
    - if (n < 0) { return i }
    - }
    - }
    -
    - // Updates the display.view data structure for a given change to the
    - // document. From and to are in pre-change coordinates. Lendiff is
    - // the amount of lines added or subtracted by the change. This is
    - // used for changes that span multiple lines, or change the way
    - // lines are divided into visual lines. regLineChange (below)
    - // registers single-line changes.
    - function regChange(cm, from, to, lendiff) {
    - if (from == null) { from = cm.doc.first; }
    - if (to == null) { to = cm.doc.first + cm.doc.size; }
    - if (!lendiff) { lendiff = 0; }
    -
    - var display = cm.display;
    - if (lendiff && to < display.viewTo &&
    - (display.updateLineNumbers == null || display.updateLineNumbers > from))
    - { display.updateLineNumbers = from; }
    -
    - cm.curOp.viewChanged = true;
    -
    - if (from >= display.viewTo) { // Change after
    - if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
    - { resetView(cm); }
    - } else if (to <= display.viewFrom) { // Change before
    - if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
    - resetView(cm);
    - } else {
    - display.viewFrom += lendiff;
    - display.viewTo += lendiff;
    - }
    - } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
    - resetView(cm);
    - } else if (from <= display.viewFrom) { // Top overlap
    - var cut = viewCuttingPoint(cm, to, to + lendiff, 1);
    - if (cut) {
    - display.view = display.view.slice(cut.index);
    - display.viewFrom = cut.lineN;
    - display.viewTo += lendiff;
    - } else {
    - resetView(cm);
    - }
    - } else if (to >= display.viewTo) { // Bottom overlap
    - var cut$1 = viewCuttingPoint(cm, from, from, -1);
    - if (cut$1) {
    - display.view = display.view.slice(0, cut$1.index);
    - display.viewTo = cut$1.lineN;
    - } else {
    - resetView(cm);
    - }
    - } else { // Gap in the middle
    - var cutTop = viewCuttingPoint(cm, from, from, -1);
    - var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);
    - if (cutTop && cutBot) {
    - display.view = display.view.slice(0, cutTop.index)
    - .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
    - .concat(display.view.slice(cutBot.index));
    - display.viewTo += lendiff;
    - } else {
    - resetView(cm);
    - }
    - }
    -
    - var ext = display.externalMeasured;
    - if (ext) {
    - if (to < ext.lineN)
    - { ext.lineN += lendiff; }
    - else if (from < ext.lineN + ext.size)
    - { display.externalMeasured = null; }
    - }
    - }
    -
    - // Register a change to a single line. Type must be one of "text",
    - // "gutter", "class", "widget"
    - function regLineChange(cm, line, type) {
    - cm.curOp.viewChanged = true;
    - var display = cm.display, ext = cm.display.externalMeasured;
    - if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
    - { display.externalMeasured = null; }
    -
    - if (line < display.viewFrom || line >= display.viewTo) { return }
    - var lineView = display.view[findViewIndex(cm, line)];
    - if (lineView.node == null) { return }
    - var arr = lineView.changes || (lineView.changes = []);
    - if (indexOf(arr, type) == -1) { arr.push(type); }
    - }
    -
    - // Clear the view.
    - function resetView(cm) {
    - cm.display.viewFrom = cm.display.viewTo = cm.doc.first;
    - cm.display.view = [];
    - cm.display.viewOffset = 0;
    - }
    -
    - function viewCuttingPoint(cm, oldN, newN, dir) {
    - var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
    - if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
    - { return {index: index, lineN: newN} }
    - var n = cm.display.viewFrom;
    - for (var i = 0; i < index; i++)
    - { n += view[i].size; }
    - if (n != oldN) {
    - if (dir > 0) {
    - if (index == view.length - 1) { return null }
    - diff = (n + view[index].size) - oldN;
    - index++;
    - } else {
    - diff = n - oldN;
    - }
    - oldN += diff; newN += diff;
    - }
    - while (visualLineNo(cm.doc, newN) != newN) {
    - if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
    - newN += dir * view[index - (dir < 0 ? 1 : 0)].size;
    - index += dir;
    - }
    - return {index: index, lineN: newN}
    - }
    -
    - // Force the view to cover a given range, adding empty view element
    - // or clipping off existing ones as needed.
    - function adjustView(cm, from, to) {
    - var display = cm.display, view = display.view;
    - if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
    - display.view = buildViewArray(cm, from, to);
    - display.viewFrom = from;
    - } else {
    - if (display.viewFrom > from)
    - { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }
    - else if (display.viewFrom < from)
    - { display.view = display.view.slice(findViewIndex(cm, from)); }
    - display.viewFrom = from;
    - if (display.viewTo < to)
    - { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }
    - else if (display.viewTo > to)
    - { display.view = display.view.slice(0, findViewIndex(cm, to)); }
    - }
    - display.viewTo = to;
    - }
    -
    - // Count the number of lines in the view whose DOM representation is
    - // out of date (or nonexistent).
    - function countDirtyView(cm) {
    - var view = cm.display.view, dirty = 0;
    - for (var i = 0; i < view.length; i++) {
    - var lineView = view[i];
    - if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }
    - }
    - return dirty
    - }
    -
    - function updateSelection(cm) {
    - cm.display.input.showSelection(cm.display.input.prepareSelection());
    - }
    -
    - function prepareSelection(cm, primary) {
    - if ( primary === void 0 ) primary = true;
    -
    - var doc = cm.doc, result = {};
    - var curFragment = result.cursors = document.createDocumentFragment();
    - var selFragment = result.selection = document.createDocumentFragment();
    -
    - for (var i = 0; i < doc.sel.ranges.length; i++) {
    - if (!primary && i == doc.sel.primIndex) { continue }
    - var range$$1 = doc.sel.ranges[i];
    - if (range$$1.from().line >= cm.display.viewTo || range$$1.to().line < cm.display.viewFrom) { continue }
    - var collapsed = range$$1.empty();
    - if (collapsed || cm.options.showCursorWhenSelecting)
    - { drawSelectionCursor(cm, range$$1.head, curFragment); }
    - if (!collapsed)
    - { drawSelectionRange(cm, range$$1, selFragment); }
    - }
    - return result
    - }
    -
    - // Draws a cursor for the given range
    - function drawSelectionCursor(cm, head, output) {
    - var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
    -
    - var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
    - cursor.style.left = pos.left + "px";
    - cursor.style.top = pos.top + "px";
    - cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
    -
    - if (pos.other) {
    - // Secondary cursor, shown when on a 'jump' in bi-directional text
    - var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
    - otherCursor.style.display = "";
    - otherCursor.style.left = pos.other.left + "px";
    - otherCursor.style.top = pos.other.top + "px";
    - otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
    - }
    - }
    -
    - function cmpCoords(a, b) { return a.top - b.top || a.left - b.left }
    -
    - // Draws the given range as a highlighted selection
    - function drawSelectionRange(cm, range$$1, output) {
    - var display = cm.display, doc = cm.doc;
    - var fragment = document.createDocumentFragment();
    - var padding = paddingH(cm.display), leftSide = padding.left;
    - var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;
    - var docLTR = doc.direction == "ltr";
    -
    - function add(left, top, width, bottom) {
    - if (top < 0) { top = 0; }
    - top = Math.round(top);
    - bottom = Math.round(bottom);
    - fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n height: " + (bottom - top) + "px")));
    - }
    -
    - function drawForLine(line, fromArg, toArg) {
    - var lineObj = getLine(doc, line);
    - var lineLen = lineObj.text.length;
    - var start, end;
    - function coords(ch, bias) {
    - return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
    - }
    -
    - function wrapX(pos, dir, side) {
    - var extent = wrappedLineExtentChar(cm, lineObj, null, pos);
    - var prop = (dir == "ltr") == (side == "after") ? "left" : "right";
    - var ch = side == "after" ? extent.begin : extent.end - (/\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);
    - return coords(ch, prop)[prop]
    - }
    -
    - var order = getOrder(lineObj, doc.direction);
    - iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {
    - var ltr = dir == "ltr";
    - var fromPos = coords(from, ltr ? "left" : "right");
    - var toPos = coords(to - 1, ltr ? "right" : "left");
    -
    - var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;
    - var first = i == 0, last = !order || i == order.length - 1;
    - if (toPos.top - fromPos.top <= 3) { // Single line
    - var openLeft = (docLTR ? openStart : openEnd) && first;
    - var openRight = (docLTR ? openEnd : openStart) && last;
    - var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;
    - var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;
    - add(left, fromPos.top, right - left, fromPos.bottom);
    - } else { // Multiple lines
    - var topLeft, topRight, botLeft, botRight;
    - if (ltr) {
    - topLeft = docLTR && openStart && first ? leftSide : fromPos.left;
    - topRight = docLTR ? rightSide : wrapX(from, dir, "before");
    - botLeft = docLTR ? leftSide : wrapX(to, dir, "after");
    - botRight = docLTR && openEnd && last ? rightSide : toPos.right;
    - } else {
    - topLeft = !docLTR ? leftSide : wrapX(from, dir, "before");
    - topRight = !docLTR && openStart && first ? rightSide : fromPos.right;
    - botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;
    - botRight = !docLTR ? rightSide : wrapX(to, dir, "after");
    - }
    - add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);
    - if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }
    - add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);
    - }
    -
    - if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }
    - if (cmpCoords(toPos, start) < 0) { start = toPos; }
    - if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }
    - if (cmpCoords(toPos, end) < 0) { end = toPos; }
    - });
    - return {start: start, end: end}
    - }
    -
    - var sFrom = range$$1.from(), sTo = range$$1.to();
    - if (sFrom.line == sTo.line) {
    - drawForLine(sFrom.line, sFrom.ch, sTo.ch);
    - } else {
    - var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);
    - var singleVLine = visualLine(fromLine) == visualLine(toLine);
    - var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
    - var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;
    - if (singleVLine) {
    - if (leftEnd.top < rightStart.top - 2) {
    - add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
    - add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
    - } else {
    - add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
    - }
    - }
    - if (leftEnd.bottom < rightStart.top)
    - { add(leftSide, leftEnd.bottom, null, rightStart.top); }
    - }
    -
    - output.appendChild(fragment);
    - }
    -
    - // Cursor-blinking
    - function restartBlink(cm) {
    - if (!cm.state.focused) { return }
    - var display = cm.display;
    - clearInterval(display.blinker);
    - var on = true;
    - display.cursorDiv.style.visibility = "";
    - if (cm.options.cursorBlinkRate > 0)
    - { display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; },
    - cm.options.cursorBlinkRate); }
    - else if (cm.options.cursorBlinkRate < 0)
    - { display.cursorDiv.style.visibility = "hidden"; }
    - }
    -
    - function ensureFocus(cm) {
    - if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
    - }
    -
    - function delayBlurEvent(cm) {
    - cm.state.delayingBlurEvent = true;
    - setTimeout(function () { if (cm.state.delayingBlurEvent) {
    - cm.state.delayingBlurEvent = false;
    - onBlur(cm);
    - } }, 100);
    - }
    -
    - function onFocus(cm, e) {
    - if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; }
    -
    - if (cm.options.readOnly == "nocursor") { return }
    - if (!cm.state.focused) {
    - signal(cm, "focus", cm, e);
    - cm.state.focused = true;
    - addClass(cm.display.wrapper, "CodeMirror-focused");
    - // This test prevents this from firing when a context
    - // menu is closed (since the input reset would kill the
    - // select-all detection hack)
    - if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
    - cm.display.input.reset();
    - if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730
    - }
    - cm.display.input.receivedFocus();
    - }
    - restartBlink(cm);
    - }
    - function onBlur(cm, e) {
    - if (cm.state.delayingBlurEvent) { return }
    -
    - if (cm.state.focused) {
    - signal(cm, "blur", cm, e);
    - cm.state.focused = false;
    - rmClass(cm.display.wrapper, "CodeMirror-focused");
    - }
    - clearInterval(cm.display.blinker);
    - setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);
    - }
    -
    - // Read the actual heights of the rendered lines, and update their
    - // stored heights to match.
    - function updateHeightsInViewport(cm) {
    - var display = cm.display;
    - var prevBottom = display.lineDiv.offsetTop;
    - for (var i = 0; i < display.view.length; i++) {
    - var cur = display.view[i], wrapping = cm.options.lineWrapping;
    - var height = (void 0), width = 0;
    - if (cur.hidden) { continue }
    - if (ie && ie_version < 8) {
    - var bot = cur.node.offsetTop + cur.node.offsetHeight;
    - height = bot - prevBottom;
    - prevBottom = bot;
    - } else {
    - var box = cur.node.getBoundingClientRect();
    - height = box.bottom - box.top;
    - // Check that lines don't extend past the right of the current
    - // editor width
    - if (!wrapping && cur.text.firstChild)
    - { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }
    - }
    - var diff = cur.line.height - height;
    - if (diff > .005 || diff < -.005) {
    - updateLineHeight(cur.line, height);
    - updateWidgetHeight(cur.line);
    - if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
    - { updateWidgetHeight(cur.rest[j]); } }
    - }
    - if (width > cm.display.sizerWidth) {
    - var chWidth = Math.ceil(width / charWidth(cm.display));
    - if (chWidth > cm.display.maxLineLength) {
    - cm.display.maxLineLength = chWidth;
    - cm.display.maxLine = cur.line;
    - cm.display.maxLineChanged = true;
    - }
    - }
    - }
    - }
    -
    - // Read and store the height of line widgets associated with the
    - // given line.
    - function updateWidgetHeight(line) {
    - if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {
    - var w = line.widgets[i], parent = w.node.parentNode;
    - if (parent) { w.height = parent.offsetHeight; }
    - } }
    - }
    -
    - // Compute the lines that are visible in a given viewport (defaults
    - // the the current scroll position). viewport may contain top,
    - // height, and ensure (see op.scrollToPos) properties.
    - function visibleLines(display, doc, viewport) {
    - var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;
    - top = Math.floor(top - paddingTop(display));
    - var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;
    -
    - var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
    - // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
    - // forces those lines into the viewport (if possible).
    - if (viewport && viewport.ensure) {
    - var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;
    - if (ensureFrom < from) {
    - from = ensureFrom;
    - to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);
    - } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
    - from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);
    - to = ensureTo;
    - }
    - }
    - return {from: from, to: Math.max(to, from + 1)}
    - }
    -
    - // SCROLLING THINGS INTO VIEW
    -
    - // If an editor sits on the top or bottom of the window, partially
    - // scrolled out of view, this ensures that the cursor is visible.
    - function maybeScrollWindow(cm, rect) {
    - if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
    -
    - var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
    - if (rect.top + box.top < 0) { doScroll = true; }
    - else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }
    - if (doScroll != null && !phantom) {
    - var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"));
    - cm.display.lineSpace.appendChild(scrollNode);
    - scrollNode.scrollIntoView(doScroll);
    - cm.display.lineSpace.removeChild(scrollNode);
    - }
    - }
    -
    - // Scroll a given position into view (immediately), verifying that
    - // it actually became visible (as line heights are accurately
    - // measured, the position of something may 'drift' during drawing).
    - function scrollPosIntoView(cm, pos, end, margin) {
    - if (margin == null) { margin = 0; }
    - var rect;
    - if (!cm.options.lineWrapping && pos == end) {
    - // Set pos and end to the cursor positions around the character pos sticks to
    - // If pos.sticky == "before", that is around pos.ch - 1, otherwise around pos.ch
    - // If pos == Pos(_, 0, "before"), pos and end are unchanged
    - pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos;
    - end = pos.sticky == "before" ? Pos(pos.line, pos.ch + 1, "before") : pos;
    - }
    - for (var limit = 0; limit < 5; limit++) {
    - var changed = false;
    - var coords = cursorCoords(cm, pos);
    - var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
    - rect = {left: Math.min(coords.left, endCoords.left),
    - top: Math.min(coords.top, endCoords.top) - margin,
    - right: Math.max(coords.left, endCoords.left),
    - bottom: Math.max(coords.bottom, endCoords.bottom) + margin};
    - var scrollPos = calculateScrollPos(cm, rect);
    - var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
    - if (scrollPos.scrollTop != null) {
    - updateScrollTop(cm, scrollPos.scrollTop);
    - if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }
    - }
    - if (scrollPos.scrollLeft != null) {
    - setScrollLeft(cm, scrollPos.scrollLeft);
    - if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }
    - }
    - if (!changed) { break }
    - }
    - return rect
    - }
    -
    - // Scroll a given set of coordinates into view (immediately).
    - function scrollIntoView(cm, rect) {
    - var scrollPos = calculateScrollPos(cm, rect);
    - if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }
    - if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }
    - }
    -
    - // Calculate a new scroll position needed to scroll the given
    - // rectangle into view. Returns an object with scrollTop and
    - // scrollLeft properties. When these are undefined, the
    - // vertical/horizontal position does not need to be adjusted.
    - function calculateScrollPos(cm, rect) {
    - var display = cm.display, snapMargin = textHeight(cm.display);
    - if (rect.top < 0) { rect.top = 0; }
    - var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;
    - var screen = displayHeight(cm), result = {};
    - if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }
    - var docBottom = cm.doc.height + paddingVert(display);
    - var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;
    - if (rect.top < screentop) {
    - result.scrollTop = atTop ? 0 : rect.top;
    - } else if (rect.bottom > screentop + screen) {
    - var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);
    - if (newTop != screentop) { result.scrollTop = newTop; }
    - }
    -
    - var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;
    - var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);
    - var tooWide = rect.right - rect.left > screenw;
    - if (tooWide) { rect.right = rect.left + screenw; }
    - if (rect.left < 10)
    - { result.scrollLeft = 0; }
    - else if (rect.left < screenleft)
    - { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }
    - else if (rect.right > screenw + screenleft - 3)
    - { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }
    - return result
    - }
    -
    - // Store a relative adjustment to the scroll position in the current
    - // operation (to be applied when the operation finishes).
    - function addToScrollTop(cm, top) {
    - if (top == null) { return }
    - resolveScrollToPos(cm);
    - cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;
    - }
    -
    - // Make sure that at the end of the operation the current cursor is
    - // shown.
    - function ensureCursorVisible(cm) {
    - resolveScrollToPos(cm);
    - var cur = cm.getCursor();
    - cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};
    - }
    -
    - function scrollToCoords(cm, x, y) {
    - if (x != null || y != null) { resolveScrollToPos(cm); }
    - if (x != null) { cm.curOp.scrollLeft = x; }
    - if (y != null) { cm.curOp.scrollTop = y; }
    - }
    -
    - function scrollToRange(cm, range$$1) {
    - resolveScrollToPos(cm);
    - cm.curOp.scrollToPos = range$$1;
    - }
    -
    - // When an operation has its scrollToPos property set, and another
    - // scroll action is applied before the end of the operation, this
    - // 'simulates' scrolling that position into view in a cheap way, so
    - // that the effect of intermediate scroll commands is not ignored.
    - function resolveScrollToPos(cm) {
    - var range$$1 = cm.curOp.scrollToPos;
    - if (range$$1) {
    - cm.curOp.scrollToPos = null;
    - var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);
    - scrollToCoordsRange(cm, from, to, range$$1.margin);
    - }
    - }
    -
    - function scrollToCoordsRange(cm, from, to, margin) {
    - var sPos = calculateScrollPos(cm, {
    - left: Math.min(from.left, to.left),
    - top: Math.min(from.top, to.top) - margin,
    - right: Math.max(from.right, to.right),
    - bottom: Math.max(from.bottom, to.bottom) + margin
    - });
    - scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop);
    - }
    -
    - // Sync the scrollable area and scrollbars, ensure the viewport
    - // covers the visible area.
    - function updateScrollTop(cm, val) {
    - if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
    - if (!gecko) { updateDisplaySimple(cm, {top: val}); }
    - setScrollTop(cm, val, true);
    - if (gecko) { updateDisplaySimple(cm); }
    - startWorker(cm, 100);
    - }
    -
    - function setScrollTop(cm, val, forceScroll) {
    - val = Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val);
    - if (cm.display.scroller.scrollTop == val && !forceScroll) { return }
    - cm.doc.scrollTop = val;
    - cm.display.scrollbars.setScrollTop(val);
    - if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }
    - }
    -
    - // Sync scroller and scrollbar, ensure the gutter elements are
    - // aligned.
    - function setScrollLeft(cm, val, isScroller, forceScroll) {
    - val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);
    - if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return }
    - cm.doc.scrollLeft = val;
    - alignHorizontally(cm);
    - if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }
    - cm.display.scrollbars.setScrollLeft(val);
    - }
    -
    - // SCROLLBARS
    -
    - // Prepare DOM reads needed to update the scrollbars. Done in one
    - // shot to minimize update/measure roundtrips.
    - function measureForScrollbars(cm) {
    - var d = cm.display, gutterW = d.gutters.offsetWidth;
    - var docH = Math.round(cm.doc.height + paddingVert(cm.display));
    - return {
    - clientHeight: d.scroller.clientHeight,
    - viewHeight: d.wrapper.clientHeight,
    - scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
    - viewWidth: d.wrapper.clientWidth,
    - barLeft: cm.options.fixedGutter ? gutterW : 0,
    - docHeight: docH,
    - scrollHeight: docH + scrollGap(cm) + d.barHeight,
    - nativeBarWidth: d.nativeBarWidth,
    - gutterWidth: gutterW
    - }
    - }
    -
    - var NativeScrollbars = function(place, scroll, cm) {
    - this.cm = cm;
    - var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar");
    - var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar");
    - vert.tabIndex = horiz.tabIndex = -1;
    - place(vert); place(horiz);
    -
    - on(vert, "scroll", function () {
    - if (vert.clientHeight) { scroll(vert.scrollTop, "vertical"); }
    - });
    - on(horiz, "scroll", function () {
    - if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal"); }
    - });
    -
    - this.checkedZeroWidth = false;
    - // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
    - if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; }
    - };
    -
    - NativeScrollbars.prototype.update = function (measure) {
    - var needsH = measure.scrollWidth > measure.clientWidth + 1;
    - var needsV = measure.scrollHeight > measure.clientHeight + 1;
    - var sWidth = measure.nativeBarWidth;
    -
    - if (needsV) {
    - this.vert.style.display = "block";
    - this.vert.style.bottom = needsH ? sWidth + "px" : "0";
    - var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);
    - // A bug in IE8 can cause this value to be negative, so guard it.
    - this.vert.firstChild.style.height =
    - Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
    - } else {
    - this.vert.style.display = "";
    - this.vert.firstChild.style.height = "0";
    - }
    -
    - if (needsH) {
    - this.horiz.style.display = "block";
    - this.horiz.style.right = needsV ? sWidth + "px" : "0";
    - this.horiz.style.left = measure.barLeft + "px";
    - var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);
    - this.horiz.firstChild.style.width =
    - Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px";
    - } else {
    - this.horiz.style.display = "";
    - this.horiz.firstChild.style.width = "0";
    - }
    -
    - if (!this.checkedZeroWidth && measure.clientHeight > 0) {
    - if (sWidth == 0) { this.zeroWidthHack(); }
    - this.checkedZeroWidth = true;
    - }
    -
    - return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
    - };
    -
    - NativeScrollbars.prototype.setScrollLeft = function (pos) {
    - if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }
    - if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, "horiz"); }
    - };
    -
    - NativeScrollbars.prototype.setScrollTop = function (pos) {
    - if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }
    - if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, "vert"); }
    - };
    -
    - NativeScrollbars.prototype.zeroWidthHack = function () {
    - var w = mac && !mac_geMountainLion ? "12px" : "18px";
    - this.horiz.style.height = this.vert.style.width = w;
    - this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
    - this.disableHoriz = new Delayed;
    - this.disableVert = new Delayed;
    - };
    -
    - NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {
    - bar.style.pointerEvents = "auto";
    - function maybeDisable() {
    - // To find out whether the scrollbar is still visible, we
    - // check whether the element under the pixel in the bottom
    - // right corner of the scrollbar box is the scrollbar box
    - // itself (when the bar is still visible) or its filler child
    - // (when the bar is hidden). If it is still visible, we keep
    - // it enabled, if it's hidden, we disable pointer events.
    - var box = bar.getBoundingClientRect();
    - var elt$$1 = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
    - : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);
    - if (elt$$1 != bar) { bar.style.pointerEvents = "none"; }
    - else { delay.set(1000, maybeDisable); }
    - }
    - delay.set(1000, maybeDisable);
    - };
    -
    - NativeScrollbars.prototype.clear = function () {
    - var parent = this.horiz.parentNode;
    - parent.removeChild(this.horiz);
    - parent.removeChild(this.vert);
    - };
    -
    - var NullScrollbars = function () {};
    -
    - NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
    - NullScrollbars.prototype.setScrollLeft = function () {};
    - NullScrollbars.prototype.setScrollTop = function () {};
    - NullScrollbars.prototype.clear = function () {};
    -
    - function updateScrollbars(cm, measure) {
    - if (!measure) { measure = measureForScrollbars(cm); }
    - var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;
    - updateScrollbarsInner(cm, measure);
    - for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
    - if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
    - { updateHeightsInViewport(cm); }
    - updateScrollbarsInner(cm, measureForScrollbars(cm));
    - startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;
    - }
    - }
    -
    - // Re-synchronize the fake scrollbars with the actual size of the
    - // content.
    - function updateScrollbarsInner(cm, measure) {
    - var d = cm.display;
    - var sizes = d.scrollbars.update(measure);
    -
    - d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
    - d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
    - d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent";
    -
    - if (sizes.right && sizes.bottom) {
    - d.scrollbarFiller.style.display = "block";
    - d.scrollbarFiller.style.height = sizes.bottom + "px";
    - d.scrollbarFiller.style.width = sizes.right + "px";
    - } else { d.scrollbarFiller.style.display = ""; }
    - if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
    - d.gutterFiller.style.display = "block";
    - d.gutterFiller.style.height = sizes.bottom + "px";
    - d.gutterFiller.style.width = measure.gutterWidth + "px";
    - } else { d.gutterFiller.style.display = ""; }
    - }
    -
    - var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};
    -
    - function initScrollbars(cm) {
    - if (cm.display.scrollbars) {
    - cm.display.scrollbars.clear();
    - if (cm.display.scrollbars.addClass)
    - { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
    - }
    -
    - cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
    - cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
    - // Prevent clicks in the scrollbars from killing focus
    - on(node, "mousedown", function () {
    - if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }
    - });
    - node.setAttribute("cm-not-content", "true");
    - }, function (pos, axis) {
    - if (axis == "horizontal") { setScrollLeft(cm, pos); }
    - else { updateScrollTop(cm, pos); }
    - }, cm);
    - if (cm.display.scrollbars.addClass)
    - { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
    - }
    -
    - // Operations are used to wrap a series of changes to the editor
    - // state in such a way that each change won't have to update the
    - // cursor and display (which would be awkward, slow, and
    - // error-prone). Instead, display updates are batched and then all
    - // combined and executed at once.
    -
    - var nextOpId = 0;
    - // Start a new operation.
    - function startOperation(cm) {
    - cm.curOp = {
    - cm: cm,
    - viewChanged: false, // Flag that indicates that lines might need to be redrawn
    - startHeight: cm.doc.height, // Used to detect need to update scrollbar
    - forceUpdate: false, // Used to force a redraw
    - updateInput: 0, // Whether to reset the input textarea
    - typing: false, // Whether this reset should be careful to leave existing text (for compositing)
    - changeObjs: null, // Accumulated changes, for firing change events
    - cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
    - cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
    - selectionChanged: false, // Whether the selection needs to be redrawn
    - updateMaxLine: false, // Set when the widest line needs to be determined anew
    - scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
    - scrollToPos: null, // Used to scroll to a specific position
    - focus: false,
    - id: ++nextOpId // Unique ID
    - };
    - pushOperation(cm.curOp);
    - }
    -
    - // Finish an operation, updating the display and signalling delayed events
    - function endOperation(cm) {
    - var op = cm.curOp;
    - if (op) { finishOperation(op, function (group) {
    - for (var i = 0; i < group.ops.length; i++)
    - { group.ops[i].cm.curOp = null; }
    - endOperations(group);
    - }); }
    - }
    -
    - // The DOM updates done when an operation finishes are batched so
    - // that the minimum number of relayouts are required.
    - function endOperations(group) {
    - var ops = group.ops;
    - for (var i = 0; i < ops.length; i++) // Read DOM
    - { endOperation_R1(ops[i]); }
    - for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
    - { endOperation_W1(ops[i$1]); }
    - for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
    - { endOperation_R2(ops[i$2]); }
    - for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
    - { endOperation_W2(ops[i$3]); }
    - for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
    - { endOperation_finish(ops[i$4]); }
    - }
    -
    - function endOperation_R1(op) {
    - var cm = op.cm, display = cm.display;
    - maybeClipScrollbars(cm);
    - if (op.updateMaxLine) { findMaxLine(cm); }
    -
    - op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
    - op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
    - op.scrollToPos.to.line >= display.viewTo) ||
    - display.maxLineChanged && cm.options.lineWrapping;
    - op.update = op.mustUpdate &&
    - new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);
    - }
    -
    - function endOperation_W1(op) {
    - op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);
    - }
    -
    - function endOperation_R2(op) {
    - var cm = op.cm, display = cm.display;
    - if (op.updatedDisplay) { updateHeightsInViewport(cm); }
    -
    - op.barMeasure = measureForScrollbars(cm);
    -
    - // If the max line changed since it was last measured, measure it,
    - // and ensure the document's width matches it.
    - // updateDisplay_W2 will use these properties to do the actual resizing
    - if (display.maxLineChanged && !cm.options.lineWrapping) {
    - op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;
    - cm.display.sizerWidth = op.adjustWidthTo;
    - op.barMeasure.scrollWidth =
    - Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);
    - op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));
    - }
    -
    - if (op.updatedDisplay || op.selectionChanged)
    - { op.preparedSelection = display.input.prepareSelection(); }
    - }
    -
    - function endOperation_W2(op) {
    - var cm = op.cm;
    -
    - if (op.adjustWidthTo != null) {
    - cm.display.sizer.style.minWidth = op.adjustWidthTo + "px";
    - if (op.maxScrollLeft < cm.doc.scrollLeft)
    - { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }
    - cm.display.maxLineChanged = false;
    - }
    -
    - var takeFocus = op.focus && op.focus == activeElt();
    - if (op.preparedSelection)
    - { cm.display.input.showSelection(op.preparedSelection, takeFocus); }
    - if (op.updatedDisplay || op.startHeight != cm.doc.height)
    - { updateScrollbars(cm, op.barMeasure); }
    - if (op.updatedDisplay)
    - { setDocumentHeight(cm, op.barMeasure); }
    -
    - if (op.selectionChanged) { restartBlink(cm); }
    -
    - if (cm.state.focused && op.updateInput)
    - { cm.display.input.reset(op.typing); }
    - if (takeFocus) { ensureFocus(op.cm); }
    - }
    -
    - function endOperation_finish(op) {
    - var cm = op.cm, display = cm.display, doc = cm.doc;
    -
    - if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }
    -
    - // Abort mouse wheel delta measurement, when scrolling explicitly
    - if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
    - { display.wheelStartX = display.wheelStartY = null; }
    -
    - // Propagate the scroll position to the actual DOM scroller
    - if (op.scrollTop != null) { setScrollTop(cm, op.scrollTop, op.forceScroll); }
    -
    - if (op.scrollLeft != null) { setScrollLeft(cm, op.scrollLeft, true, true); }
    - // If we need to scroll a specific position into view, do so.
    - if (op.scrollToPos) {
    - var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
    - clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);
    - maybeScrollWindow(cm, rect);
    - }
    -
    - // Fire events for markers that are hidden/unidden by editing or
    - // undoing
    - var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
    - if (hidden) { for (var i = 0; i < hidden.length; ++i)
    - { if (!hidden[i].lines.length) { signal(hidden[i], "hide"); } } }
    - if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
    - { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide"); } } }
    -
    - if (display.wrapper.offsetHeight)
    - { doc.scrollTop = cm.display.scroller.scrollTop; }
    -
    - // Fire change events, and delayed event handlers
    - if (op.changeObjs)
    - { signal(cm, "changes", cm, op.changeObjs); }
    - if (op.update)
    - { op.update.finish(); }
    - }
    -
    - // Run the given function in an operation
    - function runInOp(cm, f) {
    - if (cm.curOp) { return f() }
    - startOperation(cm);
    - try { return f() }
    - finally { endOperation(cm); }
    - }
    - // Wraps a function in an operation. Returns the wrapped function.
    - function operation(cm, f) {
    - return function() {
    - if (cm.curOp) { return f.apply(cm, arguments) }
    - startOperation(cm);
    - try { return f.apply(cm, arguments) }
    - finally { endOperation(cm); }
    - }
    - }
    - // Used to add methods to editor and doc instances, wrapping them in
    - // operations.
    - function methodOp(f) {
    - return function() {
    - if (this.curOp) { return f.apply(this, arguments) }
    - startOperation(this);
    - try { return f.apply(this, arguments) }
    - finally { endOperation(this); }
    - }
    - }
    - function docMethodOp(f) {
    - return function() {
    - var cm = this.cm;
    - if (!cm || cm.curOp) { return f.apply(this, arguments) }
    - startOperation(cm);
    - try { return f.apply(this, arguments) }
    - finally { endOperation(cm); }
    - }
    - }
    -
    - // HIGHLIGHT WORKER
    -
    - function startWorker(cm, time) {
    - if (cm.doc.highlightFrontier < cm.display.viewTo)
    - { cm.state.highlight.set(time, bind(highlightWorker, cm)); }
    - }
    -
    - function highlightWorker(cm) {
    - var doc = cm.doc;
    - if (doc.highlightFrontier >= cm.display.viewTo) { return }
    - var end = +new Date + cm.options.workTime;
    - var context = getContextBefore(cm, doc.highlightFrontier);
    - var changedLines = [];
    -
    - doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
    - if (context.line >= cm.display.viewFrom) { // Visible
    - var oldStyles = line.styles;
    - var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null;
    - var highlighted = highlightLine(cm, line, context, true);
    - if (resetState) { context.state = resetState; }
    - line.styles = highlighted.styles;
    - var oldCls = line.styleClasses, newCls = highlighted.classes;
    - if (newCls) { line.styleClasses = newCls; }
    - else if (oldCls) { line.styleClasses = null; }
    - var ischange = !oldStyles || oldStyles.length != line.styles.length ||
    - oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
    - for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }
    - if (ischange) { changedLines.push(context.line); }
    - line.stateAfter = context.save();
    - context.nextLine();
    - } else {
    - if (line.text.length <= cm.options.maxHighlightLength)
    - { processLine(cm, line.text, context); }
    - line.stateAfter = context.line % 5 == 0 ? context.save() : null;
    - context.nextLine();
    - }
    - if (+new Date > end) {
    - startWorker(cm, cm.options.workDelay);
    - return true
    - }
    - });
    - doc.highlightFrontier = context.line;
    - doc.modeFrontier = Math.max(doc.modeFrontier, context.line);
    - if (changedLines.length) { runInOp(cm, function () {
    - for (var i = 0; i < changedLines.length; i++)
    - { regLineChange(cm, changedLines[i], "text"); }
    - }); }
    - }
    -
    - // DISPLAY DRAWING
    -
    - var DisplayUpdate = function(cm, viewport, force) {
    - var display = cm.display;
    -
    - this.viewport = viewport;
    - // Store some values that we'll need later (but don't want to force a relayout for)
    - this.visible = visibleLines(display, cm.doc, viewport);
    - this.editorIsHidden = !display.wrapper.offsetWidth;
    - this.wrapperHeight = display.wrapper.clientHeight;
    - this.wrapperWidth = display.wrapper.clientWidth;
    - this.oldDisplayWidth = displayWidth(cm);
    - this.force = force;
    - this.dims = getDimensions(cm);
    - this.events = [];
    - };
    -
    - DisplayUpdate.prototype.signal = function (emitter, type) {
    - if (hasHandler(emitter, type))
    - { this.events.push(arguments); }
    - };
    - DisplayUpdate.prototype.finish = function () {
    - var this$1 = this;
    -
    - for (var i = 0; i < this.events.length; i++)
    - { signal.apply(null, this$1.events[i]); }
    - };
    -
    - function maybeClipScrollbars(cm) {
    - var display = cm.display;
    - if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
    - display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;
    - display.heightForcer.style.height = scrollGap(cm) + "px";
    - display.sizer.style.marginBottom = -display.nativeBarWidth + "px";
    - display.sizer.style.borderRightWidth = scrollGap(cm) + "px";
    - display.scrollbarsClipped = true;
    - }
    - }
    -
    - function selectionSnapshot(cm) {
    - if (cm.hasFocus()) { return null }
    - var active = activeElt();
    - if (!active || !contains(cm.display.lineDiv, active)) { return null }
    - var result = {activeElt: active};
    - if (window.getSelection) {
    - var sel = window.getSelection();
    - if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {
    - result.anchorNode = sel.anchorNode;
    - result.anchorOffset = sel.anchorOffset;
    - result.focusNode = sel.focusNode;
    - result.focusOffset = sel.focusOffset;
    - }
    - }
    - return result
    - }
    -
    - function restoreSelection(snapshot) {
    - if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }
    - snapshot.activeElt.focus();
    - if (snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
    - var sel = window.getSelection(), range$$1 = document.createRange();
    - range$$1.setEnd(snapshot.anchorNode, snapshot.anchorOffset);
    - range$$1.collapse(false);
    - sel.removeAllRanges();
    - sel.addRange(range$$1);
    - sel.extend(snapshot.focusNode, snapshot.focusOffset);
    - }
    - }
    -
    - // Does the actual updating of the line display. Bails out
    - // (returning false) when there is nothing to be done and forced is
    - // false.
    - function updateDisplayIfNeeded(cm, update) {
    - var display = cm.display, doc = cm.doc;
    -
    - if (update.editorIsHidden) {
    - resetView(cm);
    - return false
    - }
    -
    - // Bail out if the visible area is already rendered and nothing changed.
    - if (!update.force &&
    - update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
    - (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
    - display.renderedView == display.view && countDirtyView(cm) == 0)
    - { return false }
    -
    - if (maybeUpdateLineNumberWidth(cm)) {
    - resetView(cm);
    - update.dims = getDimensions(cm);
    - }
    -
    - // Compute a suitable new viewport (from & to)
    - var end = doc.first + doc.size;
    - var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);
    - var to = Math.min(end, update.visible.to + cm.options.viewportMargin);
    - if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }
    - if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }
    - if (sawCollapsedSpans) {
    - from = visualLineNo(cm.doc, from);
    - to = visualLineEndNo(cm.doc, to);
    - }
    -
    - var different = from != display.viewFrom || to != display.viewTo ||
    - display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;
    - adjustView(cm, from, to);
    -
    - display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));
    - // Position the mover div to align with the current scroll position
    - cm.display.mover.style.top = display.viewOffset + "px";
    -
    - var toUpdate = countDirtyView(cm);
    - if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
    - (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
    - { return false }
    -
    - // For big changes, we hide the enclosing element during the
    - // update, since that speeds up the operations on most browsers.
    - var selSnapshot = selectionSnapshot(cm);
    - if (toUpdate > 4) { display.lineDiv.style.display = "none"; }
    - patchDisplay(cm, display.updateLineNumbers, update.dims);
    - if (toUpdate > 4) { display.lineDiv.style.display = ""; }
    - display.renderedView = display.view;
    - // There might have been a widget with a focused element that got
    - // hidden or updated, if so re-focus it.
    - restoreSelection(selSnapshot);
    -
    - // Prevent selection and cursors from interfering with the scroll
    - // width and height.
    - removeChildren(display.cursorDiv);
    - removeChildren(display.selectionDiv);
    - display.gutters.style.height = display.sizer.style.minHeight = 0;
    -
    - if (different) {
    - display.lastWrapHeight = update.wrapperHeight;
    - display.lastWrapWidth = update.wrapperWidth;
    - startWorker(cm, 400);
    - }
    -
    - display.updateLineNumbers = null;
    -
    - return true
    - }
    -
    - function postUpdateDisplay(cm, update) {
    - var viewport = update.viewport;
    -
    - for (var first = true;; first = false) {
    - if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
    - // Clip forced viewport to actual scrollable area.
    - if (viewport && viewport.top != null)
    - { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }
    - // Updated line heights might result in the drawn area not
    - // actually covering the viewport. Keep looping until it does.
    - update.visible = visibleLines(cm.display, cm.doc, viewport);
    - if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
    - { break }
    - }
    - if (!updateDisplayIfNeeded(cm, update)) { break }
    - updateHeightsInViewport(cm);
    - var barMeasure = measureForScrollbars(cm);
    - updateSelection(cm);
    - updateScrollbars(cm, barMeasure);
    - setDocumentHeight(cm, barMeasure);
    - update.force = false;
    - }
    -
    - update.signal(cm, "update", cm);
    - if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
    - update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo);
    - cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;
    - }
    - }
    -
    - function updateDisplaySimple(cm, viewport) {
    - var update = new DisplayUpdate(cm, viewport);
    - if (updateDisplayIfNeeded(cm, update)) {
    - updateHeightsInViewport(cm);
    - postUpdateDisplay(cm, update);
    - var barMeasure = measureForScrollbars(cm);
    - updateSelection(cm);
    - updateScrollbars(cm, barMeasure);
    - setDocumentHeight(cm, barMeasure);
    - update.finish();
    - }
    - }
    -
    - // Sync the actual display DOM structure with display.view, removing
    - // nodes for lines that are no longer in view, and creating the ones
    - // that are not there yet, and updating the ones that are out of
    - // date.
    - function patchDisplay(cm, updateNumbersFrom, dims) {
    - var display = cm.display, lineNumbers = cm.options.lineNumbers;
    - var container = display.lineDiv, cur = container.firstChild;
    -
    - function rm(node) {
    - var next = node.nextSibling;
    - // Works around a throw-scroll bug in OS X Webkit
    - if (webkit && mac && cm.display.currentWheelTarget == node)
    - { node.style.display = "none"; }
    - else
    - { node.parentNode.removeChild(node); }
    - return next
    - }
    -
    - var view = display.view, lineN = display.viewFrom;
    - // Loop over the elements in the view, syncing cur (the DOM nodes
    - // in display.lineDiv) with the view as we go.
    - for (var i = 0; i < view.length; i++) {
    - var lineView = view[i];
    - if (lineView.hidden) ; else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
    - var node = buildLineElement(cm, lineView, lineN, dims);
    - container.insertBefore(node, cur);
    - } else { // Already drawn
    - while (cur != lineView.node) { cur = rm(cur); }
    - var updateNumber = lineNumbers && updateNumbersFrom != null &&
    - updateNumbersFrom <= lineN && lineView.lineNumber;
    - if (lineView.changes) {
    - if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; }
    - updateLineForChanges(cm, lineView, lineN, dims);
    - }
    - if (updateNumber) {
    - removeChildren(lineView.lineNumber);
    - lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));
    - }
    - cur = lineView.node.nextSibling;
    - }
    - lineN += lineView.size;
    - }
    - while (cur) { cur = rm(cur); }
    - }
    -
    - function updateGutterSpace(display) {
    - var width = display.gutters.offsetWidth;
    - display.sizer.style.marginLeft = width + "px";
    - }
    -
    - function setDocumentHeight(cm, measure) {
    - cm.display.sizer.style.minHeight = measure.docHeight + "px";
    - cm.display.heightForcer.style.top = measure.docHeight + "px";
    - cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px";
    - }
    -
    - // Re-align line numbers and gutter marks to compensate for
    - // horizontal scrolling.
    - function alignHorizontally(cm) {
    - var display = cm.display, view = display.view;
    - if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
    - var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
    - var gutterW = display.gutters.offsetWidth, left = comp + "px";
    - for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
    - if (cm.options.fixedGutter) {
    - if (view[i].gutter)
    - { view[i].gutter.style.left = left; }
    - if (view[i].gutterBackground)
    - { view[i].gutterBackground.style.left = left; }
    - }
    - var align = view[i].alignable;
    - if (align) { for (var j = 0; j < align.length; j++)
    - { align[j].style.left = left; } }
    - } }
    - if (cm.options.fixedGutter)
    - { display.gutters.style.left = (comp + gutterW) + "px"; }
    - }
    -
    - // Used to ensure that the line number gutter is still the right
    - // size for the current document size. Returns true when an update
    - // is needed.
    - function maybeUpdateLineNumberWidth(cm) {
    - if (!cm.options.lineNumbers) { return false }
    - var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
    - if (last.length != display.lineNumChars) {
    - var test = display.measure.appendChild(elt("div", [elt("div", last)],
    - "CodeMirror-linenumber CodeMirror-gutter-elt"));
    - var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
    - display.lineGutter.style.width = "";
    - display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;
    - display.lineNumWidth = display.lineNumInnerWidth + padding;
    - display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
    - display.lineGutter.style.width = display.lineNumWidth + "px";
    - updateGutterSpace(cm.display);
    - return true
    - }
    - return false
    - }
    -
    - function getGutters(gutters, lineNumbers) {
    - var result = [], sawLineNumbers = false;
    - for (var i = 0; i < gutters.length; i++) {
    - var name = gutters[i], style = null;
    - if (typeof name != "string") { style = name.style; name = name.className; }
    - if (name == "CodeMirror-linenumbers") {
    - if (!lineNumbers) { continue }
    - else { sawLineNumbers = true; }
    - }
    - result.push({className: name, style: style});
    - }
    - if (lineNumbers && !sawLineNumbers) { result.push({className: "CodeMirror-linenumbers", style: null}); }
    - return result
    - }
    -
    - // Rebuild the gutter elements, ensure the margin to the left of the
    - // code matches their width.
    - function renderGutters(display) {
    - var gutters = display.gutters, specs = display.gutterSpecs;
    - removeChildren(gutters);
    - display.lineGutter = null;
    - for (var i = 0; i < specs.length; ++i) {
    - var ref = specs[i];
    - var className = ref.className;
    - var style = ref.style;
    - var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + className));
    - if (style) { gElt.style.cssText = style; }
    - if (className == "CodeMirror-linenumbers") {
    - display.lineGutter = gElt;
    - gElt.style.width = (display.lineNumWidth || 1) + "px";
    - }
    - }
    - gutters.style.display = specs.length ? "" : "none";
    - updateGutterSpace(display);
    - }
    -
    - function updateGutters(cm) {
    - renderGutters(cm.display);
    - regChange(cm);
    - alignHorizontally(cm);
    - }
    -
    - // The display handles the DOM integration, both for input reading
    - // and content drawing. It holds references to DOM nodes and
    - // display-related state.
    -
    - function Display(place, doc, input, options) {
    - var d = this;
    - this.input = input;
    -
    - // Covers bottom-right square when both scrollbars are present.
    - d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
    - d.scrollbarFiller.setAttribute("cm-not-content", "true");
    - // Covers bottom of gutter when coverGutterNextToScrollbar is on
    - // and h scrollbar is present.
    - d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
    - d.gutterFiller.setAttribute("cm-not-content", "true");
    - // Will contain the actual code, positioned to cover the viewport.
    - d.lineDiv = eltP("div", null, "CodeMirror-code");
    - // Elements are added to these to represent selection and cursors.
    - d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
    - d.cursorDiv = elt("div", null, "CodeMirror-cursors");
    - // A visibility: hidden element used to find the size of things.
    - d.measure = elt("div", null, "CodeMirror-measure");
    - // When lines outside of the viewport are measured, they are drawn in this.
    - d.lineMeasure = elt("div", null, "CodeMirror-measure");
    - // Wraps everything that needs to exist inside the vertically-padded coordinate system
    - d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
    - null, "position: relative; outline: none");
    - var lines = eltP("div", [d.lineSpace], "CodeMirror-lines");
    - // Moved around its parent to cover visible view.
    - d.mover = elt("div", [lines], null, "position: relative");
    - // Set to the height of the document, allowing scrolling.
    - d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
    - d.sizerWidth = null;
    - // Behavior of elts with overflow: auto and padding is
    - // inconsistent across browsers. This is used to ensure the
    - // scrollable area is big enough.
    - d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
    - // Will contain the gutters, if any.
    - d.gutters = elt("div", null, "CodeMirror-gutters");
    - d.lineGutter = null;
    - // Actual scrollable element.
    - d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
    - d.scroller.setAttribute("tabIndex", "-1");
    - // The element in which the editor lives.
    - d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
    -
    - // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
    - if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
    - if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }
    -
    - if (place) {
    - if (place.appendChild) { place.appendChild(d.wrapper); }
    - else { place(d.wrapper); }
    - }
    -
    - // Current rendered range (may be bigger than the view window).
    - d.viewFrom = d.viewTo = doc.first;
    - d.reportedViewFrom = d.reportedViewTo = doc.first;
    - // Information about the rendered lines.
    - d.view = [];
    - d.renderedView = null;
    - // Holds info about a single rendered line when it was rendered
    - // for measurement, while not in view.
    - d.externalMeasured = null;
    - // Empty space (in pixels) above the view
    - d.viewOffset = 0;
    - d.lastWrapHeight = d.lastWrapWidth = 0;
    - d.updateLineNumbers = null;
    -
    - d.nativeBarWidth = d.barHeight = d.barWidth = 0;
    - d.scrollbarsClipped = false;
    -
    - // Used to only resize the line number gutter when necessary (when
    - // the amount of lines crosses a boundary that makes its width change)
    - d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
    - // Set to true when a non-horizontal-scrolling line widget is
    - // added. As an optimization, line widget aligning is skipped when
    - // this is false.
    - d.alignWidgets = false;
    -
    - d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
    -
    - // Tracks the maximum line length so that the horizontal scrollbar
    - // can be kept static when scrolling.
    - d.maxLine = null;
    - d.maxLineLength = 0;
    - d.maxLineChanged = false;
    -
    - // Used for measuring wheel scrolling granularity
    - d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
    -
    - // True when shift is held down.
    - d.shift = false;
    -
    - // Used to track whether anything happened since the context menu
    - // was opened.
    - d.selForContextMenu = null;
    -
    - d.activeTouch = null;
    -
    - d.gutterSpecs = getGutters(options.gutters, options.lineNumbers);
    - renderGutters(d);
    -
    - input.init(d);
    - }
    -
    - // Since the delta values reported on mouse wheel events are
    - // unstandardized between browsers and even browser versions, and
    - // generally horribly unpredictable, this code starts by measuring
    - // the scroll effect that the first few mouse wheel events have,
    - // and, from that, detects the way it can convert deltas to pixel
    - // offsets afterwards.
    - //
    - // The reason we want to know the amount a wheel event will scroll
    - // is that it gives us a chance to update the display before the
    - // actual scrolling happens, reducing flickering.
    -
    - var wheelSamples = 0, wheelPixelsPerUnit = null;
    - // Fill in a browser-detected starting value on browsers where we
    - // know one. These don't have to be accurate -- the result of them
    - // being wrong would just be a slight flicker on the first wheel
    - // scroll (if it is large enough).
    - if (ie) { wheelPixelsPerUnit = -.53; }
    - else if (gecko) { wheelPixelsPerUnit = 15; }
    - else if (chrome) { wheelPixelsPerUnit = -.7; }
    - else if (safari) { wheelPixelsPerUnit = -1/3; }
    -
    - function wheelEventDelta(e) {
    - var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
    - if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }
    - if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }
    - else if (dy == null) { dy = e.wheelDelta; }
    - return {x: dx, y: dy}
    - }
    - function wheelEventPixels(e) {
    - var delta = wheelEventDelta(e);
    - delta.x *= wheelPixelsPerUnit;
    - delta.y *= wheelPixelsPerUnit;
    - return delta
    - }
    -
    - function onScrollWheel(cm, e) {
    - var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
    -
    - var display = cm.display, scroll = display.scroller;
    - // Quit if there's nothing to scroll here
    - var canScrollX = scroll.scrollWidth > scroll.clientWidth;
    - var canScrollY = scroll.scrollHeight > scroll.clientHeight;
    - if (!(dx && canScrollX || dy && canScrollY)) { return }
    -
    - // Webkit browsers on OS X abort momentum scrolls when the target
    - // of the scroll event is removed from the scrollable element.
    - // This hack (see related code in patchDisplay) makes sure the
    - // element is kept around.
    - if (dy && mac && webkit) {
    - outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
    - for (var i = 0; i < view.length; i++) {
    - if (view[i].node == cur) {
    - cm.display.currentWheelTarget = cur;
    - break outer
    - }
    - }
    - }
    - }
    -
    - // On some browsers, horizontal scrolling will cause redraws to
    - // happen before the gutter has been realigned, causing it to
    - // wriggle around in a most unseemly way. When we have an
    - // estimated pixels/delta value, we just handle horizontal
    - // scrolling entirely here. It'll be slightly off from native, but
    - // better than glitching out.
    - if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
    - if (dy && canScrollY)
    - { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); }
    - setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit));
    - // Only prevent default scrolling if vertical scrolling is
    - // actually possible. Otherwise, it causes vertical scroll
    - // jitter on OSX trackpads when deltaX is small and deltaY
    - // is large (issue #3579)
    - if (!dy || (dy && canScrollY))
    - { e_preventDefault(e); }
    - display.wheelStartX = null; // Abort measurement, if in progress
    - return
    - }
    -
    - // 'Project' the visible viewport to cover the area that is being
    - // scrolled into view (if we know enough to estimate it).
    - if (dy && wheelPixelsPerUnit != null) {
    - var pixels = dy * wheelPixelsPerUnit;
    - var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
    - if (pixels < 0) { top = Math.max(0, top + pixels - 50); }
    - else { bot = Math.min(cm.doc.height, bot + pixels + 50); }
    - updateDisplaySimple(cm, {top: top, bottom: bot});
    - }
    -
    - if (wheelSamples < 20) {
    - if (display.wheelStartX == null) {
    - display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
    - display.wheelDX = dx; display.wheelDY = dy;
    - setTimeout(function () {
    - if (display.wheelStartX == null) { return }
    - var movedX = scroll.scrollLeft - display.wheelStartX;
    - var movedY = scroll.scrollTop - display.wheelStartY;
    - var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
    - (movedX && display.wheelDX && movedX / display.wheelDX);
    - display.wheelStartX = display.wheelStartY = null;
    - if (!sample) { return }
    - wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
    - ++wheelSamples;
    - }, 200);
    - } else {
    - display.wheelDX += dx; display.wheelDY += dy;
    - }
    - }
    - }
    -
    - // Selection objects are immutable. A new one is created every time
    - // the selection changes. A selection is one or more non-overlapping
    - // (and non-touching) ranges, sorted, and an integer that indicates
    - // which one is the primary selection (the one that's scrolled into
    - // view, that getCursor returns, etc).
    - var Selection = function(ranges, primIndex) {
    - this.ranges = ranges;
    - this.primIndex = primIndex;
    - };
    -
    - Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
    -
    - Selection.prototype.equals = function (other) {
    - var this$1 = this;
    -
    - if (other == this) { return true }
    - if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
    - for (var i = 0; i < this.ranges.length; i++) {
    - var here = this$1.ranges[i], there = other.ranges[i];
    - if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
    - }
    - return true
    - };
    -
    - Selection.prototype.deepCopy = function () {
    - var this$1 = this;
    -
    - var out = [];
    - for (var i = 0; i < this.ranges.length; i++)
    - { out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)); }
    - return new Selection(out, this.primIndex)
    - };
    -
    - Selection.prototype.somethingSelected = function () {
    - var this$1 = this;
    -
    - for (var i = 0; i < this.ranges.length; i++)
    - { if (!this$1.ranges[i].empty()) { return true } }
    - return false
    - };
    -
    - Selection.prototype.contains = function (pos, end) {
    - var this$1 = this;
    -
    - if (!end) { end = pos; }
    - for (var i = 0; i < this.ranges.length; i++) {
    - var range = this$1.ranges[i];
    - if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
    - { return i }
    - }
    - return -1
    - };
    -
    - var Range = function(anchor, head) {
    - this.anchor = anchor; this.head = head;
    - };
    -
    - Range.prototype.from = function () { return minPos(this.anchor, this.head) };
    - Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
    - Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };
    -
    - // Take an unsorted, potentially overlapping set of ranges, and
    - // build a selection out of it. 'Consumes' ranges array (modifying
    - // it).
    - function normalizeSelection(cm, ranges, primIndex) {
    - var mayTouch = cm && cm.options.selectionsMayTouch;
    - var prim = ranges[primIndex];
    - ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });
    - primIndex = indexOf(ranges, prim);
    - for (var i = 1; i < ranges.length; i++) {
    - var cur = ranges[i], prev = ranges[i - 1];
    - var diff = cmp(prev.to(), cur.from());
    - if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {
    - var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
    - var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
    - if (i <= primIndex) { --primIndex; }
    - ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
    - }
    - }
    - return new Selection(ranges, primIndex)
    - }
    -
    - function simpleSelection(anchor, head) {
    - return new Selection([new Range(anchor, head || anchor)], 0)
    - }
    -
    - // Compute the position of the end of a change (its 'to' property
    - // refers to the pre-change end).
    - function changeEnd(change) {
    - if (!change.text) { return change.to }
    - return Pos(change.from.line + change.text.length - 1,
    - lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
    - }
    -
    - // Adjust a position to refer to the post-change position of the
    - // same text, or the end of the change if the change covers it.
    - function adjustForChange(pos, change) {
    - if (cmp(pos, change.from) < 0) { return pos }
    - if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
    -
    - var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
    - if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }
    - return Pos(line, ch)
    - }
    -
    - function computeSelAfterChange(doc, change) {
    - var out = [];
    - for (var i = 0; i < doc.sel.ranges.length; i++) {
    - var range = doc.sel.ranges[i];
    - out.push(new Range(adjustForChange(range.anchor, change),
    - adjustForChange(range.head, change)));
    - }
    - return normalizeSelection(doc.cm, out, doc.sel.primIndex)
    - }
    -
    - function offsetPos(pos, old, nw) {
    - if (pos.line == old.line)
    - { return Pos(nw.line, pos.ch - old.ch + nw.ch) }
    - else
    - { return Pos(nw.line + (pos.line - old.line), pos.ch) }
    - }
    -
    - // Used by replaceSelections to allow moving the selection to the
    - // start or around the replaced test. Hint may be "start" or "around".
    - function computeReplacedSel(doc, changes, hint) {
    - var out = [];
    - var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;
    - for (var i = 0; i < changes.length; i++) {
    - var change = changes[i];
    - var from = offsetPos(change.from, oldPrev, newPrev);
    - var to = offsetPos(changeEnd(change), oldPrev, newPrev);
    - oldPrev = change.to;
    - newPrev = to;
    - if (hint == "around") {
    - var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;
    - out[i] = new Range(inv ? to : from, inv ? from : to);
    - } else {
    - out[i] = new Range(from, from);
    - }
    - }
    - return new Selection(out, doc.sel.primIndex)
    - }
    -
    - // Used to get the editor into a consistent state again when options change.
    -
    - function loadMode(cm) {
    - cm.doc.mode = getMode(cm.options, cm.doc.modeOption);
    - resetModeState(cm);
    - }
    -
    - function resetModeState(cm) {
    - cm.doc.iter(function (line) {
    - if (line.stateAfter) { line.stateAfter = null; }
    - if (line.styles) { line.styles = null; }
    - });
    - cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first;
    - startWorker(cm, 100);
    - cm.state.modeGen++;
    - if (cm.curOp) { regChange(cm); }
    - }
    -
    - // DOCUMENT DATA STRUCTURE
    -
    - // By default, updates that start and end at the beginning of a line
    - // are treated specially, in order to make the association of line
    - // widgets and marker elements with the text behave more intuitive.
    - function isWholeLineUpdate(doc, change) {
    - return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
    - (!doc.cm || doc.cm.options.wholeLineUpdateBefore)
    - }
    -
    - // Perform a change on the document data structure.
    - function updateDoc(doc, change, markedSpans, estimateHeight$$1) {
    - function spansFor(n) {return markedSpans ? markedSpans[n] : null}
    - function update(line, text, spans) {
    - updateLine(line, text, spans, estimateHeight$$1);
    - signalLater(line, "change", line, change);
    - }
    - function linesFor(start, end) {
    - var result = [];
    - for (var i = start; i < end; ++i)
    - { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }
    - return result
    - }
    -
    - var from = change.from, to = change.to, text = change.text;
    - var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
    - var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
    -
    - // Adjust the line structure
    - if (change.full) {
    - doc.insert(0, linesFor(0, text.length));
    - doc.remove(text.length, doc.size - text.length);
    - } else if (isWholeLineUpdate(doc, change)) {
    - // This is a whole-line replace. Treated specially to make
    - // sure line objects move the way they are supposed to.
    - var added = linesFor(0, text.length - 1);
    - update(lastLine, lastLine.text, lastSpans);
    - if (nlines) { doc.remove(from.line, nlines); }
    - if (added.length) { doc.insert(from.line, added); }
    - } else if (firstLine == lastLine) {
    - if (text.length == 1) {
    - update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
    - } else {
    - var added$1 = linesFor(1, text.length - 1);
    - added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));
    - update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
    - doc.insert(from.line + 1, added$1);
    - }
    - } else if (text.length == 1) {
    - update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
    - doc.remove(from.line + 1, nlines);
    - } else {
    - update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
    - update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
    - var added$2 = linesFor(1, text.length - 1);
    - if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }
    - doc.insert(from.line + 1, added$2);
    - }
    -
    - signalLater(doc, "change", doc, change);
    - }
    -
    - // Call f for all linked documents.
    - function linkedDocs(doc, f, sharedHistOnly) {
    - function propagate(doc, skip, sharedHist) {
    - if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
    - var rel = doc.linked[i];
    - if (rel.doc == skip) { continue }
    - var shared = sharedHist && rel.sharedHist;
    - if (sharedHistOnly && !shared) { continue }
    - f(rel.doc, shared);
    - propagate(rel.doc, doc, shared);
    - } }
    - }
    - propagate(doc, null, true);
    - }
    -
    - // Attach a document to an editor.
    - function attachDoc(cm, doc) {
    - if (doc.cm) { throw new Error("This document is already in use.") }
    - cm.doc = doc;
    - doc.cm = cm;
    - estimateLineHeights(cm);
    - loadMode(cm);
    - setDirectionClass(cm);
    - if (!cm.options.lineWrapping) { findMaxLine(cm); }
    - cm.options.mode = doc.modeOption;
    - regChange(cm);
    - }
    -
    - function setDirectionClass(cm) {
    - (cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl");
    - }
    -
    - function directionChanged(cm) {
    - runInOp(cm, function () {
    - setDirectionClass(cm);
    - regChange(cm);
    - });
    - }
    -
    - function History(startGen) {
    - // Arrays of change events and selections. Doing something adds an
    - // event to done and clears undo. Undoing moves events from done
    - // to undone, redoing moves them in the other direction.
    - this.done = []; this.undone = [];
    - this.undoDepth = Infinity;
    - // Used to track when changes can be merged into a single undo
    - // event
    - this.lastModTime = this.lastSelTime = 0;
    - this.lastOp = this.lastSelOp = null;
    - this.lastOrigin = this.lastSelOrigin = null;
    - // Used by the isClean() method
    - this.generation = this.maxGeneration = startGen || 1;
    - }
    -
    - // Create a history change event from an updateDoc-style change
    - // object.
    - function historyChangeFromChange(doc, change) {
    - var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
    - attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
    - linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);
    - return histChange
    - }
    -
    - // Pop all selection events off the end of a history array. Stop at
    - // a change event.
    - function clearSelectionEvents(array) {
    - while (array.length) {
    - var last = lst(array);
    - if (last.ranges) { array.pop(); }
    - else { break }
    - }
    - }
    -
    - // Find the top change event in the history. Pop off selection
    - // events that are in the way.
    - function lastChangeEvent(hist, force) {
    - if (force) {
    - clearSelectionEvents(hist.done);
    - return lst(hist.done)
    - } else if (hist.done.length && !lst(hist.done).ranges) {
    - return lst(hist.done)
    - } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
    - hist.done.pop();
    - return lst(hist.done)
    - }
    - }
    -
    - // Register a change in the history. Merges changes that are within
    - // a single operation, or are close together with an origin that
    - // allows merging (starting with "+") into a single event.
    - function addChangeToHistory(doc, change, selAfter, opId) {
    - var hist = doc.history;
    - hist.undone.length = 0;
    - var time = +new Date, cur;
    - var last;
    -
    - if ((hist.lastOp == opId ||
    - hist.lastOrigin == change.origin && change.origin &&
    - ((change.origin.charAt(0) == "+" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||
    - change.origin.charAt(0) == "*")) &&
    - (cur = lastChangeEvent(hist, hist.lastOp == opId))) {
    - // Merge this change into the last event
    - last = lst(cur.changes);
    - if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
    - // Optimized case for simple insertion -- don't want to add
    - // new changesets for every character typed
    - last.to = changeEnd(change);
    - } else {
    - // Add new sub-event
    - cur.changes.push(historyChangeFromChange(doc, change));
    - }
    - } else {
    - // Can not be merged, start a new event.
    - var before = lst(hist.done);
    - if (!before || !before.ranges)
    - { pushSelectionToHistory(doc.sel, hist.done); }
    - cur = {changes: [historyChangeFromChange(doc, change)],
    - generation: hist.generation};
    - hist.done.push(cur);
    - while (hist.done.length > hist.undoDepth) {
    - hist.done.shift();
    - if (!hist.done[0].ranges) { hist.done.shift(); }
    - }
    - }
    - hist.done.push(selAfter);
    - hist.generation = ++hist.maxGeneration;
    - hist.lastModTime = hist.lastSelTime = time;
    - hist.lastOp = hist.lastSelOp = opId;
    - hist.lastOrigin = hist.lastSelOrigin = change.origin;
    -
    - if (!last) { signal(doc, "historyAdded"); }
    - }
    -
    - function selectionEventCanBeMerged(doc, origin, prev, sel) {
    - var ch = origin.charAt(0);
    - return ch == "*" ||
    - ch == "+" &&
    - prev.ranges.length == sel.ranges.length &&
    - prev.somethingSelected() == sel.somethingSelected() &&
    - new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
    - }
    -
    - // Called whenever the selection changes, sets the new selection as
    - // the pending selection in the history, and pushes the old pending
    - // selection into the 'done' array when it was significantly
    - // different (in number of selected ranges, emptiness, or time).
    - function addSelectionToHistory(doc, sel, opId, options) {
    - var hist = doc.history, origin = options && options.origin;
    -
    - // A new event is started when the previous origin does not match
    - // the current, or the origins don't allow matching. Origins
    - // starting with * are always merged, those starting with + are
    - // merged when similar and close together in time.
    - if (opId == hist.lastSelOp ||
    - (origin && hist.lastSelOrigin == origin &&
    - (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
    - selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
    - { hist.done[hist.done.length - 1] = sel; }
    - else
    - { pushSelectionToHistory(sel, hist.done); }
    -
    - hist.lastSelTime = +new Date;
    - hist.lastSelOrigin = origin;
    - hist.lastSelOp = opId;
    - if (options && options.clearRedo !== false)
    - { clearSelectionEvents(hist.undone); }
    - }
    -
    - function pushSelectionToHistory(sel, dest) {
    - var top = lst(dest);
    - if (!(top && top.ranges && top.equals(sel)))
    - { dest.push(sel); }
    - }
    -
    - // Used to store marked span information in the history.
    - function attachLocalSpans(doc, change, from, to) {
    - var existing = change["spans_" + doc.id], n = 0;
    - doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
    - if (line.markedSpans)
    - { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; }
    - ++n;
    - });
    - }
    -
    - // When un/re-doing restores text containing marked spans, those
    - // that have been explicitly cleared should not be restored.
    - function removeClearedSpans(spans) {
    - if (!spans) { return null }
    - var out;
    - for (var i = 0; i < spans.length; ++i) {
    - if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }
    - else if (out) { out.push(spans[i]); }
    - }
    - return !out ? spans : out.length ? out : null
    - }
    -
    - // Retrieve and filter the old marked spans stored in a change event.
    - function getOldSpans(doc, change) {
    - var found = change["spans_" + doc.id];
    - if (!found) { return null }
    - var nw = [];
    - for (var i = 0; i < change.text.length; ++i)
    - { nw.push(removeClearedSpans(found[i])); }
    - return nw
    - }
    -
    - // Used for un/re-doing changes from the history. Combines the
    - // result of computing the existing spans with the set of spans that
    - // existed in the history (so that deleting around a span and then
    - // undoing brings back the span).
    - function mergeOldSpans(doc, change) {
    - var old = getOldSpans(doc, change);
    - var stretched = stretchSpansOverChange(doc, change);
    - if (!old) { return stretched }
    - if (!stretched) { return old }
    -
    - for (var i = 0; i < old.length; ++i) {
    - var oldCur = old[i], stretchCur = stretched[i];
    - if (oldCur && stretchCur) {
    - spans: for (var j = 0; j < stretchCur.length; ++j) {
    - var span = stretchCur[j];
    - for (var k = 0; k < oldCur.length; ++k)
    - { if (oldCur[k].marker == span.marker) { continue spans } }
    - oldCur.push(span);
    - }
    - } else if (stretchCur) {
    - old[i] = stretchCur;
    - }
    - }
    - return old
    - }
    -
    - // Used both to provide a JSON-safe object in .getHistory, and, when
    - // detaching a document, to split the history in two
    - function copyHistoryArray(events, newGroup, instantiateSel) {
    - var copy = [];
    - for (var i = 0; i < events.length; ++i) {
    - var event = events[i];
    - if (event.ranges) {
    - copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
    - continue
    - }
    - var changes = event.changes, newChanges = [];
    - copy.push({changes: newChanges});
    - for (var j = 0; j < changes.length; ++j) {
    - var change = changes[j], m = (void 0);
    - newChanges.push({from: change.from, to: change.to, text: change.text});
    - if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
    - if (indexOf(newGroup, Number(m[1])) > -1) {
    - lst(newChanges)[prop] = change[prop];
    - delete change[prop];
    - }
    - } } }
    - }
    - }
    - return copy
    - }
    -
    - // The 'scroll' parameter given to many of these indicated whether
    - // the new cursor position should be scrolled into view after
    - // modifying the selection.
    -
    - // If shift is held or the extend flag is set, extends a range to
    - // include a given position (and optionally a second position).
    - // Otherwise, simply returns the range between the given positions.
    - // Used for cursor motion and such.
    - function extendRange(range, head, other, extend) {
    - if (extend) {
    - var anchor = range.anchor;
    - if (other) {
    - var posBefore = cmp(head, anchor) < 0;
    - if (posBefore != (cmp(other, anchor) < 0)) {
    - anchor = head;
    - head = other;
    - } else if (posBefore != (cmp(head, other) < 0)) {
    - head = other;
    - }
    - }
    - return new Range(anchor, head)
    - } else {
    - return new Range(other || head, head)
    - }
    - }
    -
    - // Extend the primary selection range, discard the rest.
    - function extendSelection(doc, head, other, options, extend) {
    - if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }
    - setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);
    - }
    -
    - // Extend all selections (pos is an array of selections with length
    - // equal the number of selections)
    - function extendSelections(doc, heads, options) {
    - var out = [];
    - var extend = doc.cm && (doc.cm.display.shift || doc.extend);
    - for (var i = 0; i < doc.sel.ranges.length; i++)
    - { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }
    - var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);
    - setSelection(doc, newSel, options);
    - }
    -
    - // Updates a single range in the selection.
    - function replaceOneSelection(doc, i, range, options) {
    - var ranges = doc.sel.ranges.slice(0);
    - ranges[i] = range;
    - setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);
    - }
    -
    - // Reset the selection to a single range.
    - function setSimpleSelection(doc, anchor, head, options) {
    - setSelection(doc, simpleSelection(anchor, head), options);
    - }
    -
    - // Give beforeSelectionChange handlers a change to influence a
    - // selection update.
    - function filterSelectionChange(doc, sel, options) {
    - var obj = {
    - ranges: sel.ranges,
    - update: function(ranges) {
    - var this$1 = this;
    -
    - this.ranges = [];
    - for (var i = 0; i < ranges.length; i++)
    - { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
    - clipPos(doc, ranges[i].head)); }
    - },
    - origin: options && options.origin
    - };
    - signal(doc, "beforeSelectionChange", doc, obj);
    - if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); }
    - if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }
    - else { return sel }
    - }
    -
    - function setSelectionReplaceHistory(doc, sel, options) {
    - var done = doc.history.done, last = lst(done);
    - if (last && last.ranges) {
    - done[done.length - 1] = sel;
    - setSelectionNoUndo(doc, sel, options);
    - } else {
    - setSelection(doc, sel, options);
    - }
    - }
    -
    - // Set a new selection.
    - function setSelection(doc, sel, options) {
    - setSelectionNoUndo(doc, sel, options);
    - addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);
    - }
    -
    - function setSelectionNoUndo(doc, sel, options) {
    - if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
    - { sel = filterSelectionChange(doc, sel, options); }
    -
    - var bias = options && options.bias ||
    - (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
    - setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));
    -
    - if (!(options && options.scroll === false) && doc.cm)
    - { ensureCursorVisible(doc.cm); }
    - }
    -
    - function setSelectionInner(doc, sel) {
    - if (sel.equals(doc.sel)) { return }
    -
    - doc.sel = sel;
    -
    - if (doc.cm) {
    - doc.cm.curOp.updateInput = 1;
    - doc.cm.curOp.selectionChanged = true;
    - signalCursorActivity(doc.cm);
    - }
    - signalLater(doc, "cursorActivity", doc);
    - }
    -
    - // Verify that the selection does not partially select any atomic
    - // marked ranges.
    - function reCheckSelection(doc) {
    - setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));
    - }
    -
    - // Return a selection that does not partially select any atomic
    - // ranges.
    - function skipAtomicInSelection(doc, sel, bias, mayClear) {
    - var out;
    - for (var i = 0; i < sel.ranges.length; i++) {
    - var range = sel.ranges[i];
    - var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
    - var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
    - var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
    - if (out || newAnchor != range.anchor || newHead != range.head) {
    - if (!out) { out = sel.ranges.slice(0, i); }
    - out[i] = new Range(newAnchor, newHead);
    - }
    - }
    - return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel
    - }
    -
    - function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
    - var line = getLine(doc, pos.line);
    - if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
    - var sp = line.markedSpans[i], m = sp.marker;
    -
    - // Determine if we should prevent the cursor being placed to the left/right of an atomic marker
    - // Historically this was determined using the inclusiveLeft/Right option, but the new way to control it
    - // is with selectLeft/Right
    - var preventCursorLeft = ("selectLeft" in m) ? !m.selectLeft : m.inclusiveLeft;
    - var preventCursorRight = ("selectRight" in m) ? !m.selectRight : m.inclusiveRight;
    -
    - if ((sp.from == null || (preventCursorLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
    - (sp.to == null || (preventCursorRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
    - if (mayClear) {
    - signal(m, "beforeCursorEnter");
    - if (m.explicitlyCleared) {
    - if (!line.markedSpans) { break }
    - else {--i; continue}
    - }
    - }
    - if (!m.atomic) { continue }
    -
    - if (oldPos) {
    - var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);
    - if (dir < 0 ? preventCursorRight : preventCursorLeft)
    - { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }
    - if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
    - { return skipAtomicInner(doc, near, pos, dir, mayClear) }
    - }
    -
    - var far = m.find(dir < 0 ? -1 : 1);
    - if (dir < 0 ? preventCursorLeft : preventCursorRight)
    - { far = movePos(doc, far, dir, far.line == pos.line ? line : null); }
    - return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
    - }
    - } }
    - return pos
    - }
    -
    - // Ensure a given position is not inside an atomic range.
    - function skipAtomic(doc, pos, oldPos, bias, mayClear) {
    - var dir = bias || 1;
    - var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
    - (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
    - skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
    - (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));
    - if (!found) {
    - doc.cantEdit = true;
    - return Pos(doc.first, 0)
    - }
    - return found
    - }
    -
    - function movePos(doc, pos, dir, line) {
    - if (dir < 0 && pos.ch == 0) {
    - if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
    - else { return null }
    - } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
    - if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
    - else { return null }
    - } else {
    - return new Pos(pos.line, pos.ch + dir)
    - }
    - }
    -
    - function selectAll(cm) {
    - cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);
    - }
    -
    - // UPDATING
    -
    - // Allow "beforeChange" event handlers to influence a change
    - function filterChange(doc, change, update) {
    - var obj = {
    - canceled: false,
    - from: change.from,
    - to: change.to,
    - text: change.text,
    - origin: change.origin,
    - cancel: function () { return obj.canceled = true; }
    - };
    - if (update) { obj.update = function (from, to, text, origin) {
    - if (from) { obj.from = clipPos(doc, from); }
    - if (to) { obj.to = clipPos(doc, to); }
    - if (text) { obj.text = text; }
    - if (origin !== undefined) { obj.origin = origin; }
    - }; }
    - signal(doc, "beforeChange", doc, obj);
    - if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); }
    -
    - if (obj.canceled) {
    - if (doc.cm) { doc.cm.curOp.updateInput = 2; }
    - return null
    - }
    - return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
    - }
    -
    - // Apply a change to a document, and add it to the document's
    - // history, and propagating it to all linked documents.
    - function makeChange(doc, change, ignoreReadOnly) {
    - if (doc.cm) {
    - if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
    - if (doc.cm.state.suppressEdits) { return }
    - }
    -
    - if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
    - change = filterChange(doc, change, true);
    - if (!change) { return }
    - }
    -
    - // Possibly split or suppress the update based on the presence
    - // of read-only spans in its range.
    - var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
    - if (split) {
    - for (var i = split.length - 1; i >= 0; --i)
    - { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text, origin: change.origin}); }
    - } else {
    - makeChangeInner(doc, change);
    - }
    - }
    -
    - function makeChangeInner(doc, change) {
    - if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
    - var selAfter = computeSelAfterChange(doc, change);
    - addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
    -
    - makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
    - var rebased = [];
    -
    - linkedDocs(doc, function (doc, sharedHist) {
    - if (!sharedHist && indexOf(rebased, doc.history) == -1) {
    - rebaseHist(doc.history, change);
    - rebased.push(doc.history);
    - }
    - makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
    - });
    - }
    -
    - // Revert a change stored in a document's history.
    - function makeChangeFromHistory(doc, type, allowSelectionOnly) {
    - var suppress = doc.cm && doc.cm.state.suppressEdits;
    - if (suppress && !allowSelectionOnly) { return }
    -
    - var hist = doc.history, event, selAfter = doc.sel;
    - var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;
    -
    - // Verify that there is a useable event (so that ctrl-z won't
    - // needlessly clear selection events)
    - var i = 0;
    - for (; i < source.length; i++) {
    - event = source[i];
    - if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
    - { break }
    - }
    - if (i == source.length) { return }
    - hist.lastOrigin = hist.lastSelOrigin = null;
    -
    - for (;;) {
    - event = source.pop();
    - if (event.ranges) {
    - pushSelectionToHistory(event, dest);
    - if (allowSelectionOnly && !event.equals(doc.sel)) {
    - setSelection(doc, event, {clearRedo: false});
    - return
    - }
    - selAfter = event;
    - } else if (suppress) {
    - source.push(event);
    - return
    - } else { break }
    - }
    -
    - // Build up a reverse change object to add to the opposite history
    - // stack (redo when undoing, and vice versa).
    - var antiChanges = [];
    - pushSelectionToHistory(selAfter, dest);
    - dest.push({changes: antiChanges, generation: hist.generation});
    - hist.generation = event.generation || ++hist.maxGeneration;
    -
    - var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");
    -
    - var loop = function ( i ) {
    - var change = event.changes[i];
    - change.origin = type;
    - if (filter && !filterChange(doc, change, false)) {
    - source.length = 0;
    - return {}
    - }
    -
    - antiChanges.push(historyChangeFromChange(doc, change));
    -
    - var after = i ? computeSelAfterChange(doc, change) : lst(source);
    - makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
    - if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }
    - var rebased = [];
    -
    - // Propagate to the linked documents
    - linkedDocs(doc, function (doc, sharedHist) {
    - if (!sharedHist && indexOf(rebased, doc.history) == -1) {
    - rebaseHist(doc.history, change);
    - rebased.push(doc.history);
    - }
    - makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
    - });
    - };
    -
    - for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {
    - var returned = loop( i$1 );
    -
    - if ( returned ) return returned.v;
    - }
    - }
    -
    - // Sub-views need their line numbers shifted when text is added
    - // above or below them in the parent document.
    - function shiftDoc(doc, distance) {
    - if (distance == 0) { return }
    - doc.first += distance;
    - doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
    - Pos(range.anchor.line + distance, range.anchor.ch),
    - Pos(range.head.line + distance, range.head.ch)
    - ); }), doc.sel.primIndex);
    - if (doc.cm) {
    - regChange(doc.cm, doc.first, doc.first - distance, distance);
    - for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
    - { regLineChange(doc.cm, l, "gutter"); }
    - }
    - }
    -
    - // More lower-level change function, handling only a single document
    - // (not linked ones).
    - function makeChangeSingleDoc(doc, change, selAfter, spans) {
    - if (doc.cm && !doc.cm.curOp)
    - { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }
    -
    - if (change.to.line < doc.first) {
    - shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
    - return
    - }
    - if (change.from.line > doc.lastLine()) { return }
    -
    - // Clip the change to the size of this doc
    - if (change.from.line < doc.first) {
    - var shift = change.text.length - 1 - (doc.first - change.from.line);
    - shiftDoc(doc, shift);
    - change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
    - text: [lst(change.text)], origin: change.origin};
    - }
    - var last = doc.lastLine();
    - if (change.to.line > last) {
    - change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
    - text: [change.text[0]], origin: change.origin};
    - }
    -
    - change.removed = getBetween(doc, change.from, change.to);
    -
    - if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }
    - if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }
    - else { updateDoc(doc, change, spans); }
    - setSelectionNoUndo(doc, selAfter, sel_dontScroll);
    -
    - if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))
    - { doc.cantEdit = false; }
    - }
    -
    - // Handle the interaction of a change to a document with the editor
    - // that this document is part of.
    - function makeChangeSingleDocInEditor(cm, change, spans) {
    - var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
    -
    - var recomputeMaxLength = false, checkWidthStart = from.line;
    - if (!cm.options.lineWrapping) {
    - checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));
    - doc.iter(checkWidthStart, to.line + 1, function (line) {
    - if (line == display.maxLine) {
    - recomputeMaxLength = true;
    - return true
    - }
    - });
    - }
    -
    - if (doc.sel.contains(change.from, change.to) > -1)
    - { signalCursorActivity(cm); }
    -
    - updateDoc(doc, change, spans, estimateHeight(cm));
    -
    - if (!cm.options.lineWrapping) {
    - doc.iter(checkWidthStart, from.line + change.text.length, function (line) {
    - var len = lineLength(line);
    - if (len > display.maxLineLength) {
    - display.maxLine = line;
    - display.maxLineLength = len;
    - display.maxLineChanged = true;
    - recomputeMaxLength = false;
    - }
    - });
    - if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }
    - }
    -
    - retreatFrontier(doc, from.line);
    - startWorker(cm, 400);
    -
    - var lendiff = change.text.length - (to.line - from.line) - 1;
    - // Remember that these lines changed, for updating the display
    - if (change.full)
    - { regChange(cm); }
    - else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
    - { regLineChange(cm, from.line, "text"); }
    - else
    - { regChange(cm, from.line, to.line + 1, lendiff); }
    -
    - var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change");
    - if (changeHandler || changesHandler) {
    - var obj = {
    - from: from, to: to,
    - text: change.text,
    - removed: change.removed,
    - origin: change.origin
    - };
    - if (changeHandler) { signalLater(cm, "change", cm, obj); }
    - if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }
    - }
    - cm.display.selForContextMenu = null;
    - }
    -
    - function replaceRange(doc, code, from, to, origin) {
    - var assign;
    -
    - if (!to) { to = from; }
    - if (cmp(to, from) < 0) { (assign = [to, from], from = assign[0], to = assign[1]); }
    - if (typeof code == "string") { code = doc.splitLines(code); }
    - makeChange(doc, {from: from, to: to, text: code, origin: origin});
    - }
    -
    - // Rebasing/resetting history to deal with externally-sourced changes
    -
    - function rebaseHistSelSingle(pos, from, to, diff) {
    - if (to < pos.line) {
    - pos.line += diff;
    - } else if (from < pos.line) {
    - pos.line = from;
    - pos.ch = 0;
    - }
    - }
    -
    - // Tries to rebase an array of history events given a change in the
    - // document. If the change touches the same lines as the event, the
    - // event, and everything 'behind' it, is discarded. If the change is
    - // before the event, the event's positions are updated. Uses a
    - // copy-on-write scheme for the positions, to avoid having to
    - // reallocate them all on every rebase, but also avoid problems with
    - // shared position objects being unsafely updated.
    - function rebaseHistArray(array, from, to, diff) {
    - for (var i = 0; i < array.length; ++i) {
    - var sub = array[i], ok = true;
    - if (sub.ranges) {
    - if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
    - for (var j = 0; j < sub.ranges.length; j++) {
    - rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
    - rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
    - }
    - continue
    - }
    - for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
    - var cur = sub.changes[j$1];
    - if (to < cur.from.line) {
    - cur.from = Pos(cur.from.line + diff, cur.from.ch);
    - cur.to = Pos(cur.to.line + diff, cur.to.ch);
    - } else if (from <= cur.to.line) {
    - ok = false;
    - break
    - }
    - }
    - if (!ok) {
    - array.splice(0, i + 1);
    - i = 0;
    - }
    - }
    - }
    -
    - function rebaseHist(hist, change) {
    - var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
    - rebaseHistArray(hist.done, from, to, diff);
    - rebaseHistArray(hist.undone, from, to, diff);
    - }
    -
    - // Utility for applying a change to a line by handle or number,
    - // returning the number and optionally registering the line as
    - // changed.
    - function changeLine(doc, handle, changeType, op) {
    - var no = handle, line = handle;
    - if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); }
    - else { no = lineNo(handle); }
    - if (no == null) { return null }
    - if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }
    - return line
    - }
    -
    - // The document is represented as a BTree consisting of leaves, with
    - // chunk of lines in them, and branches, with up to ten leaves or
    - // other branch nodes below them. The top node is always a branch
    - // node, and is the document object itself (meaning it has
    - // additional methods and properties).
    - //
    - // All nodes have parent links. The tree is used both to go from
    - // line numbers to line objects, and to go from objects to numbers.
    - // It also indexes by height, and is used to convert between height
    - // and line object, and to find the total height of the document.
    - //
    - // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
    -
    - function LeafChunk(lines) {
    - var this$1 = this;
    -
    - this.lines = lines;
    - this.parent = null;
    - var height = 0;
    - for (var i = 0; i < lines.length; ++i) {
    - lines[i].parent = this$1;
    - height += lines[i].height;
    - }
    - this.height = height;
    - }
    -
    - LeafChunk.prototype = {
    - chunkSize: function() { return this.lines.length },
    -
    - // Remove the n lines at offset 'at'.
    - removeInner: function(at, n) {
    - var this$1 = this;
    -
    - for (var i = at, e = at + n; i < e; ++i) {
    - var line = this$1.lines[i];
    - this$1.height -= line.height;
    - cleanUpLine(line);
    - signalLater(line, "delete");
    - }
    - this.lines.splice(at, n);
    - },
    -
    - // Helper used to collapse a small branch into a single leaf.
    - collapse: function(lines) {
    - lines.push.apply(lines, this.lines);
    - },
    -
    - // Insert the given array of lines at offset 'at', count them as
    - // having the given height.
    - insertInner: function(at, lines, height) {
    - var this$1 = this;
    -
    - this.height += height;
    - this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
    - for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1; }
    - },
    -
    - // Used to iterate over a part of the tree.
    - iterN: function(at, n, op) {
    - var this$1 = this;
    -
    - for (var e = at + n; at < e; ++at)
    - { if (op(this$1.lines[at])) { return true } }
    - }
    - };
    -
    - function BranchChunk(children) {
    - var this$1 = this;
    -
    - this.children = children;
    - var size = 0, height = 0;
    - for (var i = 0; i < children.length; ++i) {
    - var ch = children[i];
    - size += ch.chunkSize(); height += ch.height;
    - ch.parent = this$1;
    - }
    - this.size = size;
    - this.height = height;
    - this.parent = null;
    - }
    -
    - BranchChunk.prototype = {
    - chunkSize: function() { return this.size },
    -
    - removeInner: function(at, n) {
    - var this$1 = this;
    -
    - this.size -= n;
    - for (var i = 0; i < this.children.length; ++i) {
    - var child = this$1.children[i], sz = child.chunkSize();
    - if (at < sz) {
    - var rm = Math.min(n, sz - at), oldHeight = child.height;
    - child.removeInner(at, rm);
    - this$1.height -= oldHeight - child.height;
    - if (sz == rm) { this$1.children.splice(i--, 1); child.parent = null; }
    - if ((n -= rm) == 0) { break }
    - at = 0;
    - } else { at -= sz; }
    - }
    - // If the result is smaller than 25 lines, ensure that it is a
    - // single leaf node.
    - if (this.size - n < 25 &&
    - (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
    - var lines = [];
    - this.collapse(lines);
    - this.children = [new LeafChunk(lines)];
    - this.children[0].parent = this;
    - }
    - },
    -
    - collapse: function(lines) {
    - var this$1 = this;
    -
    - for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines); }
    - },
    -
    - insertInner: function(at, lines, height) {
    - var this$1 = this;
    -
    - this.size += lines.length;
    - this.height += height;
    - for (var i = 0; i < this.children.length; ++i) {
    - var child = this$1.children[i], sz = child.chunkSize();
    - if (at <= sz) {
    - child.insertInner(at, lines, height);
    - if (child.lines && child.lines.length > 50) {
    - // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
    - // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
    - var remaining = child.lines.length % 25 + 25;
    - for (var pos = remaining; pos < child.lines.length;) {
    - var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));
    - child.height -= leaf.height;
    - this$1.children.splice(++i, 0, leaf);
    - leaf.parent = this$1;
    - }
    - child.lines = child.lines.slice(0, remaining);
    - this$1.maybeSpill();
    - }
    - break
    - }
    - at -= sz;
    - }
    - },
    -
    - // When a node has grown, check whether it should be split.
    - maybeSpill: function() {
    - if (this.children.length <= 10) { return }
    - var me = this;
    - do {
    - var spilled = me.children.splice(me.children.length - 5, 5);
    - var sibling = new BranchChunk(spilled);
    - if (!me.parent) { // Become the parent node
    - var copy = new BranchChunk(me.children);
    - copy.parent = me;
    - me.children = [copy, sibling];
    - me = copy;
    - } else {
    - me.size -= sibling.size;
    - me.height -= sibling.height;
    - var myIndex = indexOf(me.parent.children, me);
    - me.parent.children.splice(myIndex + 1, 0, sibling);
    - }
    - sibling.parent = me.parent;
    - } while (me.children.length > 10)
    - me.parent.maybeSpill();
    - },
    -
    - iterN: function(at, n, op) {
    - var this$1 = this;
    -
    - for (var i = 0; i < this.children.length; ++i) {
    - var child = this$1.children[i], sz = child.chunkSize();
    - if (at < sz) {
    - var used = Math.min(n, sz - at);
    - if (child.iterN(at, used, op)) { return true }
    - if ((n -= used) == 0) { break }
    - at = 0;
    - } else { at -= sz; }
    - }
    - }
    - };
    -
    - // Line widgets are block elements displayed above or below a line.
    -
    - var LineWidget = function(doc, node, options) {
    - var this$1 = this;
    -
    - if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
    - { this$1[opt] = options[opt]; } } }
    - this.doc = doc;
    - this.node = node;
    - };
    -
    - LineWidget.prototype.clear = function () {
    - var this$1 = this;
    -
    - var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
    - if (no == null || !ws) { return }
    - for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1); } }
    - if (!ws.length) { line.widgets = null; }
    - var height = widgetHeight(this);
    - updateLineHeight(line, Math.max(0, line.height - height));
    - if (cm) {
    - runInOp(cm, function () {
    - adjustScrollWhenAboveVisible(cm, line, -height);
    - regLineChange(cm, no, "widget");
    - });
    - signalLater(cm, "lineWidgetCleared", cm, this, no);
    - }
    - };
    -
    - LineWidget.prototype.changed = function () {
    - var this$1 = this;
    -
    - var oldH = this.height, cm = this.doc.cm, line = this.line;
    - this.height = null;
    - var diff = widgetHeight(this) - oldH;
    - if (!diff) { return }
    - if (!lineIsHidden(this.doc, line)) { updateLineHeight(line, line.height + diff); }
    - if (cm) {
    - runInOp(cm, function () {
    - cm.curOp.forceUpdate = true;
    - adjustScrollWhenAboveVisible(cm, line, diff);
    - signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line));
    - });
    - }
    - };
    - eventMixin(LineWidget);
    -
    - function adjustScrollWhenAboveVisible(cm, line, diff) {
    - if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
    - { addToScrollTop(cm, diff); }
    - }
    -
    - function addLineWidget(doc, handle, node, options) {
    - var widget = new LineWidget(doc, node, options);
    - var cm = doc.cm;
    - if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }
    - changeLine(doc, handle, "widget", function (line) {
    - var widgets = line.widgets || (line.widgets = []);
    - if (widget.insertAt == null) { widgets.push(widget); }
    - else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); }
    - widget.line = line;
    - if (cm && !lineIsHidden(doc, line)) {
    - var aboveVisible = heightAtLine(line) < doc.scrollTop;
    - updateLineHeight(line, line.height + widgetHeight(widget));
    - if (aboveVisible) { addToScrollTop(cm, widget.height); }
    - cm.curOp.forceUpdate = true;
    - }
    - return true
    - });
    - if (cm) { signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle)); }
    - return widget
    - }
    -
    - // TEXTMARKERS
    -
    - // Created with markText and setBookmark methods. A TextMarker is a
    - // handle that can be used to clear or find a marked position in the
    - // document. Line objects hold arrays (markedSpans) containing
    - // {from, to, marker} object pointing to such marker objects, and
    - // indicating that such a marker is present on that line. Multiple
    - // lines may point to the same marker when it spans across lines.
    - // The spans will have null for their from/to properties when the
    - // marker continues beyond the start/end of the line. Markers have
    - // links back to the lines they currently touch.
    -
    - // Collapsed markers have unique ids, in order to be able to order
    - // them, which is needed for uniquely determining an outer marker
    - // when they overlap (they may nest, but not partially overlap).
    - var nextMarkerId = 0;
    -
    - var TextMarker = function(doc, type) {
    - this.lines = [];
    - this.type = type;
    - this.doc = doc;
    - this.id = ++nextMarkerId;
    - };
    -
    - // Clear the marker.
    - TextMarker.prototype.clear = function () {
    - var this$1 = this;
    -
    - if (this.explicitlyCleared) { return }
    - var cm = this.doc.cm, withOp = cm && !cm.curOp;
    - if (withOp) { startOperation(cm); }
    - if (hasHandler(this, "clear")) {
    - var found = this.find();
    - if (found) { signalLater(this, "clear", found.from, found.to); }
    - }
    - var min = null, max = null;
    - for (var i = 0; i < this.lines.length; ++i) {
    - var line = this$1.lines[i];
    - var span = getMarkedSpanFor(line.markedSpans, this$1);
    - if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), "text"); }
    - else if (cm) {
    - if (span.to != null) { max = lineNo(line); }
    - if (span.from != null) { min = lineNo(line); }
    - }
    - line.markedSpans = removeMarkedSpan(line.markedSpans, span);
    - if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm)
    - { updateLineHeight(line, textHeight(cm.display)); }
    - }
    - if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
    - var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual);
    - if (len > cm.display.maxLineLength) {
    - cm.display.maxLine = visual;
    - cm.display.maxLineLength = len;
    - cm.display.maxLineChanged = true;
    - }
    - } }
    -
    - if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }
    - this.lines.length = 0;
    - this.explicitlyCleared = true;
    - if (this.atomic && this.doc.cantEdit) {
    - this.doc.cantEdit = false;
    - if (cm) { reCheckSelection(cm.doc); }
    - }
    - if (cm) { signalLater(cm, "markerCleared", cm, this, min, max); }
    - if (withOp) { endOperation(cm); }
    - if (this.parent) { this.parent.clear(); }
    - };
    -
    - // Find the position of the marker in the document. Returns a {from,
    - // to} object by default. Side can be passed to get a specific side
    - // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
    - // Pos objects returned contain a line object, rather than a line
    - // number (used to prevent looking up the same line twice).
    - TextMarker.prototype.find = function (side, lineObj) {
    - var this$1 = this;
    -
    - if (side == null && this.type == "bookmark") { side = 1; }
    - var from, to;
    - for (var i = 0; i < this.lines.length; ++i) {
    - var line = this$1.lines[i];
    - var span = getMarkedSpanFor(line.markedSpans, this$1);
    - if (span.from != null) {
    - from = Pos(lineObj ? line : lineNo(line), span.from);
    - if (side == -1) { return from }
    - }
    - if (span.to != null) {
    - to = Pos(lineObj ? line : lineNo(line), span.to);
    - if (side == 1) { return to }
    - }
    - }
    - return from && {from: from, to: to}
    - };
    -
    - // Signals that the marker's widget changed, and surrounding layout
    - // should be recomputed.
    - TextMarker.prototype.changed = function () {
    - var this$1 = this;
    -
    - var pos = this.find(-1, true), widget = this, cm = this.doc.cm;
    - if (!pos || !cm) { return }
    - runInOp(cm, function () {
    - var line = pos.line, lineN = lineNo(pos.line);
    - var view = findViewForLine(cm, lineN);
    - if (view) {
    - clearLineMeasurementCacheFor(view);
    - cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;
    - }
    - cm.curOp.updateMaxLine = true;
    - if (!lineIsHidden(widget.doc, line) && widget.height != null) {
    - var oldHeight = widget.height;
    - widget.height = null;
    - var dHeight = widgetHeight(widget) - oldHeight;
    - if (dHeight)
    - { updateLineHeight(line, line.height + dHeight); }
    - }
    - signalLater(cm, "markerChanged", cm, this$1);
    - });
    - };
    -
    - TextMarker.prototype.attachLine = function (line) {
    - if (!this.lines.length && this.doc.cm) {
    - var op = this.doc.cm.curOp;
    - if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
    - { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }
    - }
    - this.lines.push(line);
    - };
    -
    - TextMarker.prototype.detachLine = function (line) {
    - this.lines.splice(indexOf(this.lines, line), 1);
    - if (!this.lines.length && this.doc.cm) {
    - var op = this.doc.cm.curOp
    - ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
    - }
    - };
    - eventMixin(TextMarker);
    -
    - // Create a marker, wire it up to the right lines, and
    - function markText(doc, from, to, options, type) {
    - // Shared markers (across linked documents) are handled separately
    - // (markTextShared will call out to this again, once per
    - // document).
    - if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
    - // Ensure we are in an operation.
    - if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }
    -
    - var marker = new TextMarker(doc, type), diff = cmp(from, to);
    - if (options) { copyObj(options, marker, false); }
    - // Don't connect empty markers unless clearWhenEmpty is false
    - if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
    - { return marker }
    - if (marker.replacedWith) {
    - // Showing up as a widget implies collapsed (widget replaces text)
    - marker.collapsed = true;
    - marker.widgetNode = eltP("span", arker.replacedWith], "CodeMirror-widget");
    - if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); }
    - if (options.insertLeft) { marker.widgetNode.insertLeft = true; }
    - }
    - if (marker.collapsed) {
    - if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
    - from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
    - { throw new Error("Inserting collapsed marker partially overlapping an existing one") }
    - seeCollapsedSpans();
    - }
    -
    - if (marker.addToHistory)
    - { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); }
    -
    - var curLine = from.line, cm = doc.cm, updateMaxLine;
    - doc.iter(curLine, to.line + 1, function (line) {
    - if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
    - { updateMaxLine = true; }
    - if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }
    - addMarkedSpan(line, new MarkedSpan(marker,
    - curLine == from.line ? from.ch : null,
    - curLine == to.line ? to.ch : null));
    - ++curLine;
    - });
    - // lineIsHidden depends on the presence of the spans, so needs a second pass
    - if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
    - if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }
    - }); }
    -
    - if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); }
    -
    - if (marker.readOnly) {
    - seeReadOnlySpans();
    - if (doc.history.done.length || doc.history.undone.length)
    - { doc.clearHistory(); }
    - }
    - if (marker.collapsed) {
    - marker.id = ++nextMarkerId;
    - marker.atomic = true;
    - }
    - if (cm) {
    - // Sync editor state
    - if (updateMaxLine) { cm.curOp.updateMaxLine = true; }
    - if (marker.collapsed)
    - { regChange(cm, from.line, to.line + 1); }
    - else if (marker.className || marker.startStyle || marker.endStyle || marker.css ||
    - marker.attributes || marker.title)
    - { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } }
    - if (marker.atomic) { reCheckSelection(cm.doc); }
    - signalLater(cm, "markerAdded", cm, marker);
    - }
    - return marker
    - }
    -
    - // SHARED TEXTMARKERS
    -
    - // A shared marker spans multiple linked documents. It is
    - // implemented as a meta-marker-object controlling multiple normal
    - // markers.
    - var SharedTextMarker = function(markers, primary) {
    - var this$1 = this;
    -
    - this.markers = markers;
    - this.primary = primary;
    - for (var i = 0; i < markers.length; ++i)
    - { markers[i].parent = this$1; }
    - };
    -
    - SharedTextMarker.prototype.clear = function () {
    - var this$1 = this;
    -
    - if (this.explicitlyCleared) { return }
    - this.explicitlyCleared = true;
    - for (var i = 0; i < this.markers.length; ++i)
    - { this$1.markers[i].clear(); }
    - signalLater(this, "clear");
    - };
    -
    - SharedTextMarker.prototype.find = function (side, lineObj) {
    - return this.primary.find(side, lineObj)
    - };
    - eventMixin(SharedTextMarker);
    -
    - function markTextShared(doc, from, to, options, type) {
    - options = copyObj(options);
    - options.shared = false;
    - var markers = arkText(doc, from, to, options, type)], primary = markers[0];
    - var widget = options.widgetNode;
    - linkedDocs(doc, function (doc) {
    - if (widget) { options.widgetNode = widget.cloneNode(true); }
    - markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
    - for (var i = 0; i < doc.linked.length; ++i)
    - { if (doc.linked[i].isParent) { return } }
    - primary = lst(markers);
    - });
    - return new SharedTextMarker(markers, primary)
    - }
    -
    - function findSharedMarkers(doc) {
    - return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })
    - }
    -
    - function copySharedMarkers(doc, markers) {
    - for (var i = 0; i < markers.length; i++) {
    - var marker = markers[i], pos = marker.find();
    - var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);
    - if (cmp(mFrom, mTo)) {
    - var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);
    - marker.markers.push(subMark);
    - subMark.parent = marker;
    - }
    - }
    - }
    -
    - function detachSharedMarkers(markers) {
    - var loop = function ( i ) {
    - var marker = markers[i], linked = arker.primary.doc];
    - linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });
    - for (var j = 0; j < marker.markers.length; j++) {
    - var subMarker = marker.markers[j];
    - if (indexOf(linked, subMarker.doc) == -1) {
    - subMarker.parent = null;
    - marker.markers.splice(j--, 1);
    - }
    - }
    - };
    -
    - for (var i = 0; i < markers.length; i++) loop( i );
    - }
    -
    - var nextDocId = 0;
    - var Doc = function(text, mode, firstLine, lineSep, direction) {
    - if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
    - if (firstLine == null) { firstLine = 0; }
    -
    - BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
    - this.first = firstLine;
    - this.scrollTop = this.scrollLeft = 0;
    - this.cantEdit = false;
    - this.cleanGeneration = 1;
    - this.modeFrontier = this.highlightFrontier = firstLine;
    - var start = Pos(firstLine, 0);
    - this.sel = simpleSelection(start);
    - this.history = new History(null);
    - this.id = ++nextDocId;
    - this.modeOption = mode;
    - this.lineSep = lineSep;
    - this.direction = (direction == "rtl") ? "rtl" : "ltr";
    - this.extend = false;
    -
    - if (typeof text == "string") { text = this.splitLines(text); }
    - updateDoc(this, {from: start, to: start, text: text});
    - setSelection(this, simpleSelection(start), sel_dontScroll);
    - };
    -
    - Doc.prototype = createObj(BranchChunk.prototype, {
    - constructor: Doc,
    - // Iterate over the document. Supports two forms -- with only one
    - // argument, it calls that for each line in the document. With
    - // three, it iterates over the range given by the first two (with
    - // the second being non-inclusive).
    - iter: function(from, to, op) {
    - if (op) { this.iterN(from - this.first, to - from, op); }
    - else { this.iterN(this.first, this.first + this.size, from); }
    - },
    -
    - // Non-public interface for adding and removing lines.
    - insert: function(at, lines) {
    - var height = 0;
    - for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }
    - this.insertInner(at - this.first, lines, height);
    - },
    - remove: function(at, n) { this.removeInner(at - this.first, n); },
    -
    - // From here, the methods are part of the public interface. Most
    - // are also available from CodeMirror (editor) instances.
    -
    - getValue: function(lineSep) {
    - var lines = getLines(this, this.first, this.first + this.size);
    - if (lineSep === false) { return lines }
    - return lines.join(lineSep || this.lineSeparator())
    - },
    - setValue: docMethodOp(function(code) {
    - var top = Pos(this.first, 0), last = this.first + this.size - 1;
    - makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
    - text: this.splitLines(code), origin: "setValue", full: true}, true);
    - if (this.cm) { scrollToCoords(this.cm, 0, 0); }
    - setSelection(this, simpleSelection(top), sel_dontScroll);
    - }),
    - replaceRange: function(code, from, to, origin) {
    - from = clipPos(this, from);
    - to = to ? clipPos(this, to) : from;
    - replaceRange(this, code, from, to, origin);
    - },
    - getRange: function(from, to, lineSep) {
    - var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
    - if (lineSep === false) { return lines }
    - return lines.join(lineSep || this.lineSeparator())
    - },
    -
    - getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},
    -
    - getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
    - getLineNumber: function(line) {return lineNo(line)},
    -
    - getLineHandleVisualStart: function(line) {
    - if (typeof line == "number") { line = getLine(this, line); }
    - return visualLine(line)
    - },
    -
    - lineCount: function() {return this.size},
    - firstLine: function() {return this.first},
    - lastLine: function() {return this.first + this.size - 1},
    -
    - clipPos: function(pos) {return clipPos(this, pos)},
    -
    - getCursor: function(start) {
    - var range$$1 = this.sel.primary(), pos;
    - if (start == null || start == "head") { pos = range$$1.head; }
    - else if (start == "anchor") { pos = range$$1.anchor; }
    - else if (start == "end" || start == "to" || start === false) { pos = range$$1.to(); }
    - else { pos = range$$1.from(); }
    - return pos
    - },
    - listSelections: function() { return this.sel.ranges },
    - somethingSelected: function() {return this.sel.somethingSelected()},
    -
    - setCursor: docMethodOp(function(line, ch, options) {
    - setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options);
    - }),
    - setSelection: docMethodOp(function(anchor, head, options) {
    - setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);
    - }),
    - extendSelection: docMethodOp(function(head, other, options) {
    - extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
    - }),
    - extendSelections: docMethodOp(function(heads, options) {
    - extendSelections(this, clipPosArray(this, heads), options);
    - }),
    - extendSelectionsBy: docMethodOp(function(f, options) {
    - var heads = map(this.sel.ranges, f);
    - extendSelections(this, clipPosArray(this, heads), options);
    - }),
    - setSelections: docMethodOp(function(ranges, primary, options) {
    - var this$1 = this;
    -
    - if (!ranges.length) { return }
    - var out = [];
    - for (var i = 0; i < ranges.length; i++)
    - { out[i] = new Range(clipPos(this$1, ranges[i].anchor),
    - clipPos(this$1, ranges[i].head)); }
    - if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }
    - setSelection(this, normalizeSelection(this.cm, out, primary), options);
    - }),
    - addSelection: docMethodOp(function(anchor, head, options) {
    - var ranges = this.sel.ranges.slice(0);
    - ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));
    - setSelection(this, normalizeSelection(this.cm, ranges, ranges.length - 1), options);
    - }),
    -
    - getSelection: function(lineSep) {
    - var this$1 = this;
    -
    - var ranges = this.sel.ranges, lines;
    - for (var i = 0; i < ranges.length; i++) {
    - var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
    - lines = lines ? lines.concat(sel) : sel;
    - }
    - if (lineSep === false) { return lines }
    - else { return lines.join(lineSep || this.lineSeparator()) }
    - },
    - getSelections: function(lineSep) {
    - var this$1 = this;
    -
    - var parts = [], ranges = this.sel.ranges;
    - for (var i = 0; i < ranges.length; i++) {
    - var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
    - if (lineSep !== false) { sel = sel.join(lineSep || this$1.lineSeparator()); }
    - parts[i] = sel;
    - }
    - return parts
    - },
    - replaceSelection: function(code, collapse, origin) {
    - var dup = [];
    - for (var i = 0; i < this.sel.ranges.length; i++)
    - { dup[i] = code; }
    - this.replaceSelections(dup, collapse, origin || "+input");
    - },
    - replaceSelections: docMethodOp(function(code, collapse, origin) {
    - var this$1 = this;
    -
    - var changes = [], sel = this.sel;
    - for (var i = 0; i < sel.ranges.length; i++) {
    - var range$$1 = sel.ranges[i];
    - changes[i] = {from: range$$1.from(), to: range$$1.to(), text: this$1.splitLines(code[i]), origin: origin};
    - }
    - var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
    - for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
    - { makeChange(this$1, changes[i$1]); }
    - if (newSel) { setSelectionReplaceHistory(this, newSel); }
    - else if (this.cm) { ensureCursorVisible(this.cm); }
    - }),
    - undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}),
    - redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}),
    - undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}),
    - redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}),
    -
    - setExtending: function(val) {this.extend = val;},
    - getExtending: function() {return this.extend},
    -
    - historySize: function() {
    - var hist = this.history, done = 0, undone = 0;
    - for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }
    - for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }
    - return {undo: done, redo: undone}
    - },
    - clearHistory: function() {this.history = new History(this.history.maxGeneration);},
    -
    - markClean: function() {
    - this.cleanGeneration = this.changeGeneration(true);
    - },
    - changeGeneration: function(forceSplit) {
    - if (forceSplit)
    - { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }
    - return this.history.generation
    - },
    - isClean: function (gen) {
    - return this.history.generation == (gen || this.cleanGeneration)
    - },
    -
    - getHistory: function() {
    - return {done: copyHistoryArray(this.history.done),
    - undone: copyHistoryArray(this.history.undone)}
    - },
    - setHistory: function(histData) {
    - var hist = this.history = new History(this.history.maxGeneration);
    - hist.done = copyHistoryArray(histData.done.slice(0), null, true);
    - hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);
    - },
    -
    - setGutterMarker: docMethodOp(function(line, gutterID, value) {
    - return changeLine(this, line, "gutter", function (line) {
    - var markers = line.gutterMarkers || (line.gutterMarkers = {});
    - markers[gutterID] = value;
    - if (!value && isEmpty(markers)) { line.gutterMarkers = null; }
    - return true
    - })
    - }),
    -
    - clearGutter: docMethodOp(function(gutterID) {
    - var this$1 = this;
    -
    - this.iter(function (line) {
    - if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
    - changeLine(this$1, line, "gutter", function () {
    - line.gutterMarkers[gutterID] = null;
    - if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }
    - return true
    - });
    - }
    - });
    - }),
    -
    - lineInfo: function(line) {
    - var n;
    - if (typeof line == "number") {
    - if (!isLine(this, line)) { return null }
    - n = line;
    - line = getLine(this, line);
    - if (!line) { return null }
    - } else {
    - n = lineNo(line);
    - if (n == null) { return null }
    - }
    - return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
    - textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
    - widgets: line.widgets}
    - },
    -
    - addLineClass: docMethodOp(function(handle, where, cls) {
    - return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
    - var prop = where == "text" ? "textClass"
    - : where == "background" ? "bgClass"
    - : where == "gutter" ? "gutterClass" : "wrapClass";
    - if (!line[prop]) { line[prop] = cls; }
    - else if (classTest(cls).test(line[prop])) { return false }
    - else { line[prop] += " " + cls; }
    - return true
    - })
    - }),
    - removeLineClass: docMethodOp(function(handle, where, cls) {
    - return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
    - var prop = where == "text" ? "textClass"
    - : where == "background" ? "bgClass"
    - : where == "gutter" ? "gutterClass" : "wrapClass";
    - var cur = line[prop];
    - if (!cur) { return false }
    - else if (cls == null) { line[prop] = null; }
    - else {
    - var found = cur.match(classTest(cls));
    - if (!found) { return false }
    - var end = found.index + found[0].length;
    - line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null;
    - }
    - return true
    - })
    - }),
    -
    - addLineWidget: docMethodOp(function(handle, node, options) {
    - return addLineWidget(this, handle, node, options)
    - }),
    - removeLineWidget: function(widget) { widget.clear(); },
    -
    - markText: function(from, to, options) {
    - return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range")
    - },
    - setBookmark: function(pos, options) {
    - var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
    - insertLeft: options && options.insertLeft,
    - clearWhenEmpty: false, shared: options && options.shared,
    - handleMouseEvents: options && options.handleMouseEvents};
    - pos = clipPos(this, pos);
    - return markText(this, pos, pos, realOpts, "bookmark")
    - },
    - findMarksAt: function(pos) {
    - pos = clipPos(this, pos);
    - var markers = [], spans = getLine(this, pos.line).markedSpans;
    - if (spans) { for (var i = 0; i < spans.length; ++i) {
    - var span = spans[i];
    - if ((span.from == null || span.from <= pos.ch) &&
    - (span.to == null || span.to >= pos.ch))
    - { markers.push(span.marker.parent || span.marker); }
    - } }
    - return markers
    - },
    - findMarks: function(from, to, filter) {
    - from = clipPos(this, from); to = clipPos(this, to);
    - var found = [], lineNo$$1 = from.line;
    - this.iter(from.line, to.line + 1, function (line) {
    - var spans = line.markedSpans;
    - if (spans) { for (var i = 0; i < spans.length; i++) {
    - var span = spans[i];
    - if (!(span.to != null && lineNo$$1 == from.line && from.ch >= span.to ||
    - span.from == null && lineNo$$1 != from.line ||
    - span.from != null && lineNo$$1 == to.line && span.from >= to.ch) &&
    - (!filter || filter(span.marker)))
    - { found.push(span.marker.parent || span.marker); }
    - } }
    - ++lineNo$$1;
    - });
    - return found
    - },
    - getAllMarks: function() {
    - var markers = [];
    - this.iter(function (line) {
    - var sps = line.markedSpans;
    - if (sps) { for (var i = 0; i < sps.length; ++i)
    - { if (sps[i].from != null) { markers.push(sps[i].marker); } } }
    - });
    - return markers
    - },
    -
    - posFromIndex: function(off) {
    - var ch, lineNo$$1 = this.first, sepSize = this.lineSeparator().length;
    - this.iter(function (line) {
    - var sz = line.text.length + sepSize;
    - if (sz > off) { ch = off; return true }
    - off -= sz;
    - ++lineNo$$1;
    - });
    - return clipPos(this, Pos(lineNo$$1, ch))
    - },
    - indexFromPos: function (coords) {
    - coords = clipPos(this, coords);
    - var index = coords.ch;
    - if (coords.line < this.first || coords.ch < 0) { return 0 }
    - var sepSize = this.lineSeparator().length;
    - this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value
    - index += line.text.length + sepSize;
    - });
    - return index
    - },
    -
    - copy: function(copyHistory) {
    - var doc = new Doc(getLines(this, this.first, this.first + this.size),
    - this.modeOption, this.first, this.lineSep, this.direction);
    - doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
    - doc.sel = this.sel;
    - doc.extend = false;
    - if (copyHistory) {
    - doc.history.undoDepth = this.history.undoDepth;
    - doc.setHistory(this.getHistory());
    - }
    - return doc
    - },
    -
    - linkedDoc: function(options) {
    - if (!options) { options = {}; }
    - var from = this.first, to = this.first + this.size;
    - if (options.from != null && options.from > from) { from = options.from; }
    - if (options.to != null && options.to < to) { to = options.to; }
    - var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);
    - if (options.sharedHist) { copy.history = this.history
    - ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
    - copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
    - copySharedMarkers(copy, findSharedMarkers(this));
    - return copy
    - },
    - unlinkDoc: function(other) {
    - var this$1 = this;
    -
    - if (other instanceof CodeMirror) { other = other.doc; }
    - if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
    - var link = this$1.linked[i];
    - if (link.doc != other) { continue }
    - this$1.linked.splice(i, 1);
    - other.unlinkDoc(this$1);
    - detachSharedMarkers(findSharedMarkers(this$1));
    - break
    - } }
    - // If the histories were shared, split them again
    - if (other.history == this.history) {
    - var splitIds = [other.id];
    - linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);
    - other.history = new History(null);
    - other.history.done = copyHistoryArray(this.history.done, splitIds);
    - other.history.undone = copyHistoryArray(this.history.undone, splitIds);
    - }
    - },
    - iterLinkedDocs: function(f) {linkedDocs(this, f);},
    -
    - getMode: function() {return this.mode},
    - getEditor: function() {return this.cm},
    -
    - splitLines: function(str) {
    - if (this.lineSep) { return str.split(this.lineSep) }
    - return splitLinesAuto(str)
    - },
    - lineSeparator: function() { return this.lineSep || "\n" },
    -
    - setDirection: docMethodOp(function (dir) {
    - if (dir != "rtl") { dir = "ltr"; }
    - if (dir == this.direction) { return }
    - this.direction = dir;
    - this.iter(function (line) { return line.order = null; });
    - if (this.cm) { directionChanged(this.cm); }
    - })
    - });
    -
    - // Public alias.
    - Doc.prototype.eachLine = Doc.prototype.iter;
    -
    - // Kludge to work around strange IE behavior where it'll sometimes
    - // re-fire a series of drag-related events right after the drop (#1551)
    - var lastDrop = 0;
    -
    - function onDrop(e) {
    - var cm = this;
    - clearDragCursor(cm);
    - if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
    - { return }
    - e_preventDefault(e);
    - if (ie) { lastDrop = +new Date; }
    - var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
    - if (!pos || cm.isReadOnly()) { return }
    - // Might be a file drop, in which case we simply extract the text
    - // and insert it.
    - if (files && files.length && window.FileReader && window.File) {
    - var n = files.length, text = Array(n), read = 0;
    - var loadFile = function (file, i) {
    - if (cm.options.allowDropFileTypes &&
    - indexOf(cm.options.allowDropFileTypes, file.type) == -1)
    - { return }
    -
    - var reader = new FileReader;
    - reader.onload = operation(cm, function () {
    - var content = reader.result;
    - if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { content = ""; }
    - text[i] = content;
    - if (++read == n) {
    - pos = clipPos(cm.doc, pos);
    - var change = {from: pos, to: pos,
    - text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),
    - origin: "paste"};
    - makeChange(cm.doc, change);
    - setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));
    - }
    - });
    - reader.readAsText(file);
    - };
    - for (var i = 0; i < n; ++i) { loadFile(files[i], i); }
    - } else { // Normal drop
    - // Don't do a replace if the drop happened inside of the selected text.
    - if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
    - cm.state.draggingText(e);
    - // Ensure the editor is re-focused
    - setTimeout(function () { return cm.display.input.focus(); }, 20);
    - return
    - }
    - try {
    - var text$1 = e.dataTransfer.getData("Text");
    - if (text$1) {
    - var selected;
    - if (cm.state.draggingText && !cm.state.draggingText.copy)
    - { selected = cm.listSelections(); }
    - setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
    - if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)
    - { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); } }
    - cm.replaceSelection(text$1, "around", "paste");
    - cm.display.input.focus();
    - }
    - }
    - catch(e){}
    - }
    - }
    -
    - function onDragStart(cm, e) {
    - if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
    - if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }
    -
    - e.dataTransfer.setData("Text", cm.getSelection());
    - e.dataTransfer.effectAllowed = "copyMove";
    -
    - // Use dummy image instead of default browsers image.
    - // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
    - if (e.dataTransfer.setDragImage && !safari) {
    - var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
    - img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
    - if (presto) {
    - img.width = img.height = 1;
    - cm.display.wrapper.appendChild(img);
    - // Force a relayout, or Opera won't use our image for some obscure reason
    - img._top = img.offsetTop;
    - }
    - e.dataTransfer.setDragImage(img, 0, 0);
    - if (presto) { img.parentNode.removeChild(img); }
    - }
    - }
    -
    - function onDragOver(cm, e) {
    - var pos = posFromMouse(cm, e);
    - if (!pos) { return }
    - var frag = document.createDocumentFragment();
    - drawSelectionCursor(cm, pos, frag);
    - if (!cm.display.dragCursor) {
    - cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors");
    - cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);
    - }
    - removeChildrenAndAdd(cm.display.dragCursor, frag);
    - }
    -
    - function clearDragCursor(cm) {
    - if (cm.display.dragCursor) {
    - cm.display.lineSpace.removeChild(cm.display.dragCursor);
    - cm.display.dragCursor = null;
    - }
    - }
    -
    - // These must be handled carefully, because naively registering a
    - // handler for each editor will cause the editors to never be
    - // garbage collected.
    -
    - function forEachCodeMirror(f) {
    - if (!document.getElementsByClassName) { return }
    - var byClass = document.getElementsByClassName("CodeMirror"), editors = [];
    - for (var i = 0; i < byClass.length; i++) {
    - var cm = byClass[i].CodeMirror;
    - if (cm) { editors.push(cm); }
    - }
    - if (editors.length) { editors[0].operation(function () {
    - for (var i = 0; i < editors.length; i++) { f(editors[i]); }
    - }); }
    - }
    -
    - var globalsRegistered = false;
    - function ensureGlobalHandlers() {
    - if (globalsRegistered) { return }
    - registerGlobalHandlers();
    - globalsRegistered = true;
    - }
    - function registerGlobalHandlers() {
    - // When the window resizes, we need to refresh active editors.
    - var resizeTimer;
    - on(window, "resize", function () {
    - if (resizeTimer == null) { resizeTimer = setTimeout(function () {
    - resizeTimer = null;
    - forEachCodeMirror(onResize);
    - }, 100); }
    - });
    - // When the window loses focus, we want to show the editor as blurred
    - on(window, "blur", function () { return forEachCodeMirror(onBlur); });
    - }
    - // Called when the window resizes
    - function onResize(cm) {
    - var d = cm.display;
    - // Might be a text scaling operation, clear size caches.
    - d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
    - d.scrollbarsClipped = false;
    - cm.setSize();
    - }
    -
    - var keyNames = {
    - 3: "Pause", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
    - 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
    - 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
    - 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
    - 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 145: "ScrollLock",
    - 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
    - 221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
    - 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
    - };
    -
    - // Number keys
    - for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }
    - // Alphabetic keys
    - for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }
    - // Function keys
    - for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2; }
    -
    - var keyMap = {};
    -
    - keyMap.basic = {
    - "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
    - "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
    - "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
    - "Tab": "defaultTab", "Shift-Tab": "indentAuto",
    - "Enter": "newlineAndIndent", "Insert": "toggleOverwrite",
    - "Esc": "singleSelection"
    - };
    - // Note that the save and find-related commands aren't defined by
    - // default. User code or addons can define them. Unknown commands
    - // are simply ignored.
    - keyMap.pcDefault = {
    - "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
    - "Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown",
    - "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
    - "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
    - "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
    - "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
    - "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection",
    - "fallthrough": "basic"
    - };
    - // Very basic readline/emacs-style bindings, which are standard on Mac.
    - keyMap.emacsy = {
    - "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
    - "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
    - "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
    - "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars",
    - "Ctrl-O": "openLine"
    - };
    - keyMap.macDefault = {
    - "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
    - "Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
    - "Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore",
    - "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
    - "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
    - "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight",
    - "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd",
    - "fallthrough": ["basic", "emacsy"]
    - };
    - keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
    -
    - // KEYMAP DISPATCH
    -
    - function normalizeKeyName(name) {
    - var parts = name.split(/-(?!$)/);
    - name = parts[parts.length - 1];
    - var alt, ctrl, shift, cmd;
    - for (var i = 0; i < parts.length - 1; i++) {
    - var mod = parts[i];
    - if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }
    - else if (/^a(lt)?$/i.test(mod)) { alt = true; }
    - else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }
    - else if (/^s(hift)?$/i.test(mod)) { shift = true; }
    - else { throw new Error("Unrecognized modifier name: " + mod) }
    - }
    - if (alt) { name = "Alt-" + name; }
    - if (ctrl) { name = "Ctrl-" + name; }
    - if (cmd) { name = "Cmd-" + name; }
    - if (shift) { name = "Shift-" + name; }
    - return name
    - }
    -
    - // This is a kludge to keep keymaps mostly working as raw objects
    - // (backwards compatibility) while at the same time support features
    - // like normalization and multi-stroke key bindings. It compiles a
    - // new normalized keymap, and then updates the old object to reflect
    - // this.
    - function normalizeKeyMap(keymap) {
    - var copy = {};
    - for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {
    - var value = keymap[keyname];
    - if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }
    - if (value == "...") { delete keymap[keyname]; continue }
    -
    - var keys = map(keyname.split(" "), normalizeKeyName);
    - for (var i = 0; i < keys.length; i++) {
    - var val = (void 0), name = (void 0);
    - if (i == keys.length - 1) {
    - name = keys.join(" ");
    - val = value;
    - } else {
    - name = keys.slice(0, i + 1).join(" ");
    - val = "...";
    - }
    - var prev = copy[name];
    - if (!prev) { copy[name] = val; }
    - else if (prev != val) { throw new Error("Inconsistent bindings for " + name) }
    - }
    - delete keymap[keyname];
    - } }
    - for (var prop in copy) { keymap[prop] = copy[prop]; }
    - return keymap
    - }
    -
    - function lookupKey(key, map$$1, handle, context) {
    - map$$1 = getKeyMap(map$$1);
    - var found = map$$1.call ? map$$1.call(key, context) : map$$1[key];
    - if (found === false) { return "nothing" }
    - if (found === "...") { return "multi" }
    - if (found != null && handle(found)) { return "handled" }
    -
    - if (map$$1.fallthrough) {
    - if (Object.prototype.toString.call(map$$1.fallthrough) != "[object Array]")
    - { return lookupKey(key, map$$1.fallthrough, handle, context) }
    - for (var i = 0; i < map$$1.fallthrough.length; i++) {
    - var result = lookupKey(key, map$$1.fallthrough[i], handle, context);
    - if (result) { return result }
    - }
    - }
    - }
    -
    - // Modifier key presses don't count as 'real' key presses for the
    - // purpose of keymap fallthrough.
    - function isModifierKey(value) {
    - var name = typeof value == "string" ? value : keyNames[value.keyCode];
    - return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"
    - }
    -
    - function addModifierNames(name, event, noShift) {
    - var base = name;
    - if (event.altKey && base != "Alt") { name = "Alt-" + name; }
    - if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name; }
    - if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") { name = "Cmd-" + name; }
    - if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name; }
    - return name
    - }
    -
    - // Look up the name of a key as indicated by an event object.
    - function keyName(event, noShift) {
    - if (presto && event.keyCode == 34 && event["char"]) { return false }
    - var name = keyNames[event.keyCode];
    - if (name == null || event.altGraphKey) { return false }
    - // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,
    - // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)
    - if (event.keyCode == 3 && event.code) { name = event.code; }
    - return addModifierNames(name, event, noShift)
    - }
    -
    - function getKeyMap(val) {
    - return typeof val == "string" ? keyMap[val] : val
    - }
    -
    - // Helper for deleting text near the selection(s), used to implement
    - // backspace, delete, and similar functionality.
    - function deleteNearSelection(cm, compute) {
    - var ranges = cm.doc.sel.ranges, kill = [];
    - // Build up a set of ranges to kill first, merging overlapping
    - // ranges.
    - for (var i = 0; i < ranges.length; i++) {
    - var toKill = compute(ranges[i]);
    - while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
    - var replaced = kill.pop();
    - if (cmp(replaced.from, toKill.from) < 0) {
    - toKill.from = replaced.from;
    - break
    - }
    - }
    - kill.push(toKill);
    - }
    - // Next, remove those actual ranges.
    - runInOp(cm, function () {
    - for (var i = kill.length - 1; i >= 0; i--)
    - { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); }
    - ensureCursorVisible(cm);
    - });
    - }
    -
    - function moveCharLogically(line, ch, dir) {
    - var target = skipExtendingChars(line.text, ch + dir, dir);
    - return target < 0 || target > line.text.length ? null : target
    - }
    -
    - function moveLogically(line, start, dir) {
    - var ch = moveCharLogically(line, start.ch, dir);
    - return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
    - }
    -
    - function endOfLine(visually, cm, lineObj, lineNo, dir) {
    - if (visually) {
    - var order = getOrder(lineObj, cm.doc.direction);
    - if (order) {
    - var part = dir < 0 ? lst(order) : order[0];
    - var moveInStorageOrder = (dir < 0) == (part.level == 1);
    - var sticky = moveInStorageOrder ? "after" : "before";
    - var ch;
    - // With a wrapped rtl chunk (possibly spanning multiple bidi parts),
    - // it could be that the last bidi part is not on the last visual line,
    - // since visual lines contain content order-consecutive chunks.
    - // Thus, in rtl, we are looking for the first (content-order) character
    - // in the rtl chunk that is on the last line (that is, the same line
    - // as the last (content-order) character).
    - if (part.level > 0 || cm.doc.direction == "rtl") {
    - var prep = prepareMeasureForLine(cm, lineObj);
    - ch = dir < 0 ? lineObj.text.length - 1 : 0;
    - var targetTop = measureCharPrepared(cm, prep, ch).top;
    - ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);
    - if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1); }
    - } else { ch = dir < 0 ? part.to : part.from; }
    - return new Pos(lineNo, ch, sticky)
    - }
    - }
    - return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
    - }
    -
    - function moveVisually(cm, line, start, dir) {
    - var bidi = getOrder(line, cm.doc.direction);
    - if (!bidi) { return moveLogically(line, start, dir) }
    - if (start.ch >= line.text.length) {
    - start.ch = line.text.length;
    - start.sticky = "before";
    - } else if (start.ch <= 0) {
    - start.ch = 0;
    - start.sticky = "after";
    - }
    - var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];
    - if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
    - // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
    - // nothing interesting happens.
    - return moveLogically(line, start, dir)
    - }
    -
    - var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };
    - var prep;
    - var getWrappedLineExtent = function (ch) {
    - if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }
    - prep = prep || prepareMeasureForLine(cm, line);
    - return wrappedLineExtentChar(cm, line, prep, ch)
    - };
    - var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch);
    -
    - if (cm.doc.direction == "rtl" || part.level == 1) {
    - var moveInStorageOrder = (part.level == 1) == (dir < 0);
    - var ch = mv(start, moveInStorageOrder ? 1 : -1);
    - if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
    - // Case 2: We move within an rtl part or in an rtl editor on the same visual line
    - var sticky = moveInStorageOrder ? "before" : "after";
    - return new Pos(start.line, ch, sticky)
    - }
    - }
    -
    - // Case 3: Could not move within this bidi part in this visual line, so leave
    - // the current bidi part
    -
    - var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {
    - var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder
    - ? new Pos(start.line, mv(ch, 1), "before")
    - : new Pos(start.line, ch, "after"); };
    -
    - for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
    - var part = bidi[partPos];
    - var moveInStorageOrder = (dir > 0) == (part.level != 1);
    - var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);
    - if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }
    - ch = moveInStorageOrder ? part.from : mv(part.to, -1);
    - if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }
    - }
    - };
    -
    - // Case 3a: Look for other bidi parts on the same visual line
    - var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);
    - if (res) { return res }
    -
    - // Case 3b: Look for other bidi parts on the next visual line
    - var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);
    - if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
    - res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));
    - if (res) { return res }
    - }
    -
    - // Case 4: Nowhere to move
    - return null
    - }
    -
    - // Commands are parameter-less actions that can be performed on an
    - // editor, mostly used for keybindings.
    - var commands = {
    - selectAll: selectAll,
    - singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); },
    - killLine: function (cm) { return deleteNearSelection(cm, function (range) {
    - if (range.empty()) {
    - var len = getLine(cm.doc, range.head.line).text.length;
    - if (range.head.ch == len && range.head.line < cm.lastLine())
    - { return {from: range.head, to: Pos(range.head.line + 1, 0)} }
    - else
    - { return {from: range.head, to: Pos(range.head.line, len)} }
    - } else {
    - return {from: range.from(), to: range.to()}
    - }
    - }); },
    - deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({
    - from: Pos(range.from().line, 0),
    - to: clipPos(cm.doc, Pos(range.to().line + 1, 0))
    - }); }); },
    - delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({
    - from: Pos(range.from().line, 0), to: range.from()
    - }); }); },
    - delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {
    - var top = cm.charCoords(range.head, "div").top + 5;
    - var leftPos = cm.coordsChar({left: 0, top: top}, "div");
    - return {from: leftPos, to: range.from()}
    - }); },
    - delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {
    - var top = cm.charCoords(range.head, "div").top + 5;
    - var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div");
    - return {from: range.from(), to: rightPos }
    - }); },
    - undo: function (cm) { return cm.undo(); },
    - redo: function (cm) { return cm.redo(); },
    - undoSelection: function (cm) { return cm.undoSelection(); },
    - redoSelection: function (cm) { return cm.redoSelection(); },
    - goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },
    - goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },
    - goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },
    - {origin: "+move", bias: 1}
    - ); },
    - goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },
    - {origin: "+move", bias: 1}
    - ); },
    - goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },
    - {origin: "+move", bias: -1}
    - ); },
    - goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {
    - var top = cm.cursorCoords(range.head, "div").top + 5;
    - return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
    - }, sel_move); },
    - goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {
    - var top = cm.cursorCoords(range.head, "div").top + 5;
    - return cm.coordsChar({left: 0, top: top}, "div")
    - }, sel_move); },
    - goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {
    - var top = cm.cursorCoords(range.head, "div").top + 5;
    - var pos = cm.coordsChar({left: 0, top: top}, "div");
    - if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) }
    - return pos
    - }, sel_move); },
    - goLineUp: function (cm) { return cm.moveV(-1, "line"); },
    - goLineDown: function (cm) { return cm.moveV(1, "line"); },
    - goPageUp: function (cm) { return cm.moveV(-1, "page"); },
    - goPageDown: function (cm) { return cm.moveV(1, "page"); },
    - goCharLeft: function (cm) { return cm.moveH(-1, "char"); },
    - goCharRight: function (cm) { return cm.moveH(1, "char"); },
    - goColumnLeft: function (cm) { return cm.moveH(-1, "column"); },
    - goColumnRight: function (cm) { return cm.moveH(1, "column"); },
    - goWordLeft: function (cm) { return cm.moveH(-1, "word"); },
    - goGroupRight: function (cm) { return cm.moveH(1, "group"); },
    - goGroupLeft: function (cm) { return cm.moveH(-1, "group"); },
    - goWordRight: function (cm) { return cm.moveH(1, "word"); },
    - delCharBefore: function (cm) { return cm.deleteH(-1, "char"); },
    - delCharAfter: function (cm) { return cm.deleteH(1, "char"); },
    - delWordBefore: function (cm) { return cm.deleteH(-1, "word"); },
    - delWordAfter: function (cm) { return cm.deleteH(1, "word"); },
    - delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); },
    - delGroupAfter: function (cm) { return cm.deleteH(1, "group"); },
    - indentAuto: function (cm) { return cm.indentSelection("smart"); },
    - indentMore: function (cm) { return cm.indentSelection("add"); },
    - indentLess: function (cm) { return cm.indentSelection("subtract"); },
    - insertTab: function (cm) { return cm.replaceSelection("\t"); },
    - insertSoftTab: function (cm) {
    - var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;
    - for (var i = 0; i < ranges.length; i++) {
    - var pos = ranges[i].from();
    - var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);
    - spaces.push(spaceStr(tabSize - col % tabSize));
    - }
    - cm.replaceSelections(spaces);
    - },
    - defaultTab: function (cm) {
    - if (cm.somethingSelected()) { cm.indentSelection("add"); }
    - else { cm.execCommand("insertTab"); }
    - },
    - // Swap the two chars left and right of each selection's head.
    - // Move cursor behind the two swapped characters afterwards.
    - //
    - // Doesn't consider line feeds a character.
    - // Doesn't scan more than one line above to find a character.
    - // Doesn't do anything on an empty line.
    - // Doesn't do anything with non-empty selections.
    - transposeChars: function (cm) { return runInOp(cm, function () {
    - var ranges = cm.listSelections(), newSel = [];
    - for (var i = 0; i < ranges.length; i++) {
    - if (!ranges[i].empty()) { continue }
    - var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;
    - if (line) {
    - if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); }
    - if (cur.ch > 0) {
    - cur = new Pos(cur.line, cur.ch + 1);
    - cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),
    - Pos(cur.line, cur.ch - 2), cur, "+transpose");
    - } else if (cur.line > cm.doc.first) {
    - var prev = getLine(cm.doc, cur.line - 1).text;
    - if (prev) {
    - cur = new Pos(cur.line, 1);
    - cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +
    - prev.charAt(prev.length - 1),
    - Pos(cur.line - 1, prev.length - 1), cur, "+transpose");
    - }
    - }
    - }
    - newSel.push(new Range(cur, cur));
    - }
    - cm.setSelections(newSel);
    - }); },
    - newlineAndIndent: function (cm) { return runInOp(cm, function () {
    - var sels = cm.listSelections();
    - for (var i = sels.length - 1; i >= 0; i--)
    - { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input"); }
    - sels = cm.listSelections();
    - for (var i$1 = 0; i$1 < sels.length; i$1++)
    - { cm.indentLine(sels[i$1].from().line, null, true); }
    - ensureCursorVisible(cm);
    - }); },
    - openLine: function (cm) { return cm.replaceSelection("\n", "start"); },
    - toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }
    - };
    -
    -
    - function lineStart(cm, lineN) {
    - var line = getLine(cm.doc, lineN);
    - var visual = visualLine(line);
    - if (visual != line) { lineN = lineNo(visual); }
    - return endOfLine(true, cm, visual, lineN, 1)
    - }
    - function lineEnd(cm, lineN) {
    - var line = getLine(cm.doc, lineN);
    - var visual = visualLineEnd(line);
    - if (visual != line) { lineN = lineNo(visual); }
    - return endOfLine(true, cm, line, lineN, -1)
    - }
    - function lineStartSmart(cm, pos) {
    - var start = lineStart(cm, pos.line);
    - var line = getLine(cm.doc, start.line);
    - var order = getOrder(line, cm.doc.direction);
    - if (!order || order[0].level == 0) {
    - var firstNonWS = Math.max(0, line.text.search(/\S/));
    - var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;
    - return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
    - }
    - return start
    - }
    -
    - // Run a handler that was bound to a key.
    - function doHandleBinding(cm, bound, dropShift) {
    - if (typeof bound == "string") {
    - bound = commands[bound];
    - if (!bound) { return false }
    - }
    - // Ensure previous input has been read, so that the handler sees a
    - // consistent view of the document
    - cm.display.input.ensurePolled();
    - var prevShift = cm.display.shift, done = false;
    - try {
    - if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
    - if (dropShift) { cm.display.shift = false; }
    - done = bound(cm) != Pass;
    - } finally {
    - cm.display.shift = prevShift;
    - cm.state.suppressEdits = false;
    - }
    - return done
    - }
    -
    - function lookupKeyForEditor(cm, name, handle) {
    - for (var i = 0; i < cm.state.keyMaps.length; i++) {
    - var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);
    - if (result) { return result }
    - }
    - return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
    - || lookupKey(name, cm.options.keyMap, handle, cm)
    - }
    -
    - // Note that, despite the name, this function is also used to check
    - // for bound mouse clicks.
    -
    - var stopSeq = new Delayed;
    -
    - function dispatchKey(cm, name, e, handle) {
    - var seq = cm.state.keySeq;
    - if (seq) {
    - if (isModifierKey(name)) { return "handled" }
    - if (/\'$/.test(name))
    - { cm.state.keySeq = null; }
    - else
    - { stopSeq.set(50, function () {
    - if (cm.state.keySeq == seq) {
    - cm.state.keySeq = null;
    - cm.display.input.reset();
    - }
    - }); }
    - if (dispatchKeyInner(cm, seq + " " + name, e, handle)) { return true }
    - }
    - return dispatchKeyInner(cm, name, e, handle)
    - }
    -
    - function dispatchKeyInner(cm, name, e, handle) {
    - var result = lookupKeyForEditor(cm, name, handle);
    -
    - if (result == "multi")
    - { cm.state.keySeq = name; }
    - if (result == "handled")
    - { signalLater(cm, "keyHandled", cm, name, e); }
    -
    - if (result == "handled" || result == "multi") {
    - e_preventDefault(e);
    - restartBlink(cm);
    - }
    -
    - return !!result
    - }
    -
    - // Handle a key from the keydown event.
    - function handleKeyBinding(cm, e) {
    - var name = keyName(e, true);
    - if (!name) { return false }
    -
    - if (e.shiftKey && !cm.state.keySeq) {
    - // First try to resolve full name (including 'Shift-'). Failing
    - // that, see if there is a cursor-motion command (starting with
    - // 'go') bound to the keyname without 'Shift-'.
    - return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); })
    - || dispatchKey(cm, name, e, function (b) {
    - if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
    - { return doHandleBinding(cm, b) }
    - })
    - } else {
    - return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })
    - }
    - }
    -
    - // Handle a key from the keypress event
    - function handleCharBinding(cm, e, ch) {
    - return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); })
    - }
    -
    - var lastStoppedKey = null;
    - function onKeyDown(e) {
    - var cm = this;
    - cm.curOp.focus = activeElt();
    - if (signalDOMEvent(cm, e)) { return }
    - // IE does strange things with escape.
    - if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }
    - var code = e.keyCode;
    - cm.display.shift = code == 16 || e.shiftKey;
    - var handled = handleKeyBinding(cm, e);
    - if (presto) {
    - lastStoppedKey = handled ? code : null;
    - // Opera has no cut event... we try to at least catch the key combo
    - if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
    - { cm.replaceSelection("", null, "cut"); }
    - }
    -
    - // Turn mouse into crosshair when Alt is held on Mac.
    - if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
    - { showCrossHair(cm); }
    - }
    -
    - function showCrossHair(cm) {
    - var lineDiv = cm.display.lineDiv;
    - addClass(lineDiv, "CodeMirror-crosshair");
    -
    - function up(e) {
    - if (e.keyCode == 18 || !e.altKey) {
    - rmClass(lineDiv, "CodeMirror-crosshair");
    - off(document, "keyup", up);
    - off(document, "mouseover", up);
    - }
    - }
    - on(document, "keyup", up);
    - on(document, "mouseover", up);
    - }
    -
    - function onKeyUp(e) {
    - if (e.keyCode == 16) { this.doc.sel.shift = false; }
    - signalDOMEvent(this, e);
    - }
    -
    - function onKeyPress(e) {
    - var cm = this;
    - if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }
    - var keyCode = e.keyCode, charCode = e.charCode;
    - if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}
    - if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }
    - var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
    - // Some browsers fire keypress events for backspace
    - if (ch == "\x08") { return }
    - if (handleCharBinding(cm, e, ch)) { return }
    - cm.display.input.onKeyPress(e);
    - }
    -
    - var DOUBLECLICK_DELAY = 400;
    -
    - var PastClick = function(time, pos, button) {
    - this.time = time;
    - this.pos = pos;
    - this.button = button;
    - };
    -
    - PastClick.prototype.compare = function (time, pos, button) {
    - return this.time + DOUBLECLICK_DELAY > time &&
    - cmp(pos, this.pos) == 0 && button == this.button
    - };
    -
    - var lastClick, lastDoubleClick;
    - function clickRepeat(pos, button) {
    - var now = +new Date;
    - if (lastDoubleClick && lastDoubleClick.compare(now, pos, button)) {
    - lastClick = lastDoubleClick = null;
    - return "triple"
    - } else if (lastClick && lastClick.compare(now, pos, button)) {
    - lastDoubleClick = new PastClick(now, pos, button);
    - lastClick = null;
    - return "double"
    - } else {
    - lastClick = new PastClick(now, pos, button);
    - lastDoubleClick = null;
    - return "single"
    - }
    - }
    -
    - // A mouse down can be a single click, double click, triple click,
    - // start of selection drag, start of text drag, new cursor
    - // (ctrl-click), rectangle drag (alt-drag), or xwin
    - // middle-click-paste. Or it might be a click on something we should
    - // not interfere with, such as a scrollbar or widget.
    - function onMouseDown(e) {
    - var cm = this, display = cm.display;
    - if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }
    - display.input.ensurePolled();
    - display.shift = e.shiftKey;
    -
    - if (eventInWidget(display, e)) {
    - if (!webkit) {
    - // Briefly turn off draggability, to allow widgets to do
    - // normal dragging things.
    - display.scroller.draggable = false;
    - setTimeout(function () { return display.scroller.draggable = true; }, 100);
    - }
    - return
    - }
    - if (clickInGutter(cm, e)) { return }
    - var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : "single";
    - window.focus();
    -
    - // #3261: make sure, that we're not starting a second selection
    - if (button == 1 && cm.state.selectingText)
    - { cm.state.selectingText(e); }
    -
    - if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }
    -
    - if (button == 1) {
    - if (pos) { leftButtonDown(cm, pos, repeat, e); }
    - else if (e_target(e) == display.scroller) { e_preventDefault(e); }
    - } else if (button == 2) {
    - if (pos) { extendSelection(cm.doc, pos); }
    - setTimeout(function () { return display.input.focus(); }, 20);
    - } else if (button == 3) {
    - if (captureRightClick) { cm.display.input.onContextMenu(e); }
    - else { delayBlurEvent(cm); }
    - }
    - }
    -
    - function handleMappedButton(cm, button, pos, repeat, event) {
    - var name = "Click";
    - if (repeat == "double") { name = "Double" + name; }
    - else if (repeat == "triple") { name = "Triple" + name; }
    - name = (button == 1 ? "Left" : button == 2 ? "Middle" : "Right") + name;
    -
    - return dispatchKey(cm, addModifierNames(name, event), event, function (bound) {
    - if (typeof bound == "string") { bound = commands[bound]; }
    - if (!bound) { return false }
    - var done = false;
    - try {
    - if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
    - done = bound(cm, pos) != Pass;
    - } finally {
    - cm.state.suppressEdits = false;
    - }
    - return done
    - })
    - }
    -
    - function configureMouse(cm, repeat, event) {
    - var option = cm.getOption("configureMouse");
    - var value = option ? option(cm, repeat, event) : {};
    - if (value.unit == null) {
    - var rect = chromeOS ? event.shiftKey && event.metaKey : event.altKey;
    - value.unit = rect ? "rectangle" : repeat == "single" ? "char" : repeat == "double" ? "word" : "line";
    - }
    - if (value.extend == null || cm.doc.extend) { value.extend = cm.doc.extend || event.shiftKey; }
    - if (value.addNew == null) { value.addNew = mac ? event.metaKey : event.ctrlKey; }
    - if (value.moveOnDrag == null) { value.moveOnDrag = !(mac ? event.altKey : event.ctrlKey); }
    - return value
    - }
    -
    - function leftButtonDown(cm, pos, repeat, event) {
    - if (ie) { setTimeout(bind(ensureFocus, cm), 0); }
    - else { cm.curOp.focus = activeElt(); }
    -
    - var behavior = configureMouse(cm, repeat, event);
    -
    - var sel = cm.doc.sel, contained;
    - if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
    - repeat == "single" && (contained = sel.contains(pos)) > -1 &&
    - (cmp((contained = sel.ranges[contained]).from(), pos) < 0 || pos.xRel > 0) &&
    - (cmp(contained.to(), pos) > 0 || pos.xRel < 0))
    - { leftButtonStartDrag(cm, event, pos, behavior); }
    - else
    - { leftButtonSelect(cm, event, pos, behavior); }
    - }
    -
    - // Start a text drag. When it ends, see if any dragging actually
    - // happen, and treat as a click if it didn't.
    - function leftButtonStartDrag(cm, event, pos, behavior) {
    - var display = cm.display, moved = false;
    - var dragEnd = operation(cm, function (e) {
    - if (webkit) { display.scroller.draggable = false; }
    - cm.state.draggingText = false;
    - off(display.wrapper.ownerDocument, "mouseup", dragEnd);
    - off(display.wrapper.ownerDocument, "mousemove", mouseMove);
    - off(display.scroller, "dragstart", dragStart);
    - off(display.scroller, "drop", dragEnd);
    - if (!moved) {
    - e_preventDefault(e);
    - if (!behavior.addNew)
    - { extendSelection(cm.doc, pos, null, null, behavior.extend); }
    - // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
    - if (webkit || ie && ie_version == 9)
    - { setTimeout(function () {display.wrapper.ownerDocument.body.focus(); display.input.focus();}, 20); }
    - else
    - { display.input.focus(); }
    - }
    - });
    - var mouseMove = function(e2) {
    - moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;
    - };
    - var dragStart = function () { return moved = true; };
    - // Let the drag handler handle this.
    - if (webkit) { display.scroller.draggable = true; }
    - cm.state.draggingText = dragEnd;
    - dragEnd.copy = !behavior.moveOnDrag;
    - // IE's approach to draggable
    - if (display.scroller.dragDrop) { display.scroller.dragDrop(); }
    - on(display.wrapper.ownerDocument, "mouseup", dragEnd);
    - on(display.wrapper.ownerDocument, "mousemove", mouseMove);
    - on(display.scroller, "dragstart", dragStart);
    - on(display.scroller, "drop", dragEnd);
    -
    - delayBlurEvent(cm);
    - setTimeout(function () { return display.input.focus(); }, 20);
    - }
    -
    - function rangeForUnit(cm, pos, unit) {
    - if (unit == "char") { return new Range(pos, pos) }
    - if (unit == "word") { return cm.findWordAt(pos) }
    - if (unit == "line") { return new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))) }
    - var result = unit(cm, pos);
    - return new Range(result.from, result.to)
    - }
    -
    - // Normal selection, as opposed to text dragging.
    - function leftButtonSelect(cm, event, start, behavior) {
    - var display = cm.display, doc = cm.doc;
    - e_preventDefault(event);
    -
    - var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;
    - if (behavior.addNew && !behavior.extend) {
    - ourIndex = doc.sel.contains(start);
    - if (ourIndex > -1)
    - { ourRange = ranges[ourIndex]; }
    - else
    - { ourRange = new Range(start, start); }
    - } else {
    - ourRange = doc.sel.primary();
    - ourIndex = doc.sel.primIndex;
    - }
    -
    - if (behavior.unit == "rectangle") {
    - if (!behavior.addNew) { ourRange = new Range(start, start); }
    - start = posFromMouse(cm, event, true, true);
    - ourIndex = -1;
    - } else {
    - var range$$1 = rangeForUnit(cm, start, behavior.unit);
    - if (behavior.extend)
    - { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }
    - else
    - { ourRange = range$$1; }
    - }
    -
    - if (!behavior.addNew) {
    - ourIndex = 0;
    - setSelection(doc, new Selection([ourRange], 0), sel_mouse);
    - startSel = doc.sel;
    - } else if (ourIndex == -1) {
    - ourIndex = ranges.length;
    - setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),
    - {scroll: false, origin: "*mouse"});
    - } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == "char" && !behavior.extend) {
    - setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
    - {scroll: false, origin: "*mouse"});
    - startSel = doc.sel;
    - } else {
    - replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
    - }
    -
    - var lastPos = start;
    - function extendTo(pos) {
    - if (cmp(lastPos, pos) == 0) { return }
    - lastPos = pos;
    -
    - if (behavior.unit == "rectangle") {
    - var ranges = [], tabSize = cm.options.tabSize;
    - var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
    - var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
    - var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
    - for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
    - line <= end; line++) {
    - var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
    - if (left == right)
    - { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }
    - else if (text.length > leftPos)
    - { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }
    - }
    - if (!ranges.length) { ranges.push(new Range(start, start)); }
    - setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
    - {origin: "*mouse", scroll: false});
    - cm.scrollIntoView(pos);
    - } else {
    - var oldRange = ourRange;
    - var range$$1 = rangeForUnit(cm, pos, behavior.unit);
    - var anchor = oldRange.anchor, head;
    - if (cmp(range$$1.anchor, anchor) > 0) {
    - head = range$$1.head;
    - anchor = minPos(oldRange.from(), range$$1.anchor);
    - } else {
    - head = range$$1.anchor;
    - anchor = maxPos(oldRange.to(), range$$1.head);
    - }
    - var ranges$1 = startSel.ranges.slice(0);
    - ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));
    - setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);
    - }
    - }
    -
    - var editorSize = display.wrapper.getBoundingClientRect();
    - // Used to ensure timeout re-tries don't fire when another extend
    - // happened in the meantime (clearTimeout isn't reliable -- at
    - // least on Chrome, the timeouts still happen even when cleared,
    - // if the clear happens after their scheduled firing time).
    - var counter = 0;
    -
    - function extend(e) {
    - var curCount = ++counter;
    - var cur = posFromMouse(cm, e, true, behavior.unit == "rectangle");
    - if (!cur) { return }
    - if (cmp(cur, lastPos) != 0) {
    - cm.curOp.focus = activeElt();
    - extendTo(cur);
    - var visible = visibleLines(display, doc);
    - if (cur.line >= visible.to || cur.line < visible.from)
    - { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }
    - } else {
    - var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
    - if (outside) { setTimeout(operation(cm, function () {
    - if (counter != curCount) { return }
    - display.scroller.scrollTop += outside;
    - extend(e);
    - }), 50); }
    - }
    - }
    -
    - function done(e) {
    - cm.state.selectingText = false;
    - counter = Infinity;
    - // If e is null or undefined we interpret this as someone trying
    - // to explicitly cancel the selection rather than the user
    - // letting go of the mouse button.
    - if (e) {
    - e_preventDefault(e);
    - display.input.focus();
    - }
    - off(display.wrapper.ownerDocument, "mousemove", move);
    - off(display.wrapper.ownerDocument, "mouseup", up);
    - doc.history.lastSelOrigin = null;
    - }
    -
    - var move = operation(cm, function (e) {
    - if (e.buttons === 0 || !e_button(e)) { done(e); }
    - else { extend(e); }
    - });
    - var up = operation(cm, done);
    - cm.state.selectingText = up;
    - on(display.wrapper.ownerDocument, "mousemove", move);
    - on(display.wrapper.ownerDocument, "mouseup", up);
    - }
    -
    - // Used when mouse-selecting to adjust the anchor to the proper side
    - // of a bidi jump depending on the visual position of the head.
    - function bidiSimplify(cm, range$$1) {
    - var anchor = range$$1.anchor;
    - var head = range$$1.head;
    - var anchorLine = getLine(cm.doc, anchor.line);
    - if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) { return range$$1 }
    - var order = getOrder(anchorLine);
    - if (!order) { return range$$1 }
    - var index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index];
    - if (part.from != anchor.ch && part.to != anchor.ch) { return range$$1 }
    - var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1);
    - if (boundary == 0 || boundary == order.length) { return range$$1 }
    -
    - // Compute the relative visual position of the head compared to the
    - // anchor (<0 is to the left, >0 to the right)
    - var leftSide;
    - if (head.line != anchor.line) {
    - leftSide = (head.line - anchor.line) * (cm.doc.direction == "ltr" ? 1 : -1) > 0;
    - } else {
    - var headIndex = getBidiPartAt(order, head.ch, head.sticky);
    - var dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1);
    - if (headIndex == boundary - 1 || headIndex == boundary)
    - { leftSide = dir < 0; }
    - else
    - { leftSide = dir > 0; }
    - }
    -
    - var usePart = order[boundary + (leftSide ? -1 : 0)];
    - var from = leftSide == (usePart.level == 1);
    - var ch = from ? usePart.from : usePart.to, sticky = from ? "after" : "before";
    - return anchor.ch == ch && anchor.sticky == sticky ? range$$1 : new Range(new Pos(anchor.line, ch, sticky), head)
    - }
    -
    -
    - // Determines whether an event happened in the gutter, and fires the
    - // handlers for the corresponding event.
    - function gutterEvent(cm, e, type, prevent) {
    - var mX, mY;
    - if (e.touches) {
    - mX = e.touches[0].clientX;
    - mY = e.touches[0].clientY;
    - } else {
    - try { mX = e.clientX; mY = e.clientY; }
    - catch(e) { return false }
    - }
    - if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }
    - if (prevent) { e_preventDefault(e); }
    -
    - var display = cm.display;
    - var lineBox = display.lineDiv.getBoundingClientRect();
    -
    - if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }
    - mY -= lineBox.top - display.viewOffset;
    -
    - for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {
    - var g = display.gutters.childNodes[i];
    - if (g && g.getBoundingClientRect().right >= mX) {
    - var line = lineAtHeight(cm.doc, mY);
    - var gutter = cm.display.gutterSpecs[i];
    - signal(cm, type, cm, line, gutter.className, e);
    - return e_defaultPrevented(e)
    - }
    - }
    - }
    -
    - function clickInGutter(cm, e) {
    - return gutterEvent(cm, e, "gutterClick", true)
    - }
    -
    - // CONTEXT MENU HANDLING
    -
    - // To make the context menu work, we need to briefly unhide the
    - // textarea (making it as unobtrusive as possible) to let the
    - // right-click take effect on it.
    - function onContextMenu(cm, e) {
    - if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }
    - if (signalDOMEvent(cm, e, "contextmenu")) { return }
    - if (!captureRightClick) { cm.display.input.onContextMenu(e); }
    - }
    -
    - function contextMenuInGutter(cm, e) {
    - if (!hasHandler(cm, "gutterContextMenu")) { return false }
    - return gutterEvent(cm, e, "gutterContextMenu", false)
    - }
    -
    - function themeChanged(cm) {
    - cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
    - cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
    - clearCaches(cm);
    - }
    -
    - var Init = {toString: function(){return "CodeMirror.Init"}};
    -
    - var defaults = {};
    - var optionHandlers = {};
    -
    - function defineOptions(CodeMirror) {
    - var optionHandlers = CodeMirror.optionHandlers;
    -
    - function option(name, deflt, handle, notOnInit) {
    - CodeMirror.defaults[name] = deflt;
    - if (handle) { optionHandlers[name] =
    - notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; }
    - }
    -
    - CodeMirror.defineOption = option;
    -
    - // Passed to option handlers when there is no old value.
    - CodeMirror.Init = Init;
    -
    - // These two are, on init, called from the constructor because they
    - // have to be initialized before the editor can start at all.
    - option("value", "", function (cm, val) { return cm.setValue(val); }, true);
    - option("mode", null, function (cm, val) {
    - cm.doc.modeOption = val;
    - loadMode(cm);
    - }, true);
    -
    - option("indentUnit", 2, loadMode, true);
    - option("indentWithTabs", false);
    - option("smartIndent", true);
    - option("tabSize", 4, function (cm) {
    - resetModeState(cm);
    - clearCaches(cm);
    - regChange(cm);
    - }, true);
    -
    - option("lineSeparator", null, function (cm, val) {
    - cm.doc.lineSep = val;
    - if (!val) { return }
    - var newBreaks = [], lineNo = cm.doc.first;
    - cm.doc.iter(function (line) {
    - for (var pos = 0;;) {
    - var found = line.text.indexOf(val, pos);
    - if (found == -1) { break }
    - pos = found + val.length;
    - newBreaks.push(Pos(lineNo, found));
    - }
    - lineNo++;
    - });
    - for (var i = newBreaks.length - 1; i >= 0; i--)
    - { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }
    - });
    - option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function (cm, val, old) {
    - cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
    - if (old != Init) { cm.refresh(); }
    - });
    - option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);
    - option("electricChars", true);
    - option("inputStyle", mobile ? "contenteditable" : "textarea", function () {
    - throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME
    - }, true);
    - option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);
    - option("autocorrect", false, function (cm, val) { return cm.getInputField().autocorrect = val; }, true);
    - option("autocapitalize", false, function (cm, val) { return cm.getInputField().autocapitalize = val; }, true);
    - option("rtlMoveVisually", !windows);
    - option("wholeLineUpdateBefore", true);
    -
    - option("theme", "default", function (cm) {
    - themeChanged(cm);
    - updateGutters(cm);
    - }, true);
    - option("keyMap", "default", function (cm, val, old) {
    - var next = getKeyMap(val);
    - var prev = old != Init && getKeyMap(old);
    - if (prev && prev.detach) { prev.detach(cm, next); }
    - if (next.attach) { next.attach(cm, prev || null); }
    - });
    - option("extraKeys", null);
    - option("configureMouse", null);
    -
    - option("lineWrapping", false, wrappingChanged, true);
    - option("gutters", [], function (cm, val) {
    - cm.display.gutterSpecs = getGutters(val, cm.options.lineNumbers);
    - updateGutters(cm);
    - }, true);
    - option("fixedGutter", true, function (cm, val) {
    - cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0";
    - cm.refresh();
    - }, true);
    - option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true);
    - option("scrollbarStyle", "native", function (cm) {
    - initScrollbars(cm);
    - updateScrollbars(cm);
    - cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);
    - cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);
    - }, true);
    - option("lineNumbers", false, function (cm, val) {
    - cm.display.gutterSpecs = getGutters(cm.options.gutters, val);
    - updateGutters(cm);
    - }, true);
    - option("firstLineNumber", 1, updateGutters, true);
    - option("lineNumberFormatter", function (integer) { return integer; }, updateGutters, true);
    - option("showCursorWhenSelecting", false, updateSelection, true);
    -
    - option("resetSelectionOnContextMenu", true);
    - option("lineWiseCopyCut", true);
    - option("pasteLinesPerSelection", true);
    - option("selectionsMayTouch", false);
    -
    - option("readOnly", false, function (cm, val) {
    - if (val == "nocursor") {
    - onBlur(cm);
    - cm.display.input.blur();
    - }
    - cm.display.input.readOnlyChanged(val);
    - });
    - option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true);
    - option("dragDrop", true, dragDropChanged);
    - option("allowDropFileTypes", null);
    -
    - option("cursorBlinkRate", 530);
    - option("cursorScrollMargin", 0);
    - option("cursorHeight", 1, updateSelection, true);
    - option("singleCursorHeightPerLine", true, updateSelection, true);
    - option("workTime", 100);
    - option("workDelay", 100);
    - option("flattenSpans", true, resetModeState, true);
    - option("addModeClass", false, resetModeState, true);
    - option("pollInterval", 100);
    - option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; });
    - option("historyEventDelay", 1250);
    - option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true);
    - option("maxHighlightLength", 10000, resetModeState, true);
    - option("moveInputWithCursor", true, function (cm, val) {
    - if (!val) { cm.display.input.resetPosition(); }
    - });
    -
    - option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; });
    - option("autofocus", null);
    - option("direction", "ltr", function (cm, val) { return cm.doc.setDirection(val); }, true);
    - option("phrases", null);
    - }
    -
    - function dragDropChanged(cm, value, old) {
    - var wasOn = old && old != Init;
    - if (!value != !wasOn) {
    - var funcs = cm.display.dragFunctions;
    - var toggle = value ? on : off;
    - toggle(cm.display.scroller, "dragstart", funcs.start);
    - toggle(cm.display.scroller, "dragenter", funcs.enter);
    - toggle(cm.display.scroller, "dragover", funcs.over);
    - toggle(cm.display.scroller, "dragleave", funcs.leave);
    - toggle(cm.display.scroller, "drop", funcs.drop);
    - }
    - }
    -
    - function wrappingChanged(cm) {
    - if (cm.options.lineWrapping) {
    - addClass(cm.display.wrapper, "CodeMirror-wrap");
    - cm.display.sizer.style.minWidth = "";
    - cm.display.sizerWidth = null;
    - } else {
    - rmClass(cm.display.wrapper, "CodeMirror-wrap");
    - findMaxLine(cm);
    - }
    - estimateLineHeights(cm);
    - regChange(cm);
    - clearCaches(cm);
    - setTimeout(function () { return updateScrollbars(cm); }, 100);
    - }
    -
    - // A CodeMirror instance represents an editor. This is the object
    - // that user code is usually dealing with.
    -
    - function CodeMirror(place, options) {
    - var this$1 = this;
    -
    - if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }
    -
    - this.options = options = options ? copyObj(options) : {};
    - // Determine effective options based on given values and defaults.
    - copyObj(defaults, options, false);
    -
    - var doc = options.value;
    - if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }
    - else if (options.mode) { doc.modeOption = options.mode; }
    - this.doc = doc;
    -
    - var input = new CodeMirror.inputStyles[options.inputStyle](this);
    - var display = this.display = new Display(place, doc, input, options);
    - display.wrapper.CodeMirror = this;
    - themeChanged(this);
    - if (options.lineWrapping)
    - { this.display.wrapper.className += " CodeMirror-wrap"; }
    - initScrollbars(this);
    -
    - this.state = {
    - keyMaps: [], // stores maps added by addKeyMap
    - overlays: [], // highlighting overlays, as added by addOverlay
    - modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info
    - overwrite: false,
    - delayingBlurEvent: false,
    - focused: false,
    - suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
    - pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll
    - selectingText: false,
    - draggingText: false,
    - highlight: new Delayed(), // stores highlight worker timeout
    - keySeq: null, // Unfinished key sequence
    - specialChars: null
    - };
    -
    - if (options.autofocus && !mobile) { display.input.focus(); }
    -
    - // Override magic textarea content restore that IE sometimes does
    - // on our hidden textarea on reload
    - if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }
    -
    - registerEventHandlers(this);
    - ensureGlobalHandlers();
    -
    - startOperation(this);
    - this.curOp.forceUpdate = true;
    - attachDoc(this, doc);
    -
    - if ((options.autofocus && !mobile) || this.hasFocus())
    - { setTimeout(bind(onFocus, this), 20); }
    - else
    - { onBlur(this); }
    -
    - for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))
    - { optionHandlers[opt](this$1, options[opt], Init); } }
    - maybeUpdateLineNumberWidth(this);
    - if (options.finishInit) { options.finishInit(this); }
    - for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }
    - endOperation(this);
    - // Suppress optimizelegibility in Webkit, since it breaks text
    - // measuring on line wrapping boundaries.
    - if (webkit && options.lineWrapping &&
    - getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
    - { display.lineDiv.style.textRendering = "auto"; }
    - }
    -
    - // The default configuration options.
    - CodeMirror.defaults = defaults;
    - // Functions to run when options are changed.
    - CodeMirror.optionHandlers = optionHandlers;
    -
    - // Attach the necessary event handlers when initializing the editor
    - function registerEventHandlers(cm) {
    - var d = cm.display;
    - on(d.scroller, "mousedown", operation(cm, onMouseDown));
    - // Older IE's will not fire a second mousedown for a double click
    - if (ie && ie_version < 11)
    - { on(d.scroller, "dblclick", operation(cm, function (e) {
    - if (signalDOMEvent(cm, e)) { return }
    - var pos = posFromMouse(cm, e);
    - if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }
    - e_preventDefault(e);
    - var word = cm.findWordAt(pos);
    - extendSelection(cm.doc, word.anchor, word.head);
    - })); }
    - else
    - { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); }
    - // Some browsers fire contextmenu *after* opening the menu, at
    - // which point we can't mess with it anymore. Context menu is
    - // handled in onMouseDown for these browsers.
    - on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); });
    -
    - // Used to suppress mouse event handling when a touch happens
    - var touchFinished, prevTouch = {end: 0};
    - function finishTouch() {
    - if (d.activeTouch) {
    - touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000);
    - prevTouch = d.activeTouch;
    - prevTouch.end = +new Date;
    - }
    - }
    - function isMouseLikeTouchEvent(e) {
    - if (e.touches.length != 1) { return false }
    - var touch = e.touches[0];
    - return touch.radiusX <= 1 && touch.radiusY <= 1
    - }
    - function farAway(touch, other) {
    - if (other.left == null) { return true }
    - var dx = other.left - touch.left, dy = other.top - touch.top;
    - return dx * dx + dy * dy > 20 * 20
    - }
    - on(d.scroller, "touchstart", function (e) {
    - if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) {
    - d.input.ensurePolled();
    - clearTimeout(touchFinished);
    - var now = +new Date;
    - d.activeTouch = {start: now, moved: false,
    - prev: now - prevTouch.end <= 300 ? prevTouch : null};
    - if (e.touches.length == 1) {
    - d.activeTouch.left = e.touches[0].pageX;
    - d.activeTouch.top = e.touches[0].pageY;
    - }
    - }
    - });
    - on(d.scroller, "touchmove", function () {
    - if (d.activeTouch) { d.activeTouch.moved = true; }
    - });
    - on(d.scroller, "touchend", function (e) {
    - var touch = d.activeTouch;
    - if (touch && !eventInWidget(d, e) && touch.left != null &&
    - !touch.moved && new Date - touch.start < 300) {
    - var pos = cm.coordsChar(d.activeTouch, "page"), range;
    - if (!touch.prev || farAway(touch, touch.prev)) // Single tap
    - { range = new Range(pos, pos); }
    - else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
    - { range = cm.findWordAt(pos); }
    - else // Triple tap
    - { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); }
    - cm.setSelection(range.anchor, range.head);
    - cm.focus();
    - e_preventDefault(e);
    - }
    - finishTouch();
    - });
    - on(d.scroller, "touchcancel", finishTouch);
    -
    - // Sync scrolling between fake scrollbars and real scrollable
    - // area, ensure viewport is updated when scrolling.
    - on(d.scroller, "scroll", function () {
    - if (d.scroller.clientHeight) {
    - updateScrollTop(cm, d.scroller.scrollTop);
    - setScrollLeft(cm, d.scroller.scrollLeft, true);
    - signal(cm, "scroll", cm);
    - }
    - });
    -
    - // Listen to wheel events in order to try and update the viewport on time.
    - on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); });
    - on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); });
    -
    - // Prevent wrapper from ever scrolling
    - on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
    -
    - d.dragFunctions = {
    - enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }},
    - over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},
    - start: function (e) { return onDragStart(cm, e); },
    - drop: operation(cm, onDrop),
    - leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}
    - };
    -
    - var inp = d.input.getField();
    - on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); });
    - on(inp, "keydown", operation(cm, onKeyDown));
    - on(inp, "keypress", operation(cm, onKeyPress));
    - on(inp, "focus", function (e) { return onFocus(cm, e); });
    - on(inp, "blur", function (e) { return onBlur(cm, e); });
    - }
    -
    - var initHooks = [];
    - CodeMirror.defineInitHook = function (f) { return initHooks.push(f); };
    -
    - // Indent the given line. The how parameter can be "smart",
    - // "add"/null, "subtract", or "prev". When aggressive is false
    - // (typically set to true for forced single-line indents), empty
    - // lines are not indented, and places where the mode returns Pass
    - // are left alone.
    - function indentLine(cm, n, how, aggressive) {
    - var doc = cm.doc, state;
    - if (how == null) { how = "add"; }
    - if (how == "smart") {
    - // Fall back to "prev" when the mode doesn't have an indentation
    - // method.
    - if (!doc.mode.indent) { how = "prev"; }
    - else { state = getContextBefore(cm, n).state; }
    - }
    -
    - var tabSize = cm.options.tabSize;
    - var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
    - if (line.stateAfter) { line.stateAfter = null; }
    - var curSpaceString = line.text.match(/^\s*/)[0], indentation;
    - if (!aggressive && !/\S/.test(line.text)) {
    - indentation = 0;
    - how = "not";
    - } else if (how == "smart") {
    - indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
    - if (indentation == Pass || indentation > 150) {
    - if (!aggressive) { return }
    - how = "prev";
    - }
    - }
    - if (how == "prev") {
    - if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }
    - else { indentation = 0; }
    - } else if (how == "add") {
    - indentation = curSpace + cm.options.indentUnit;
    - } else if (how == "subtract") {
    - indentation = curSpace - cm.options.indentUnit;
    - } else if (typeof how == "number") {
    - indentation = curSpace + how;
    - }
    - indentation = Math.max(0, indentation);
    -
    - var indentString = "", pos = 0;
    - if (cm.options.indentWithTabs)
    - { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} }
    - if (pos < indentation) { indentString += spaceStr(indentation - pos); }
    -
    - if (indentString != curSpaceString) {
    - replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
    - line.stateAfter = null;
    - return true
    - } else {
    - // Ensure that, if the cursor was in the whitespace at the start
    - // of the line, it is moved to the end of that space.
    - for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {
    - var range = doc.sel.ranges[i$1];
    - if (range.head.line == n && range.head.ch < curSpaceString.length) {
    - var pos$1 = Pos(n, curSpaceString.length);
    - replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));
    - break
    - }
    - }
    - }
    - }
    -
    - // This will be set to a {lineWise: bool, text: [string]} object, so
    - // that, when pasting, we know what kind of selections the copied
    - // text was made out of.
    - var lastCopied = null;
    -
    - function setLastCopied(newLastCopied) {
    - lastCopied = newLastCopied;
    - }
    -
    - function applyTextInput(cm, inserted, deleted, sel, origin) {
    - var doc = cm.doc;
    - cm.display.shift = false;
    - if (!sel) { sel = doc.sel; }
    -
    - var recent = +new Date - 200;
    - var paste = origin == "paste" || cm.state.pasteIncoming > recent;
    - var textLines = splitLinesAuto(inserted), multiPaste = null;
    - // When pasting N lines into N selections, insert one line per selection
    - if (paste && sel.ranges.length > 1) {
    - if (lastCopied && lastCopied.text.join("\n") == inserted) {
    - if (sel.ranges.length % lastCopied.text.length == 0) {
    - multiPaste = [];
    - for (var i = 0; i < lastCopied.text.length; i++)
    - { multiPaste.push(doc.splitLines(lastCopied.text[i])); }
    - }
    - } else if (textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection) {
    - multiPaste = map(textLines, function (l) { return [l]; });
    - }
    - }
    -
    - var updateInput = cm.curOp.updateInput;
    - // Normal behavior is to insert the new text into every selection
    - for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {
    - var range$$1 = sel.ranges[i$1];
    - var from = range$$1.from(), to = range$$1.to();
    - if (range$$1.empty()) {
    - if (deleted && deleted > 0) // Handle deletion
    - { from = Pos(from.line, from.ch - deleted); }
    - else if (cm.state.overwrite && !paste) // Handle overwrite
    - { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); }
    - else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted)
    - { from = to = Pos(from.line, 0); }
    - }
    - var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,
    - origin: origin || (paste ? "paste" : cm.state.cutIncoming > recent ? "cut" : "+input")};
    - makeChange(cm.doc, changeEvent);
    - signalLater(cm, "inputRead", cm, changeEvent);
    - }
    - if (inserted && !paste)
    - { triggerElectric(cm, inserted); }
    -
    - ensureCursorVisible(cm);
    - if (cm.curOp.updateInput < 2) { cm.curOp.updateInput = updateInput; }
    - cm.curOp.typing = true;
    - cm.state.pasteIncoming = cm.state.cutIncoming = -1;
    - }
    -
    - function handlePaste(e, cm) {
    - var pasted = e.clipboardData && e.clipboardData.getData("Text");
    - if (pasted) {
    - e.preventDefault();
    - if (!cm.isReadOnly() && !cm.options.disableInput)
    - { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); }
    - return true
    - }
    - }
    -
    - function triggerElectric(cm, inserted) {
    - // When an 'electric' character is inserted, immediately trigger a reindent
    - if (!cm.options.electricChars || !cm.options.smartIndent) { return }
    - var sel = cm.doc.sel;
    -
    - for (var i = sel.ranges.length - 1; i >= 0; i--) {
    - var range$$1 = sel.ranges[i];
    - if (range$$1.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range$$1.head.line)) { continue }
    - var mode = cm.getModeAt(range$$1.head);
    - var indented = false;
    - if (mode.electricChars) {
    - for (var j = 0; j < mode.electricChars.length; j++)
    - { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
    - indented = indentLine(cm, range$$1.head.line, "smart");
    - break
    - } }
    - } else if (mode.electricInput) {
    - if (mode.electricInput.test(getLine(cm.doc, range$$1.head.line).text.slice(0, range$$1.head.ch)))
    - { indented = indentLine(cm, range$$1.head.line, "smart"); }
    - }
    - if (indented) { signalLater(cm, "electricInput", cm, range$$1.head.line); }
    - }
    - }
    -
    - function copyableRanges(cm) {
    - var text = [], ranges = [];
    - for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
    - var line = cm.doc.sel.ranges[i].head.line;
    - var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};
    - ranges.push(lineRange);
    - text.push(cm.getRange(lineRange.anchor, lineRange.head));
    - }
    - return {text: text, ranges: ranges}
    - }
    -
    - function disableBrowserMagic(field, spellcheck, autocorrect, autocapitalize) {
    - field.setAttribute("autocorrect", autocorrect ? "" : "off");
    - field.setAttribute("autocapitalize", autocapitalize ? "" : "off");
    - field.setAttribute("spellcheck", !!spellcheck);
    - }
    -
    - function hiddenTextarea() {
    - var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none");
    - var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
    - // The textarea is kept positioned near the cursor to prevent the
    - // fact that it'll be scrolled into view on input from scrolling
    - // our fake cursor out of view. On webkit, when wrap=off, paste is
    - // very slow. So make the area wide instead.
    - if (webkit) { te.style.width = "1000px"; }
    - else { te.setAttribute("wrap", "off"); }
    - // If border: 0; -- iOS fails to open keyboard (issue #1287)
    - if (ios) { te.style.border = "1px solid black"; }
    - disableBrowserMagic(te);
    - return div
    - }
    -
    - // The publicly visible API. Note that methodOp(f) means
    - // 'wrap f in an operation, performed on its `this` parameter'.
    -
    - // This is not the complete set of editor methods. Most of the
    - // methods defined on the Doc type are also injected into
    - // CodeMirror.prototype, for backwards compatibility and
    - // convenience.
    -
    - function addEditorMethods(CodeMirror) {
    - var optionHandlers = CodeMirror.optionHandlers;
    -
    - var helpers = CodeMirror.helpers = {};
    -
    - CodeMirror.prototype = {
    - constructor: CodeMirror,
    - focus: function(){window.focus(); this.display.input.focus();},
    -
    - setOption: function(option, value) {
    - var options = this.options, old = options[option];
    - if (options[option] == value && option != "mode") { return }
    - options[option] = value;
    - if (optionHandlers.hasOwnProperty(option))
    - { operation(this, optionHandlers[option])(this, value, old); }
    - signal(this, "optionChange", this, option);
    - },
    -
    - getOption: function(option) {return this.options[option]},
    - getDoc: function() {return this.doc},
    -
    - addKeyMap: function(map$$1, bottom) {
    - this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map$$1));
    - },
    - removeKeyMap: function(map$$1) {
    - var maps = this.state.keyMaps;
    - for (var i = 0; i < maps.length; ++i)
    - { if (maps[i] == map$$1 || maps[i].name == map$$1) {
    - maps.splice(i, 1);
    - return true
    - } }
    - },
    -
    - addOverlay: methodOp(function(spec, options) {
    - var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
    - if (mode.startState) { throw new Error("Overlays may not be stateful.") }
    - insertSorted(this.state.overlays,
    - {mode: mode, modeSpec: spec, opaque: options && options.opaque,
    - priority: (options && options.priority) || 0},
    - function (overlay) { return overlay.priority; });
    - this.state.modeGen++;
    - regChange(this);
    - }),
    - removeOverlay: methodOp(function(spec) {
    - var this$1 = this;
    -
    - var overlays = this.state.overlays;
    - for (var i = 0; i < overlays.length; ++i) {
    - var cur = overlays[i].modeSpec;
    - if (cur == spec || typeof spec == "string" && cur.name == spec) {
    - overlays.splice(i, 1);
    - this$1.state.modeGen++;
    - regChange(this$1);
    - return
    - }
    - }
    - }),
    -
    - indentLine: methodOp(function(n, dir, aggressive) {
    - if (typeof dir != "string" && typeof dir != "number") {
    - if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev"; }
    - else { dir = dir ? "add" : "subtract"; }
    - }
    - if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }
    - }),
    - indentSelection: methodOp(function(how) {
    - var this$1 = this;
    -
    - var ranges = this.doc.sel.ranges, end = -1;
    - for (var i = 0; i < ranges.length; i++) {
    - var range$$1 = ranges[i];
    - if (!range$$1.empty()) {
    - var from = range$$1.from(), to = range$$1.to();
    - var start = Math.max(end, from.line);
    - end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;
    - for (var j = start; j < end; ++j)
    - { indentLine(this$1, j, how); }
    - var newRanges = this$1.doc.sel.ranges;
    - if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
    - { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }
    - } else if (range$$1.head.line > end) {
    - indentLine(this$1, range$$1.head.line, how, true);
    - end = range$$1.head.line;
    - if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }
    - }
    - }
    - }),
    -
    - // Fetch the parser token for a given character. Useful for hacks
    - // that want to inspect the mode state (say, for completion).
    - getTokenAt: function(pos, precise) {
    - return takeToken(this, pos, precise)
    - },
    -
    - getLineTokens: function(line, precise) {
    - return takeToken(this, Pos(line), precise, true)
    - },
    -
    - getTokenTypeAt: function(pos) {
    - pos = clipPos(this.doc, pos);
    - var styles = getLineStyles(this, getLine(this.doc, pos.line));
    - var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;
    - var type;
    - if (ch == 0) { type = styles[2]; }
    - else { for (;;) {
    - var mid = (before + after) >> 1;
    - if ((mid ? stylesid * 2 - 1] : 0) >= ch) { after = mid; }
    - else if (stylesid * 2 + 1] < ch) { before = mid + 1; }
    - else { type = stylesid * 2 + 2]; break }
    - } }
    - var cut = type ? type.indexOf("overlay ") : -1;
    - return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)
    - },
    -
    - getModeAt: function(pos) {
    - var mode = this.doc.mode;
    - if (!mode.innerMode) { return mode }
    - return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode
    - },
    -
    - getHelper: function(pos, type) {
    - return this.getHelpers(pos, type)[0]
    - },
    -
    - getHelpers: function(pos, type) {
    - var this$1 = this;
    -
    - var found = [];
    - if (!helpers.hasOwnProperty(type)) { return found }
    - var help = helpers[type], mode = this.getModeAt(pos);
    - if (typeof mode[type] == "string") {
    - if (helpode[type]]) { found.push(helpode[type]]); }
    - } else if (mode[type]) {
    - for (var i = 0; i < mode[type].length; i++) {
    - var val = helpode[type][i]];
    - if (val) { found.push(val); }
    - }
    - } else if (mode.helperType && helpode.helperType]) {
    - found.push(helpode.helperType]);
    - } else if (helpode.name]) {
    - found.push(helpode.name]);
    - }
    - for (var i$1 = 0; i$1 < help._global.length; i$1++) {
    - var cur = help._global[i$1];
    - if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)
    - { found.push(cur.val); }
    - }
    - return found
    - },
    -
    - getStateAfter: function(line, precise) {
    - var doc = this.doc;
    - line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);
    - return getContextBefore(this, line + 1, precise).state
    - },
    -
    - cursorCoords: function(start, mode) {
    - var pos, range$$1 = this.doc.sel.primary();
    - if (start == null) { pos = range$$1.head; }
    - else if (typeof start == "object") { pos = clipPos(this.doc, start); }
    - else { pos = start ? range$$1.from() : range$$1.to(); }
    - return cursorCoords(this, pos, mode || "page")
    - },
    -
    - charCoords: function(pos, mode) {
    - return charCoords(this, clipPos(this.doc, pos), mode || "page")
    - },
    -
    - coordsChar: function(coords, mode) {
    - coords = fromCoordSystem(this, coords, mode || "page");
    - return coordsChar(this, coords.left, coords.top)
    - },
    -
    - lineAtHeight: function(height, mode) {
    - height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top;
    - return lineAtHeight(this.doc, height + this.display.viewOffset)
    - },
    - heightAtLine: function(line, mode, includeWidgets) {
    - var end = false, lineObj;
    - if (typeof line == "number") {
    - var last = this.doc.first + this.doc.size - 1;
    - if (line < this.doc.first) { line = this.doc.first; }
    - else if (line > last) { line = last; end = true; }
    - lineObj = getLine(this.doc, line);
    - } else {
    - lineObj = line;
    - }
    - return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top +
    - (end ? this.doc.height - heightAtLine(lineObj) : 0)
    - },
    -
    - defaultTextHeight: function() { return textHeight(this.display) },
    - defaultCharWidth: function() { return charWidth(this.display) },
    -
    - getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},
    -
    - addWidget: function(pos, node, scroll, vert, horiz) {
    - var display = this.display;
    - pos = cursorCoords(this, clipPos(this.doc, pos));
    - var top = pos.bottom, left = pos.left;
    - node.style.position = "absolute";
    - node.setAttribute("cm-ignore-events", "true");
    - this.display.input.setUneditable(node);
    - display.sizer.appendChild(node);
    - if (vert == "over") {
    - top = pos.top;
    - } else if (vert == "above" || vert == "near") {
    - var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
    - hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
    - // Default to positioning above (if specified and possible); otherwise default to positioning below
    - if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
    - { top = pos.top - node.offsetHeight; }
    - else if (pos.bottom + node.offsetHeight <= vspace)
    - { top = pos.bottom; }
    - if (left + node.offsetWidth > hspace)
    - { left = hspace - node.offsetWidth; }
    - }
    - node.style.top = top + "px";
    - node.style.left = node.style.right = "";
    - if (horiz == "right") {
    - left = display.sizer.clientWidth - node.offsetWidth;
    - node.style.right = "0px";
    - } else {
    - if (horiz == "left") { left = 0; }
    - else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }
    - node.style.left = left + "px";
    - }
    - if (scroll)
    - { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }
    - },
    -
    - triggerOnKeyDown: methodOp(onKeyDown),
    - triggerOnKeyPress: methodOp(onKeyPress),
    - triggerOnKeyUp: onKeyUp,
    - triggerOnMouseDown: methodOp(onMouseDown),
    -
    - execCommand: function(cmd) {
    - if (commands.hasOwnProperty(cmd))
    - { return commands[cmd].call(null, this) }
    - },
    -
    - triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),
    -
    - findPosH: function(from, amount, unit, visually) {
    - var this$1 = this;
    -
    - var dir = 1;
    - if (amount < 0) { dir = -1; amount = -amount; }
    - var cur = clipPos(this.doc, from);
    - for (var i = 0; i < amount; ++i) {
    - cur = findPosH(this$1.doc, cur, dir, unit, visually);
    - if (cur.hitSide) { break }
    - }
    - return cur
    - },
    -
    - moveH: methodOp(function(dir, unit) {
    - var this$1 = this;
    -
    - this.extendSelectionsBy(function (range$$1) {
    - if (this$1.display.shift || this$1.doc.extend || range$$1.empty())
    - { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }
    - else
    - { return dir < 0 ? range$$1.from() : range$$1.to() }
    - }, sel_move);
    - }),
    -
    - deleteH: methodOp(function(dir, unit) {
    - var sel = this.doc.sel, doc = this.doc;
    - if (sel.somethingSelected())
    - { doc.replaceSelection("", null, "+delete"); }
    - else
    - { deleteNearSelection(this, function (range$$1) {
    - var other = findPosH(doc, range$$1.head, dir, unit, false);
    - return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}
    - }); }
    - }),
    -
    - findPosV: function(from, amount, unit, goalColumn) {
    - var this$1 = this;
    -
    - var dir = 1, x = goalColumn;
    - if (amount < 0) { dir = -1; amount = -amount; }
    - var cur = clipPos(this.doc, from);
    - for (var i = 0; i < amount; ++i) {
    - var coords = cursorCoords(this$1, cur, "div");
    - if (x == null) { x = coords.left; }
    - else { coords.left = x; }
    - cur = findPosV(this$1, coords, dir, unit);
    - if (cur.hitSide) { break }
    - }
    - return cur
    - },
    -
    - moveV: methodOp(function(dir, unit) {
    - var this$1 = this;
    -
    - var doc = this.doc, goals = [];
    - var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();
    - doc.extendSelectionsBy(function (range$$1) {
    - if (collapse)
    - { return dir < 0 ? range$$1.from() : range$$1.to() }
    - var headPos = cursorCoords(this$1, range$$1.head, "div");
    - if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }
    - goals.push(headPos.left);
    - var pos = findPosV(this$1, headPos, dir, unit);
    - if (unit == "page" && range$$1 == doc.sel.primary())
    - { addToScrollTop(this$1, charCoords(this$1, pos, "div").top - headPos.top); }
    - return pos
    - }, sel_move);
    - if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)
    - { doc.sel.ranges[i].goalColumn = goals[i]; } }
    - }),
    -
    - // Find the word at the given position (as returned by coordsChar).
    - findWordAt: function(pos) {
    - var doc = this.doc, line = getLine(doc, pos.line).text;
    - var start = pos.ch, end = pos.ch;
    - if (line) {
    - var helper = this.getHelper(pos, "wordChars");
    - if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end; }
    - var startChar = line.charAt(start);
    - var check = isWordChar(startChar, helper)
    - ? function (ch) { return isWordChar(ch, helper); }
    - : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); }
    - : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); };
    - while (start > 0 && check(line.charAt(start - 1))) { --start; }
    - while (end < line.length && check(line.charAt(end))) { ++end; }
    - }
    - return new Range(Pos(pos.line, start), Pos(pos.line, end))
    - },
    -
    - toggleOverwrite: function(value) {
    - if (value != null && value == this.state.overwrite) { return }
    - if (this.state.overwrite = !this.state.overwrite)
    - { addClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
    - else
    - { rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
    -
    - signal(this, "overwriteToggle", this, this.state.overwrite);
    - },
    - hasFocus: function() { return this.display.input.getField() == activeElt() },
    - isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
    -
    - scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),
    - getScrollInfo: function() {
    - var scroller = this.display.scroller;
    - return {left: scroller.scrollLeft, top: scroller.scrollTop,
    - height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,
    - width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,
    - clientHeight: displayHeight(this), clientWidth: displayWidth(this)}
    - },
    -
    - scrollIntoView: methodOp(function(range$$1, margin) {
    - if (range$$1 == null) {
    - range$$1 = {from: this.doc.sel.primary().head, to: null};
    - if (margin == null) { margin = this.options.cursorScrollMargin; }
    - } else if (typeof range$$1 == "number") {
    - range$$1 = {from: Pos(range$$1, 0), to: null};
    - } else if (range$$1.from == null) {
    - range$$1 = {from: range$$1, to: null};
    - }
    - if (!range$$1.to) { range$$1.to = range$$1.from; }
    - range$$1.margin = margin || 0;
    -
    - if (range$$1.from.line != null) {
    - scrollToRange(this, range$$1);
    - } else {
    - scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);
    - }
    - }),
    -
    - setSize: methodOp(function(width, height) {
    - var this$1 = this;
    -
    - var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; };
    - if (width != null) { this.display.wrapper.style.width = interpret(width); }
    - if (height != null) { this.display.wrapper.style.height = interpret(height); }
    - if (this.options.lineWrapping) { clearLineMeasurementCache(this); }
    - var lineNo$$1 = this.display.viewFrom;
    - this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {
    - if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)
    - { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, "widget"); break } } }
    - ++lineNo$$1;
    - });
    - this.curOp.forceUpdate = true;
    - signal(this, "refresh", this);
    - }),
    -
    - operation: function(f){return runInOp(this, f)},
    - startOperation: function(){return startOperation(this)},
    - endOperation: function(){return endOperation(this)},
    -
    - refresh: methodOp(function() {
    - var oldHeight = this.display.cachedTextHeight;
    - regChange(this);
    - this.curOp.forceUpdate = true;
    - clearCaches(this);
    - scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);
    - updateGutterSpace(this.display);
    - if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)
    - { estimateLineHeights(this); }
    - signal(this, "refresh", this);
    - }),
    -
    - swapDoc: methodOp(function(doc) {
    - var old = this.doc;
    - old.cm = null;
    - // Cancel the current text selection if any (#5821)
    - if (this.state.selectingText) { this.state.selectingText(); }
    - attachDoc(this, doc);
    - clearCaches(this);
    - this.display.input.reset();
    - scrollToCoords(this, doc.scrollLeft, doc.scrollTop);
    - this.curOp.forceScroll = true;
    - signalLater(this, "swapDoc", this, old);
    - return old
    - }),
    -
    - phrase: function(phraseText) {
    - var phrases = this.options.phrases;
    - return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText
    - },
    -
    - getInputField: function(){return this.display.input.getField()},
    - getWrapperElement: function(){return this.display.wrapper},
    - getScrollerElement: function(){return this.display.scroller},
    - getGutterElement: function(){return this.display.gutters}
    - };
    - eventMixin(CodeMirror);
    -
    - CodeMirror.registerHelper = function(type, name, value) {
    - if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }
    - helpers[type][name] = value;
    - };
    - CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {
    - CodeMirror.registerHelper(type, name, value);
    - helpers[type]._global.push({pred: predicate, val: value});
    - };
    - }
    -
    - // Used for horizontal relative motion. Dir is -1 or 1 (left or
    - // right), unit can be "char", "column" (like char, but doesn't
    - // cross line boundaries), "word" (across next word), or "group" (to
    - // the start of next group of word or non-word-non-whitespace
    - // chars). The visually param controls whether, in right-to-left
    - // text, direction 1 means to move towards the next index in the
    - // string, or towards the character to the right of the current
    - // position. The resulting position will have a hitSide=true
    - // property if it reached the end of the document.
    - function findPosH(doc, pos, dir, unit, visually) {
    - var oldPos = pos;
    - var origDir = dir;
    - var lineObj = getLine(doc, pos.line);
    - function findNextLine() {
    - var l = pos.line + dir;
    - if (l < doc.first || l >= doc.first + doc.size) { return false }
    - pos = new Pos(l, pos.ch, pos.sticky);
    - return lineObj = getLine(doc, l)
    - }
    - function moveOnce(boundToLine) {
    - var next;
    - if (visually) {
    - next = moveVisually(doc.cm, lineObj, pos, dir);
    - } else {
    - next = moveLogically(lineObj, pos, dir);
    - }
    - if (next == null) {
    - if (!boundToLine && findNextLine())
    - { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }
    - else
    - { return false }
    - } else {
    - pos = next;
    - }
    - return true
    - }
    -
    - if (unit == "char") {
    - moveOnce();
    - } else if (unit == "column") {
    - moveOnce(true);
    - } else if (unit == "word" || unit == "group") {
    - var sawType = null, group = unit == "group";
    - var helper = doc.cm && doc.cm.getHelper(pos, "wordChars");
    - for (var first = true;; first = false) {
    - if (dir < 0 && !moveOnce(!first)) { break }
    - var cur = lineObj.text.charAt(pos.ch) || "\n";
    - var type = isWordChar(cur, helper) ? "w"
    - : group && cur == "\n" ? "n"
    - : !group || /\s/.test(cur) ? null
    - : "p";
    - if (group && !first && !type) { type = "s"; }
    - if (sawType && sawType != type) {
    - if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after";}
    - break
    - }
    -
    - if (type) { sawType = type; }
    - if (dir > 0 && !moveOnce(!first)) { break }
    - }
    - }
    - var result = skipAtomic(doc, pos, oldPos, origDir, true);
    - if (equalCursorPos(oldPos, result)) { result.hitSide = true; }
    - return result
    - }
    -
    - // For relative vertical movement. Dir may be -1 or 1. Unit can be
    - // "page" or "line". The resulting position will have a hitSide=true
    - // property if it reached the end of the document.
    - function findPosV(cm, pos, dir, unit) {
    - var doc = cm.doc, x = pos.left, y;
    - if (unit == "page") {
    - var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
    - var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);
    - y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;
    -
    - } else if (unit == "line") {
    - y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
    - }
    - var target;
    - for (;;) {
    - target = coordsChar(cm, x, y);
    - if (!target.outside) { break }
    - if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }
    - y += dir * 5;
    - }
    - return target
    - }
    -
    - // CONTENTEDITABLE INPUT STYLE
    -
    - var ContentEditableInput = function(cm) {
    - this.cm = cm;
    - this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;
    - this.polling = new Delayed();
    - this.composing = null;
    - this.gracePeriod = false;
    - this.readDOMTimeout = null;
    - };
    -
    - ContentEditableInput.prototype.init = function (display) {
    - var this$1 = this;
    -
    - var input = this, cm = input.cm;
    - var div = input.div = display.lineDiv;
    - disableBrowserMagic(div, cm.options.spellcheck, cm.options.autocorrect, cm.options.autocapitalize);
    -
    - on(div, "paste", function (e) {
    - if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
    - // IE doesn't fire input events, so we schedule a read for the pasted content in this way
    - if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); }
    - });
    -
    - on(div, "compositionstart", function (e) {
    - this$1.composing = {data: e.data, done: false};
    - });
    - on(div, "compositionupdate", function (e) {
    - if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; }
    - });
    - on(div, "compositionend", function (e) {
    - if (this$1.composing) {
    - if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); }
    - this$1.composing.done = true;
    - }
    - });
    -
    - on(div, "touchstart", function () { return input.forceCompositionEnd(); });
    -
    - on(div, "input", function () {
    - if (!this$1.composing) { this$1.readFromDOMSoon(); }
    - });
    -
    - function onCopyCut(e) {
    - if (signalDOMEvent(cm, e)) { return }
    - if (cm.somethingSelected()) {
    - setLastCopied({lineWise: false, text: cm.getSelections()});
    - if (e.type == "cut") { cm.replaceSelection("", null, "cut"); }
    - } else if (!cm.options.lineWiseCopyCut) {
    - return
    - } else {
    - var ranges = copyableRanges(cm);
    - setLastCopied({lineWise: true, text: ranges.text});
    - if (e.type == "cut") {
    - cm.operation(function () {
    - cm.setSelections(ranges.ranges, 0, sel_dontScroll);
    - cm.replaceSelection("", null, "cut");
    - });
    - }
    - }
    - if (e.clipboardData) {
    - e.clipboardData.clearData();
    - var content = lastCopied.text.join("\n");
    - // iOS exposes the clipboard API, but seems to discard content inserted into it
    - e.clipboardData.setData("Text", content);
    - if (e.clipboardData.getData("Text") == content) {
    - e.preventDefault();
    - return
    - }
    - }
    - // Old-fashioned briefly-focus-a-textarea hack
    - var kludge = hiddenTextarea(), te = kludge.firstChild;
    - cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
    - te.value = lastCopied.text.join("\n");
    - var hadFocus = document.activeElement;
    - selectInput(te);
    - setTimeout(function () {
    - cm.display.lineSpace.removeChild(kludge);
    - hadFocus.focus();
    - if (hadFocus == div) { input.showPrimarySelection(); }
    - }, 50);
    - }
    - on(div, "copy", onCopyCut);
    - on(div, "cut", onCopyCut);
    - };
    -
    - ContentEditableInput.prototype.prepareSelection = function () {
    - var result = prepareSelection(this.cm, false);
    - result.focus = this.cm.state.focused;
    - return result
    - };
    -
    - ContentEditableInput.prototype.showSelection = function (info, takeFocus) {
    - if (!info || !this.cm.display.view.length) { return }
    - if (info.focus || takeFocus) { this.showPrimarySelection(); }
    - this.showMultipleSelections(info);
    - };
    -
    - ContentEditableInput.prototype.getSelection = function () {
    - return this.cm.display.wrapper.ownerDocument.getSelection()
    - };
    -
    - ContentEditableInput.prototype.showPrimarySelection = function () {
    - var sel = this.getSelection(), cm = this.cm, prim = cm.doc.sel.primary();
    - var from = prim.from(), to = prim.to();
    -
    - if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {
    - sel.removeAllRanges();
    - return
    - }
    -
    - var curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
    - var curFocus = domToPos(cm, sel.focusNode, sel.focusOffset);
    - if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
    - cmp(minPos(curAnchor, curFocus), from) == 0 &&
    - cmp(maxPos(curAnchor, curFocus), to) == 0)
    - { return }
    -
    - var view = cm.display.view;
    - var start = (from.line >= cm.display.viewFrom && posToDOM(cm, from)) ||
    - {node: view[0].measure.map[2], offset: 0};
    - var end = to.line < cm.display.viewTo && posToDOM(cm, to);
    - if (!end) {
    - var measure = view[view.length - 1].measure;
    - var map$$1 = measure.maps ? measure.mapseasure.maps.length - 1] : measure.map;
    - end = {node: map$$1ap$$1.length - 1], offset: map$$1ap$$1.length - 2] - map$$1ap$$1.length - 3]};
    - }
    -
    - if (!start || !end) {
    - sel.removeAllRanges();
    - return
    - }
    -
    - var old = sel.rangeCount && sel.getRangeAt(0), rng;
    - try { rng = range(start.node, start.offset, end.offset, end.node); }
    - catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
    - if (rng) {
    - if (!gecko && cm.state.focused) {
    - sel.collapse(start.node, start.offset);
    - if (!rng.collapsed) {
    - sel.removeAllRanges();
    - sel.addRange(rng);
    - }
    - } else {
    - sel.removeAllRanges();
    - sel.addRange(rng);
    - }
    - if (old && sel.anchorNode == null) { sel.addRange(old); }
    - else if (gecko) { this.startGracePeriod(); }
    - }
    - this.rememberSelection();
    - };
    -
    - ContentEditableInput.prototype.startGracePeriod = function () {
    - var this$1 = this;
    -
    - clearTimeout(this.gracePeriod);
    - this.gracePeriod = setTimeout(function () {
    - this$1.gracePeriod = false;
    - if (this$1.selectionChanged())
    - { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); }
    - }, 20);
    - };
    -
    - ContentEditableInput.prototype.showMultipleSelections = function (info) {
    - removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);
    - removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);
    - };
    -
    - ContentEditableInput.prototype.rememberSelection = function () {
    - var sel = this.getSelection();
    - this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;
    - this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;
    - };
    -
    - ContentEditableInput.prototype.selectionInEditor = function () {
    - var sel = this.getSelection();
    - if (!sel.rangeCount) { return false }
    - var node = sel.getRangeAt(0).commonAncestorContainer;
    - return contains(this.div, node)
    - };
    -
    - ContentEditableInput.prototype.focus = function () {
    - if (this.cm.options.readOnly != "nocursor") {
    - if (!this.selectionInEditor())
    - { this.showSelection(this.prepareSelection(), true); }
    - this.div.focus();
    - }
    - };
    - ContentEditableInput.prototype.blur = function () { this.div.blur(); };
    - ContentEditableInput.prototype.getField = function () { return this.div };
    -
    - ContentEditableInput.prototype.supportsTouch = function () { return true };
    -
    - ContentEditableInput.prototype.receivedFocus = function () {
    - var input = this;
    - if (this.selectionInEditor())
    - { this.pollSelection(); }
    - else
    - { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }
    -
    - function poll() {
    - if (input.cm.state.focused) {
    - input.pollSelection();
    - input.polling.set(input.cm.options.pollInterval, poll);
    - }
    - }
    - this.polling.set(this.cm.options.pollInterval, poll);
    - };
    -
    - ContentEditableInput.prototype.selectionChanged = function () {
    - var sel = this.getSelection();
    - return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
    - sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset
    - };
    -
    - ContentEditableInput.prototype.pollSelection = function () {
    - if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }
    - var sel = this.getSelection(), cm = this.cm;
    - // On Android Chrome (version 56, at least), backspacing into an
    - // uneditable block element will put the cursor in that element,
    - // and then, because it's not editable, hide the virtual keyboard.
    - // Because Android doesn't allow us to actually detect backspace
    - // presses in a sane way, this code checks for when that happens
    - // and simulates a backspace press in this case.
    - if (android && chrome && this.cm.display.gutterSpecs.length && isInGutter(sel.anchorNode)) {
    - this.cm.triggerOnKeyDown({type: "keydown", keyCode: 8, preventDefault: Math.abs});
    - this.blur();
    - this.focus();
    - return
    - }
    - if (this.composing) { return }
    - this.rememberSelection();
    - var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
    - var head = domToPos(cm, sel.focusNode, sel.focusOffset);
    - if (anchor && head) { runInOp(cm, function () {
    - setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);
    - if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; }
    - }); }
    - };
    -
    - ContentEditableInput.prototype.pollContent = function () {
    - if (this.readDOMTimeout != null) {
    - clearTimeout(this.readDOMTimeout);
    - this.readDOMTimeout = null;
    - }
    -
    - var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();
    - var from = sel.from(), to = sel.to();
    - if (from.ch == 0 && from.line > cm.firstLine())
    - { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); }
    - if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())
    - { to = Pos(to.line + 1, 0); }
    - if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }
    -
    - var fromIndex, fromLine, fromNode;
    - if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {
    - fromLine = lineNo(display.view[0].line);
    - fromNode = display.view[0].node;
    - } else {
    - fromLine = lineNo(display.view[fromIndex].line);
    - fromNode = display.view[fromIndex - 1].node.nextSibling;
    - }
    - var toIndex = findViewIndex(cm, to.line);
    - var toLine, toNode;
    - if (toIndex == display.view.length - 1) {
    - toLine = display.viewTo - 1;
    - toNode = display.lineDiv.lastChild;
    - } else {
    - toLine = lineNo(display.view[toIndex + 1].line) - 1;
    - toNode = display.view[toIndex + 1].node.previousSibling;
    - }
    -
    - if (!fromNode) { return false }
    - var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));
    - var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));
    - while (newText.length > 1 && oldText.length > 1) {
    - if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }
    - else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }
    - else { break }
    - }
    -
    - var cutFront = 0, cutEnd = 0;
    - var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);
    - while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))
    - { ++cutFront; }
    - var newBot = lst(newText), oldBot = lst(oldText);
    - var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),
    - oldBot.length - (oldText.length == 1 ? cutFront : 0));
    - while (cutEnd < maxCutEnd &&
    - newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))
    - { ++cutEnd; }
    - // Try to move start of change to start of selection if ambiguous
    - if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {
    - while (cutFront && cutFront > from.ch &&
    - newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {
    - cutFront--;
    - cutEnd++;
    - }
    - }
    -
    - newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, "");
    - newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, "");
    -
    - var chFrom = Pos(fromLine, cutFront);
    - var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);
    - if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {
    - replaceRange(cm.doc, newText, chFrom, chTo, "+input");
    - return true
    - }
    - };
    -
    - ContentEditableInput.prototype.ensurePolled = function () {
    - this.forceCompositionEnd();
    - };
    - ContentEditableInput.prototype.reset = function () {
    - this.forceCompositionEnd();
    - };
    - ContentEditableInput.prototype.forceCompositionEnd = function () {
    - if (!this.composing) { return }
    - clearTimeout(this.readDOMTimeout);
    - this.composing = null;
    - this.updateFromDOM();
    - this.div.blur();
    - this.div.focus();
    - };
    - ContentEditableInput.prototype.readFromDOMSoon = function () {
    - var this$1 = this;
    -
    - if (this.readDOMTimeout != null) { return }
    - this.readDOMTimeout = setTimeout(function () {
    - this$1.readDOMTimeout = null;
    - if (this$1.composing) {
    - if (this$1.composing.done) { this$1.composing = null; }
    - else { return }
    - }
    - this$1.updateFromDOM();
    - }, 80);
    - };
    -
    - ContentEditableInput.prototype.updateFromDOM = function () {
    - var this$1 = this;
    -
    - if (this.cm.isReadOnly() || !this.pollContent())
    - { runInOp(this.cm, function () { return regChange(this$1.cm); }); }
    - };
    -
    - ContentEditableInput.prototype.setUneditable = function (node) {
    - node.contentEditable = "false";
    - };
    -
    - ContentEditableInput.prototype.onKeyPress = function (e) {
    - if (e.charCode == 0 || this.composing) { return }
    - e.preventDefault();
    - if (!this.cm.isReadOnly())
    - { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }
    - };
    -
    - ContentEditableInput.prototype.readOnlyChanged = function (val) {
    - this.div.contentEditable = String(val != "nocursor");
    - };
    -
    - ContentEditableInput.prototype.onContextMenu = function () {};
    - ContentEditableInput.prototype.resetPosition = function () {};
    -
    - ContentEditableInput.prototype.needsContentAttribute = true;
    -
    - function posToDOM(cm, pos) {
    - var view = findViewForLine(cm, pos.line);
    - if (!view || view.hidden) { return null }
    - var line = getLine(cm.doc, pos.line);
    - var info = mapFromLineView(view, line, pos.line);
    -
    - var order = getOrder(line, cm.doc.direction), side = "left";
    - if (order) {
    - var partPos = getBidiPartAt(order, pos.ch);
    - side = partPos % 2 ? "right" : "left";
    - }
    - var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);
    - result.offset = result.collapse == "right" ? result.end : result.start;
    - return result
    - }
    -
    - function isInGutter(node) {
    - for (var scan = node; scan; scan = scan.parentNode)
    - { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }
    - return false
    - }
    -
    - function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }
    -
    - function domTextBetween(cm, from, to, fromLine, toLine) {
    - var text = "", closing = false, lineSep = cm.doc.lineSeparator(), extraLinebreak = false;
    - function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
    - function close() {
    - if (closing) {
    - text += lineSep;
    - if (extraLinebreak) { text += lineSep; }
    - closing = extraLinebreak = false;
    - }
    - }
    - function addText(str) {
    - if (str) {
    - close();
    - text += str;
    - }
    - }
    - function walk(node) {
    - if (node.nodeType == 1) {
    - var cmText = node.getAttribute("cm-text");
    - if (cmText) {
    - addText(cmText);
    - return
    - }
    - var markerID = node.getAttribute("cm-marker"), range$$1;
    - if (markerID) {
    - var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));
    - if (found.length && (range$$1 = found[0].find(0)))
    - { addText(getBetween(cm.doc, range$$1.from, range$$1.to).join(lineSep)); }
    - return
    - }
    - if (node.getAttribute("contenteditable") == "false") { return }
    - var isBlock = /^(pre|div|p|li|table|br)$/i.test(node.nodeName);
    - if (!/^br$/i.test(node.nodeName) && node.textContent.length == 0) { return }
    -
    - if (isBlock) { close(); }
    - for (var i = 0; i < node.childNodes.length; i++)
    - { walk(node.childNodes[i]); }
    -
    - if (/^(pre|p)$/i.test(node.nodeName)) { extraLinebreak = true; }
    - if (isBlock) { closing = true; }
    - } else if (node.nodeType == 3) {
    - addText(node.nodeValue.replace(/\u200b/g, "").replace(/\u00a0/g, " "));
    - }
    - }
    - for (;;) {
    - walk(from);
    - if (from == to) { break }
    - from = from.nextSibling;
    - extraLinebreak = false;
    - }
    - return text
    - }
    -
    - function domToPos(cm, node, offset) {
    - var lineNode;
    - if (node == cm.display.lineDiv) {
    - lineNode = cm.display.lineDiv.childNodes[offset];
    - if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }
    - node = null; offset = 0;
    - } else {
    - for (lineNode = node;; lineNode = lineNode.parentNode) {
    - if (!lineNode || lineNode == cm.display.lineDiv) { return null }
    - if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }
    - }
    - }
    - for (var i = 0; i < cm.display.view.length; i++) {
    - var lineView = cm.display.view[i];
    - if (lineView.node == lineNode)
    - { return locateNodeInLineView(lineView, node, offset) }
    - }
    - }
    -
    - function locateNodeInLineView(lineView, node, offset) {
    - var wrapper = lineView.text.firstChild, bad = false;
    - if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
    - if (node == wrapper) {
    - bad = true;
    - node = wrapper.childNodes[offset];
    - offset = 0;
    - if (!node) {
    - var line = lineView.rest ? lst(lineView.rest) : lineView.line;
    - return badPos(Pos(lineNo(line), line.text.length), bad)
    - }
    - }
    -
    - var textNode = node.nodeType == 3 ? node : null, topNode = node;
    - if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
    - textNode = node.firstChild;
    - if (offset) { offset = textNode.nodeValue.length; }
    - }
    - while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; }
    - var measure = lineView.measure, maps = measure.maps;
    -
    - function find(textNode, topNode, offset) {
    - for (var i = -1; i < (maps ? maps.length : 0); i++) {
    - var map$$1 = i < 0 ? measure.map : maps[i];
    - for (var j = 0; j < map$$1.length; j += 3) {
    - var curNode = map$$1[j + 2];
    - if (curNode == textNode || curNode == topNode) {
    - var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);
    - var ch = map$$1[j] + offset;
    - if (offset < 0 || curNode != textNode) { ch = map$$1[j + (offset ? 1 : 0)]; }
    - return Pos(line, ch)
    - }
    - }
    - }
    - }
    - var found = find(textNode, topNode, offset);
    - if (found) { return badPos(found, bad) }
    -
    - // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems
    - for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {
    - found = find(after, after.firstChild, 0);
    - if (found)
    - { return badPos(Pos(found.line, found.ch - dist), bad) }
    - else
    - { dist += after.textContent.length; }
    - }
    - for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {
    - found = find(before, before.firstChild, -1);
    - if (found)
    - { return badPos(Pos(found.line, found.ch + dist$1), bad) }
    - else
    - { dist$1 += before.textContent.length; }
    - }
    - }
    -
    - // TEXTAREA INPUT STYLE
    -
    - var TextareaInput = function(cm) {
    - this.cm = cm;
    - // See input.poll and input.reset
    - this.prevInput = "";
    -
    - // Flag that indicates whether we expect input to appear real soon
    - // now (after some event like 'keypress' or 'input') and are
    - // polling intensively.
    - this.pollingFast = false;
    - // Self-resetting timeout for the poller
    - this.polling = new Delayed();
    - // Used to work around IE issue with selection being forgotten when focus moves away from textarea
    - this.hasSelection = false;
    - this.composing = null;
    - };
    -
    - TextareaInput.prototype.init = function (display) {
    - var this$1 = this;
    -
    - var input = this, cm = this.cm;
    - this.createField(display);
    - var te = this.textarea;
    -
    - display.wrapper.insertBefore(this.wrapper, display.wrapper.firstChild);
    -
    - // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
    - if (ios) { te.style.width = "0px"; }
    -
    - on(te, "input", function () {
    - if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; }
    - input.poll();
    - });
    -
    - on(te, "paste", function (e) {
    - if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
    -
    - cm.state.pasteIncoming = +new Date;
    - input.fastPoll();
    - });
    -
    - function prepareCopyCut(e) {
    - if (signalDOMEvent(cm, e)) { return }
    - if (cm.somethingSelected()) {
    - setLastCopied({lineWise: false, text: cm.getSelections()});
    - } else if (!cm.options.lineWiseCopyCut) {
    - return
    - } else {
    - var ranges = copyableRanges(cm);
    - setLastCopied({lineWise: true, text: ranges.text});
    - if (e.type == "cut") {
    - cm.setSelections(ranges.ranges, null, sel_dontScroll);
    - } else {
    - input.prevInput = "";
    - te.value = ranges.text.join("\n");
    - selectInput(te);
    - }
    - }
    - if (e.type == "cut") { cm.state.cutIncoming = +new Date; }
    - }
    - on(te, "cut", prepareCopyCut);
    - on(te, "copy", prepareCopyCut);
    -
    - on(display.scroller, "paste", function (e) {
    - if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }
    - if (!te.dispatchEvent) {
    - cm.state.pasteIncoming = +new Date;
    - input.focus();
    - return
    - }
    -
    - // Pass the `paste` event to the textarea so it's handled by its event listener.
    - var event = new Event("paste");
    - event.clipboardData = e.clipboardData;
    - te.dispatchEvent(event);
    - });
    -
    - // Prevent normal selection in the editor (we handle our own)
    - on(display.lineSpace, "selectstart", function (e) {
    - if (!eventInWidget(display, e)) { e_preventDefault(e); }
    - });
    -
    - on(te, "compositionstart", function () {
    - var start = cm.getCursor("from");
    - if (input.composing) { input.composing.range.clear(); }
    - input.composing = {
    - start: start,
    - range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
    - };
    - });
    - on(te, "compositionend", function () {
    - if (input.composing) {
    - input.poll();
    - input.composing.range.clear();
    - input.composing = null;
    - }
    - });
    - };
    -
    - TextareaInput.prototype.createField = function (_display) {
    - // Wraps and hides input textarea
    - this.wrapper = hiddenTextarea();
    - // The semihidden textarea that is focused when the editor is
    - // focused, and receives input.
    - this.textarea = this.wrapper.firstChild;
    - };
    -
    - TextareaInput.prototype.prepareSelection = function () {
    - // Redraw the selection and/or cursor
    - var cm = this.cm, display = cm.display, doc = cm.doc;
    - var result = prepareSelection(cm);
    -
    - // Move the hidden textarea near the cursor to prevent scrolling artifacts
    - if (cm.options.moveInputWithCursor) {
    - var headPos = cursorCoords(cm, doc.sel.primary().head, "div");
    - var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
    - result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
    - headPos.top + lineOff.top - wrapOff.top));
    - result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
    - headPos.left + lineOff.left - wrapOff.left));
    - }
    -
    - return result
    - };
    -
    - TextareaInput.prototype.showSelection = function (drawn) {
    - var cm = this.cm, display = cm.display;
    - removeChildrenAndAdd(display.cursorDiv, drawn.cursors);
    - removeChildrenAndAdd(display.selectionDiv, drawn.selection);
    - if (drawn.teTop != null) {
    - this.wrapper.style.top = drawn.teTop + "px";
    - this.wrapper.style.left = drawn.teLeft + "px";
    - }
    - };
    -
    - // Reset the input to correspond to the selection (or to be empty,
    - // when not typing and nothing is selected)
    - TextareaInput.prototype.reset = function (typing) {
    - if (this.contextMenuPending || this.composing) { return }
    - var cm = this.cm;
    - if (cm.somethingSelected()) {
    - this.prevInput = "";
    - var content = cm.getSelection();
    - this.textarea.value = content;
    - if (cm.state.focused) { selectInput(this.textarea); }
    - if (ie && ie_version >= 9) { this.hasSelection = content; }
    - } else if (!typing) {
    - this.prevInput = this.textarea.value = "";
    - if (ie && ie_version >= 9) { this.hasSelection = null; }
    - }
    - };
    -
    - TextareaInput.prototype.getField = function () { return this.textarea };
    -
    - TextareaInput.prototype.supportsTouch = function () { return false };
    -
    - TextareaInput.prototype.focus = function () {
    - if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) {
    - try { this.textarea.focus(); }
    - catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
    - }
    - };
    -
    - TextareaInput.prototype.blur = function () { this.textarea.blur(); };
    -
    - TextareaInput.prototype.resetPosition = function () {
    - this.wrapper.style.top = this.wrapper.style.left = 0;
    - };
    -
    - TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); };
    -
    - // Poll for input changes, using the normal rate of polling. This
    - // runs as long as the editor is focused.
    - TextareaInput.prototype.slowPoll = function () {
    - var this$1 = this;
    -
    - if (this.pollingFast) { return }
    - this.polling.set(this.cm.options.pollInterval, function () {
    - this$1.poll();
    - if (this$1.cm.state.focused) { this$1.slowPoll(); }
    - });
    - };
    -
    - // When an event has just come in that is likely to add or change
    - // something in the input textarea, we poll faster, to ensure that
    - // the change appears on the screen quickly.
    - TextareaInput.prototype.fastPoll = function () {
    - var missed = false, input = this;
    - input.pollingFast = true;
    - function p() {
    - var changed = input.poll();
    - if (!changed && !missed) {missed = true; input.polling.set(60, p);}
    - else {input.pollingFast = false; input.slowPoll();}
    - }
    - input.polling.set(20, p);
    - };
    -
    - // Read input from the textarea, and update the document to match.
    - // When something is selected, it is present in the textarea, and
    - // selected (unless it is huge, in which case a placeholder is
    - // used). When nothing is selected, the cursor sits after previously
    - // seen text (can be empty), which is stored in prevInput (we must
    - // not reset the textarea when typing, because that breaks IME).
    - TextareaInput.prototype.poll = function () {
    - var this$1 = this;
    -
    - var cm = this.cm, input = this.textarea, prevInput = this.prevInput;
    - // Since this is called a *lot*, try to bail out as cheaply as
    - // possible when it is clear that nothing happened. hasSelection
    - // will be the case when there is a lot of text in the textarea,
    - // in which case reading its value would be expensive.
    - if (this.contextMenuPending || !cm.state.focused ||
    - (hasSelection(input) && !prevInput && !this.composing) ||
    - cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
    - { return false }
    -
    - var text = input.value;
    - // If nothing changed, bail.
    - if (text == prevInput && !cm.somethingSelected()) { return false }
    - // Work around nonsensical selection resetting in IE9/10, and
    - // inexplicable appearance of private area unicode characters on
    - // some key combos in Mac (#2689).
    - if (ie && ie_version >= 9 && this.hasSelection === text ||
    - mac && /[\uf700-\uf7ff]/.test(text)) {
    - cm.display.input.reset();
    - return false
    - }
    -
    - if (cm.doc.sel == cm.display.selForContextMenu) {
    - var first = text.charCodeAt(0);
    - if (first == 0x200b && !prevInput) { prevInput = "\u200b"; }
    - if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") }
    - }
    - // Find the part of the input that is actually new
    - var same = 0, l = Math.min(prevInput.length, text.length);
    - while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; }
    -
    - runInOp(cm, function () {
    - applyTextInput(cm, text.slice(same), prevInput.length - same,
    - null, this$1.composing ? "*compose" : null);
    -
    - // Don't leave long text in the textarea, since it makes further polling slow
    - if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = ""; }
    - else { this$1.prevInput = text; }
    -
    - if (this$1.composing) {
    - this$1.composing.range.clear();
    - this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"),
    - {className: "CodeMirror-composing"});
    - }
    - });
    - return true
    - };
    -
    - TextareaInput.prototype.ensurePolled = function () {
    - if (this.pollingFast && this.poll()) { this.pollingFast = false; }
    - };
    -
    - TextareaInput.prototype.onKeyPress = function () {
    - if (ie && ie_version >= 9) { this.hasSelection = null; }
    - this.fastPoll();
    - };
    -
    - TextareaInput.prototype.onContextMenu = function (e) {
    - var input = this, cm = input.cm, display = cm.display, te = input.textarea;
    - if (input.contextMenuPending) { input.contextMenuPending(); }
    - var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
    - if (!pos || presto) { return } // Opera is difficult.
    -
    - // Reset the current text selection only if the click is done outside of the selection
    - // and 'resetSelectionOnContextMenu' option is true.
    - var reset = cm.options.resetSelectionOnContextMenu;
    - if (reset && cm.doc.sel.contains(pos) == -1)
    - { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); }
    -
    - var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;
    - var wrapperBox = input.wrapper.offsetParent.getBoundingClientRect();
    - input.wrapper.style.cssText = "position: static";
    - te.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
    - var oldScrollY;
    - if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712)
    - display.input.focus();
    - if (webkit) { window.scrollTo(null, oldScrollY); }
    - display.input.reset();
    - // Adds "Select all" to context menu in FF
    - if (!cm.somethingSelected()) { te.value = input.prevInput = " "; }
    - input.contextMenuPending = rehide;
    - display.selForContextMenu = cm.doc.sel;
    - clearTimeout(display.detectingSelectAll);
    -
    - // Select-all will be greyed out if there's nothing to select, so
    - // this adds a zero-width space so that we can later check whether
    - // it got selected.
    - function prepareSelectAllHack() {
    - if (te.selectionStart != null) {
    - var selected = cm.somethingSelected();
    - var extval = "\u200b" + (selected ? te.value : "");
    - te.value = "\u21da"; // Used to catch context-menu undo
    - te.value = extval;
    - input.prevInput = selected ? "" : "\u200b";
    - te.selectionStart = 1; te.selectionEnd = extval.length;
    - // Re-set this, in case some other handler touched the
    - // selection in the meantime.
    - display.selForContextMenu = cm.doc.sel;
    - }
    - }
    - function rehide() {
    - if (input.contextMenuPending != rehide) { return }
    - input.contextMenuPending = false;
    - input.wrapper.style.cssText = oldWrapperCSS;
    - te.style.cssText = oldCSS;
    - if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); }
    -
    - // Try to detect the user choosing select-all
    - if (te.selectionStart != null) {
    - if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); }
    - var i = 0, poll = function () {
    - if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
    - te.selectionEnd > 0 && input.prevInput == "\u200b") {
    - operation(cm, selectAll)(cm);
    - } else if (i++ < 10) {
    - display.detectingSelectAll = setTimeout(poll, 500);
    - } else {
    - display.selForContextMenu = null;
    - display.input.reset();
    - }
    - };
    - display.detectingSelectAll = setTimeout(poll, 200);
    - }
    - }
    -
    - if (ie && ie_version >= 9) { prepareSelectAllHack(); }
    - if (captureRightClick) {
    - e_stop(e);
    - var mouseup = function () {
    - off(window, "mouseup", mouseup);
    - setTimeout(rehide, 20);
    - };
    - on(window, "mouseup", mouseup);
    - } else {
    - setTimeout(rehide, 50);
    - }
    - };
    -
    - TextareaInput.prototype.readOnlyChanged = function (val) {
    - if (!val) { this.reset(); }
    - this.textarea.disabled = val == "nocursor";
    - };
    -
    - TextareaInput.prototype.setUneditable = function () {};
    -
    - TextareaInput.prototype.needsContentAttribute = false;
    -
    - function fromTextArea(textarea, options) {
    - options = options ? copyObj(options) : {};
    - options.value = textarea.value;
    - if (!options.tabindex && textarea.tabIndex)
    - { options.tabindex = textarea.tabIndex; }
    - if (!options.placeholder && textarea.placeholder)
    - { options.placeholder = textarea.placeholder; }
    - // Set autofocus to true if this textarea is focused, or if it has
    - // autofocus and no other element is focused.
    - if (options.autofocus == null) {
    - var hasFocus = activeElt();
    - options.autofocus = hasFocus == textarea ||
    - textarea.getAttribute("autofocus") != null && hasFocus == document.body;
    - }
    -
    - function save() {textarea.value = cm.getValue();}
    -
    - var realSubmit;
    - if (textarea.form) {
    - on(textarea.form, "submit", save);
    - // Deplorable hack to make the submit method do the right thing.
    - if (!options.leaveSubmitMethodAlone) {
    - var form = textarea.form;
    - realSubmit = form.submit;
    - try {
    - var wrappedSubmit = form.submit = function () {
    - save();
    - form.submit = realSubmit;
    - form.submit();
    - form.submit = wrappedSubmit;
    - };
    - } catch(e) {}
    - }
    - }
    -
    - options.finishInit = function (cm) {
    - cm.save = save;
    - cm.getTextArea = function () { return textarea; };
    - cm.toTextArea = function () {
    - cm.toTextArea = isNaN; // Prevent this from being ran twice
    - save();
    - textarea.parentNode.removeChild(cm.getWrapperElement());
    - textarea.style.display = "";
    - if (textarea.form) {
    - off(textarea.form, "submit", save);
    - if (!options.leaveSubmitMethodAlone && typeof textarea.form.submit == "function")
    - { textarea.form.submit = realSubmit; }
    - }
    - };
    - };
    -
    - textarea.style.display = "none";
    - var cm = CodeMirror(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },
    - options);
    - return cm
    - }
    -
    - function addLegacyProps(CodeMirror) {
    - CodeMirror.off = off;
    - CodeMirror.on = on;
    - CodeMirror.wheelEventPixels = wheelEventPixels;
    - CodeMirror.Doc = Doc;
    - CodeMirror.splitLines = splitLinesAuto;
    - CodeMirror.countColumn = countColumn;
    - CodeMirror.findColumn = findColumn;
    - CodeMirror.isWordChar = isWordCharBasic;
    - CodeMirror.Pass = Pass;
    - CodeMirror.signal = signal;
    - CodeMirror.Line = Line;
    - CodeMirror.changeEnd = changeEnd;
    - CodeMirror.scrollbarModel = scrollbarModel;
    - CodeMirror.Pos = Pos;
    - CodeMirror.cmpPos = cmp;
    - CodeMirror.modes = modes;
    - CodeMirror.mimeModes = mimeModes;
    - CodeMirror.resolveMode = resolveMode;
    - CodeMirror.getMode = getMode;
    - CodeMirror.modeExtensions = modeExtensions;
    - CodeMirror.extendMode = extendMode;
    - CodeMirror.copyState = copyState;
    - CodeMirror.startState = startState;
    - CodeMirror.innerMode = innerMode;
    - CodeMirror.commands = commands;
    - CodeMirror.keyMap = keyMap;
    - CodeMirror.keyName = keyName;
    - CodeMirror.isModifierKey = isModifierKey;
    - CodeMirror.lookupKey = lookupKey;
    - CodeMirror.normalizeKeyMap = normalizeKeyMap;
    - CodeMirror.StringStream = StringStream;
    - CodeMirror.SharedTextMarker = SharedTextMarker;
    - CodeMirror.TextMarker = TextMarker;
    - CodeMirror.LineWidget = LineWidget;
    - CodeMirror.e_preventDefault = e_preventDefault;
    - CodeMirror.e_stopPropagation = e_stopPropagation;
    - CodeMirror.e_stop = e_stop;
    - CodeMirror.addClass = addClass;
    - CodeMirror.contains = contains;
    - CodeMirror.rmClass = rmClass;
    - CodeMirror.keyNames = keyNames;
    - }
    -
    - // EDITOR CONSTRUCTOR
    -
    - defineOptions(CodeMirror);
    -
    - addEditorMethods(CodeMirror);
    -
    - // Set up methods on CodeMirror's prototype to redirect to the editor's document.
    - var dontDelegate = "iter insert remove copy getEditor constructor".split(" ");
    - for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
    - { CodeMirror.prototype[prop] = (function(method) {
    - return function() {return method.apply(this.doc, arguments)}
    - })(Doc.prototype[prop]); } }
    -
    - eventMixin(Doc);
    - CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput};
    -
    - // Extra arguments are stored as the mode's dependencies, which is
    - // used by (legacy) mechanisms like loadmode.js to automatically
    - // load a mode. (Preferred mechanism is the require/define calls.)
    - CodeMirror.defineMode = function(name/*, mode, …*/) {
    - if (!CodeMirror.defaults.mode && name != "null") { CodeMirror.defaults.mode = name; }
    - defineMode.apply(this, arguments);
    - };
    -
    - CodeMirror.defineMIME = defineMIME;
    -
    - // Minimal default mode.
    - CodeMirror.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });
    - CodeMirror.defineMIME("text/plain", "null");
    -
    - // EXTENSIONS
    -
    - CodeMirror.defineExtension = function (name, func) {
    - CodeMirror.prototype[name] = func;
    - };
    - CodeMirror.defineDocExtension = function (name, func) {
    - Doc.prototype[name] = func;
    - };
    -
    - CodeMirror.fromTextArea = fromTextArea;
    -
    - addLegacyProps(CodeMirror);
    -
    - CodeMirror.version = "5.49.0";
    -
    - return CodeMirror;
    -
    - })));
    - ;
    -
    - // CodeMirror, copyright (c) by Marijn Haverbeke and others
    - // Distributed under an MIT license: https://codemirror.net/LICENSE
    -
    - (function(mod) {
    - if (typeof exports == "object" && typeof module == "object") // CommonJS
    - mod(require("../../lib/codemirror"));
    - else if (typeof define == "function" && define.amd) // AMD
    - define(["../../lib/codemirror"], mod);
    - else // Plain browser env
    - mod(CodeMirror);
    - })(function(CodeMirror) {
    - "use strict";
    -
    - var HINT_ELEMENT_CLASS = "CodeMirror-hint";
    - var ACTIVE_HINT_ELEMENT_CLASS = "CodeMirror-hint-active";
    -
    - // This is the old interface, kept around for now to stay
    - // backwards-compatible.
    - CodeMirror.showHint = function(cm, getHints, options) {
    - if (!getHints) return cm.showHint(options);
    - if (options && options.async) getHints.async = true;
    - var newOpts = {hint: getHints};
    - if (options) for (var prop in options) newOpts[prop] = options[prop];
    - return cm.showHint(newOpts);
    - };
    -
    - CodeMirror.defineExtension("showHint", function(options) {
    - options = parseOptions(this, this.getCursor("start"), options);
    - var selections = this.listSelections()
    - if (selections.length > 1) return;
    - // By default, don't allow completion when something is selected.
    - // A hint function can have a `supportsSelection` property to
    - // indicate that it can handle selections.
    - if (this.somethingSelected()) {
    - if (!options.hint.supportsSelection) return;
    - // Don't try with cross-line selections
    - for (var i = 0; i < selections.length; i++)
    - if (selections[i].head.line != selections[i].anchor.line) return;
    - }
    -
    - if (this.state.completionActive) this.state.completionActive.close();
    - var completion = this.state.completionActive = new Completion(this, options);
    - if (!completion.options.hint) return;
    -
    - CodeMirror.signal(this, "startCompletion", this);
    - completion.update(true);
    - });
    -
    - CodeMirror.defineExtension("closeHint", function() {
    - if (this.state.completionActive) this.state.completionActive.close()
    - })
    -
    - function Completion(cm, options) {
    - this.cm = cm;
    - this.options = options;
    - this.widget = null;
    - this.debounce = 0;
    - this.tick = 0;
    - this.startPos = this.cm.getCursor("start");
    - this.startLen = this.cm.getLine(this.startPos.line).length - this.cm.getSelection().length;
    -
    - var self = this;
    - cm.on("cursorActivity", this.activityFunc = function() { self.cursorActivity(); });
    - }
    -
    - var requestAnimationFrame = window.requestAnimationFrame || function(fn) {
    - return setTimeout(fn, 1000/60);
    - };
    - var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
    -
    - Completion.prototype = {
    - close: function() {
    - if (!this.active()) return;
    - this.cm.state.completionActive = null;
    - this.tick = null;
    - this.cm.off("cursorActivity", this.activityFunc);
    -
    - if (this.widget && this.data) CodeMirror.signal(this.data, "close");
    - if (this.widget) this.widget.close();
    - CodeMirror.signal(this.cm, "endCompletion", this.cm);
    - },
    -
    - active: function() {
    - return this.cm.state.completionActive == this;
    - },
    -
    - pick: function(data, i) {
    - var completion = data.list[i];
    - if (completion.hint) completion.hint(this.cm, data, completion);
    - else this.cm.replaceRange(getText(completion), completion.from || data.from,
    - completion.to || data.to, "complete");
    - CodeMirror.signal(data, "pick", completion);
    - this.close();
    - },
    -
    - cursorActivity: function() {
    - if (this.debounce) {
    - cancelAnimationFrame(this.debounce);
    - this.debounce = 0;
    - }
    -
    - var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line);
    - if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch ||
    - pos.ch < this.startPos.ch || this.cm.somethingSelected() ||
    - (!pos.ch || this.options.closeCharacters.test(line.charAt(pos.ch - 1)))) {
    - this.close();
    - } else {
    - var self = this;
    - this.debounce = requestAnimationFrame(function() {self.update();});
    - if (this.widget) this.widget.disable();
    - }
    - },
    -
    - update: function(first) {
    - if (this.tick == null) return
    - var self = this, myTick = ++this.tick
    - fetchHints(this.options.hint, this.cm, this.options, function(data) {
    - if (self.tick == myTick) self.finishUpdate(data, first)
    - })
    - },
    -
    - finishUpdate: function(data, first) {
    - if (this.data) CodeMirror.signal(this.data, "update");
    -
    - var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle);
    - if (this.widget) this.widget.close();
    -
    - this.data = data;
    -
    - if (data && data.list.length) {
    - if (picked && data.list.length == 1) {
    - this.pick(data, 0);
    - } else {
    - this.widget = new Widget(this, data);
    - CodeMirror.signal(data, "shown");
    - }
    - }
    - }
    - };
    -
    - function parseOptions(cm, pos, options) {
    - var editor = cm.options.hintOptions;
    - var out = {};
    - for (var prop in defaultOptions) out[prop] = defaultOptions[prop];
    - if (editor) for (var prop in editor)
    - if (editor[prop] !== undefined) out[prop] = editor[prop];
    - if (options) for (var prop in options)
    - if (options[prop] !== undefined) out[prop] = options[prop];
    - if (out.hint.resolve) out.hint = out.hint.resolve(cm, pos)
    - return out;
    - }
    -
    - function getText(completion) {
    - if (typeof completion == "string") return completion;
    - else return completion.text;
    - }
    -
    - function buildKeyMap(completion, handle) {
    - var baseMap = {
    - Up: function() {handle.moveFocus(-1);},
    - Down: function() {handle.moveFocus(1);},
    - PageUp: function() {handle.moveFocus(-handle.menuSize() + 1, true);},
    - PageDown: function() {handle.moveFocus(handle.menuSize() - 1, true);},
    - Home: function() {handle.setFocus(0);},
    - End: function() {handle.setFocus(handle.length - 1);},
    - Enter: handle.pick,
    - Tab: handle.pick,
    - Esc: handle.close
    - };
    -
    - var mac = /Mac/.test(navigator.platform);
    -
    - if (mac) {
    - baseMap["Ctrl-P"] = function() {handle.moveFocus(-1);};
    - baseMap["Ctrl-N"] = function() {handle.moveFocus(1);};
    - }
    -
    - var custom = completion.options.customKeys;
    - var ourMap = custom ? {} : baseMap;
    - function addBinding(key, val) {
    - var bound;
    - if (typeof val != "string")
    - bound = function(cm) { return val(cm, handle); };
    - // This mechanism is deprecated
    - else if (baseMap.hasOwnProperty(val))
    - bound = baseMap[val];
    - else
    - bound = val;
    - ourMap[key] = bound;
    - }
    - if (custom)
    - for (var key in custom) if (custom.hasOwnProperty(key))
    - addBinding(key, custom[key]);
    - var extra = completion.options.extraKeys;
    - if (extra)
    - for (var key in extra) if (extra.hasOwnProperty(key))
    - addBinding(key, extra[key]);
    - return ourMap;
    - }
    -
    - function getHintElement(hintsElement, el) {
    - while (el && el != hintsElement) {
    - if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el;
    - el = el.parentNode;
    - }
    - }
    -
    - function Widget(completion, data) {
    - this.completion = completion;
    - this.data = data;
    - this.picked = false;
    - var widget = this, cm = completion.cm;
    - var ownerDocument = cm.getInputField().ownerDocument;
    - var parentWindow = ownerDocument.defaultView || ownerDocument.parentWindow;
    -
    - var hints = this.hints = ownerDocument.createElement("ul");
    - var theme = completion.cm.options.theme;
    - hints.className = "CodeMirror-hints " + theme;
    - this.selectedHint = data.selectedHint || 0;
    -
    - var completions = data.list;
    - for (var i = 0; i < completions.length; ++i) {
    - var elt = hints.appendChild(ownerDocument.createElement("li")), cur = completions[i];
    - var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS);
    - if (cur.className != null) className = cur.className + " " + className;
    - elt.className = className;
    - if (cur.render) cur.render(elt, data, cur);
    - else elt.appendChild(ownerDocument.createTextNode(cur.displayText || getText(cur)));
    - elt.hintId = i;
    - }
    -
    - var container = completion.options.container || ownerDocument.body;
    - var pos = cm.cursorCoords(completion.options.alignWithWord ? data.from : null);
    - var left = pos.left, top = pos.bottom, below = true;
    - var offsetLeft = 0, offsetTop = 0;
    - if (container !== ownerDocument.body) {
    - // We offset the cursor position because left and top are relative to the offsetParent's top left corner.
    - var isContainerPositioned = ['absolute', 'relative', 'fixed'].indexOf(parentWindow.getComputedStyle(container).position) !== -1;
    - var offsetParent = isContainerPositioned ? container : container.offsetParent;
    - var offsetParentPosition = offsetParent.getBoundingClientRect();
    - var bodyPosition = ownerDocument.body.getBoundingClientRect();
    - offsetLeft = (offsetParentPosition.left - bodyPosition.left - offsetParent.scrollLeft);
    - offsetTop = (offsetParentPosition.top - bodyPosition.top - offsetParent.scrollTop);
    - }
    - hints.style.left = (left - offsetLeft) + "px";
    - hints.style.top = (top - offsetTop) + "px";
    -
    - // If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
    - var winW = parentWindow.innerWidth || Math.max(ownerDocument.body.offsetWidth, ownerDocument.documentElement.offsetWidth);
    - var winH = parentWindow.innerHeight || Math.max(ownerDocument.body.offsetHeight, ownerDocument.documentElement.offsetHeight);
    - container.appendChild(hints);
    - var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH;
    - var scrolls = hints.scrollHeight > hints.clientHeight + 1
    - var startScroll = cm.getScrollInfo();
    -
    - if (overlapY > 0) {
    - var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top);
    - if (curTop - height > 0) { // Fits above cursor
    - hints.style.top = (top = pos.top - height - offsetTop) + "px";
    - below = false;
    - } else if (height > winH) {
    - hints.style.height = (winH - 5) + "px";
    - hints.style.top = (top = pos.bottom - box.top - offsetTop) + "px";
    - var cursor = cm.getCursor();
    - if (data.from.ch != cursor.ch) {
    - pos = cm.cursorCoords(cursor);
    - hints.style.left = (left = pos.left - offsetLeft) + "px";
    - box = hints.getBoundingClientRect();
    - }
    - }
    - }
    - var overlapX = box.right - winW;
    - if (overlapX > 0) {
    - if (box.right - box.left > winW) {
    - hints.style.width = (winW - 5) + "px";
    - overlapX -= (box.right - box.left) - winW;
    - }
    - hints.style.left = (left = pos.left - overlapX - offsetLeft) + "px";
    - }
    - if (scrolls) for (var node = hints.firstChild; node; node = node.nextSibling)
    - node.style.paddingRight = cm.display.nativeBarWidth + "px"
    -
    - cm.addKeyMap(this.keyMap = buildKeyMap(completion, {
    - moveFocus: function(n, avoidWrap) { widget.changeActive(widget.selectedHint + n, avoidWrap); },
    - setFocus: function(n) { widget.changeActive(n); },
    - menuSize: function() { return widget.screenAmount(); },
    - length: completions.length,
    - close: function() { completion.close(); },
    - pick: function() { widget.pick(); },
    - data: data
    - }));
    -
    - if (completion.options.closeOnUnfocus) {
    - var closingOnBlur;
    - cm.on("blur", this.onBlur = function() { closingOnBlur = setTimeout(function() { completion.close(); }, 100); });
    - cm.on("focus", this.onFocus = function() { clearTimeout(closingOnBlur); });
    - }
    -
    - cm.on("scroll", this.onScroll = function() {
    - var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect();
    - var newTop = top + startScroll.top - curScroll.top;
    - var point = newTop - (parentWindow.pageYOffset || (ownerDocument.documentElement || ownerDocument.body).scrollTop);
    - if (!below) point += hints.offsetHeight;
    - if (point <= editor.top || point >= editor.bottom) return completion.close();
    - hints.style.top = newTop + "px";
    - hints.style.left = (left + startScroll.left - curScroll.left) + "px";
    - });
    -
    - CodeMirror.on(hints, "dblclick", function(e) {
    - var t = getHintElement(hints, e.target || e.srcElement);
    - if (t && t.hintId != null) {widget.changeActive(t.hintId); widget.pick();}
    - });
    -
    - CodeMirror.on(hints, "click", function(e) {
    - var t = getHintElement(hints, e.target || e.srcElement);
    - if (t && t.hintId != null) {
    - widget.changeActive(t.hintId);
    - if (completion.options.completeOnSingleClick) widget.pick();
    - }
    - });
    -
    - CodeMirror.on(hints, "mousedown", function() {
    - setTimeout(function(){cm.focus();}, 20);
    - });
    -
    - CodeMirror.signal(data, "select", completions[this.selectedHint], hints.childNodes[this.selectedHint]);
    - return true;
    - }
    -
    - Widget.prototype = {
    - close: function() {
    - if (this.completion.widget != this) return;
    - this.completion.widget = null;
    - this.hints.parentNode.removeChild(this.hints);
    - this.completion.cm.removeKeyMap(this.keyMap);
    -
    - var cm = this.completion.cm;
    - if (this.completion.options.closeOnUnfocus) {
    - cm.off("blur", this.onBlur);
    - cm.off("focus", this.onFocus);
    - }
    - cm.off("scroll", this.onScroll);
    - },
    -
    - disable: function() {
    - this.completion.cm.removeKeyMap(this.keyMap);
    - var widget = this;
    - this.keyMap = {Enter: function() { widget.picked = true; }};
    - this.completion.cm.addKeyMap(this.keyMap);
    - },
    -
    - pick: function() {
    - this.completion.pick(this.data, this.selectedHint);
    - },
    -
    - changeActive: function(i, avoidWrap) {
    - if (i >= this.data.list.length)
    - i = avoidWrap ? this.data.list.length - 1 : 0;
    - else if (i < 0)
    - i = avoidWrap ? 0 : this.data.list.length - 1;
    - if (this.selectedHint == i) return;
    - var node = this.hints.childNodes[this.selectedHint];
    - if (node) node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, "");
    - node = this.hints.childNodes[this.selectedHint = i];
    - node.className += " " + ACTIVE_HINT_ELEMENT_CLASS;
    - if (node.offsetTop < this.hints.scrollTop)
    - this.hints.scrollTop = node.offsetTop - 3;
    - else if (node.offsetTop + node.offsetHeight > this.hints.scrollTop + this.hints.clientHeight)
    - this.hints.scrollTop = node.offsetTop + node.offsetHeight - this.hints.clientHeight + 3;
    - CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node);
    - },
    -
    - screenAmount: function() {
    - return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1;
    - }
    - };
    -
    - function applicableHelpers(cm, helpers) {
    - if (!cm.somethingSelected()) return helpers
    - var result = []
    - for (var i = 0; i < helpers.length; i++)
    - if (helpers[i].supportsSelection) result.push(helpers[i])
    - return result
    - }
    -
    - function fetchHints(hint, cm, options, callback) {
    - if (hint.async) {
    - hint(cm, callback, options)
    - } else {
    - var result = hint(cm, options)
    - if (result && result.then) result.then(callback)
    - else callback(result)
    - }
    - }
    -
    - function resolveAutoHints(cm, pos) {
    - var helpers = cm.getHelpers(pos, "hint"), words
    - if (helpers.length) {
    - var resolved = function(cm, callback, options) {
    - var app = applicableHelpers(cm, helpers);
    - function run(i) {
    - if (i == app.length) return callback(null)
    - fetchHints(app[i], cm, options, function(result) {
    - if (result && result.list.length > 0) callback(result)
    - else run(i + 1)
    - })
    - }
    - run(0)
    - }
    - resolved.async = true
    - resolved.supportsSelection = true
    - return resolved
    - } else if (words = cm.getHelper(cm.getCursor(), "hintWords")) {
    - return function(cm) { return CodeMirror.hint.fromList(cm, {words: words}) }
    - } else if (CodeMirror.hint.anyword) {
    - return function(cm, options) { return CodeMirror.hint.anyword(cm, options) }
    - } else {
    - return function() {}
    - }
    - }
    -
    - CodeMirror.registerHelper("hint", "auto", {
    - resolve: resolveAutoHints
    - });
    -
    - CodeMirror.registerHelper("hint", "fromList", function(cm, options) {
    - var cur = cm.getCursor(), token = cm.getTokenAt(cur)
    - var term, from = CodeMirror.Pos(cur.line, token.start), to = cur
    - if (token.start < cur.ch && /\w/.test(token.string.charAt(cur.ch - token.start - 1))) {
    - term = token.string.substr(0, cur.ch - token.start)
    - } else {
    - term = ""
    - from = cur
    - }
    - var found = [];
    - for (var i = 0; i < options.words.length; i++) {
    - var word = options.words[i];
    - if (word.slice(0, term.length) == term)
    - found.push(word);
    - }
    -
    - if (found.length) return {list: found, from: from, to: to};
    - });
    -
    - CodeMirror.commands.autocomplete = CodeMirror.showHint;
    -
    - var defaultOptions = {
    - hint: CodeMirror.hint.auto,
    - completeSingle: true,
    - alignWithWord: true,
    - closeCharacters: /[\s()\[\]{};:>,]/,
    - closeOnUnfocus: true,
    - completeOnSingleClick: true,
    - container: null,
    - customKeys: null,
    - extraKeys: null
    - };
    -
    - CodeMirror.defineOption("hintOptions", null);
    - });
    - ;
    -
    - "use strict"
    - class Timer {
    - constructor() {
    - this._tickTime = Date.now() - (TreeUtils.isNodeJs() ? 1000 * process.uptime() : 0)
    - this._firstTickTime = this._tickTime
    - }
    - tick(msg) {
    - const elapsed = Date.now() - this._tickTime
    - if (msg) console.log(`${elapsed}ms ${msg}`)
    - this._tickTime = Date.now()
    - return elapsed
    - }
    - getTotalElapsedTime() {
    - return Date.now() - this._firstTickTime
    - }
    - }
    - class TreeUtils {
    - static getFileExtension(filepath = "") {
    - const match = filepath.match(/\.([^\.]+)$/)
    - return (match && match[1]) || ""
    - }
    - static isNodeJs() {
    - return typeof exports !== "undefined"
    - }
    - static findProjectRoot(startingDirName, projectName) {
    - const fs = require("fs")
    - const getProjectName = dirName => {
    - if (!dirName) throw new Error(`dirName undefined when attempting to findProjectRoot for project "${projectName}" starting in "${startingDirName}"`)
    - const parts = dirName.split("/")
    - const filename = parts.join("/") + "/" + "package.json"
    - if (fs.existsSync(filename) && JSON.parse(fs.readFileSync(filename, "utf8")).name === projectName) return parts.join("/") + "/"
    - parts.pop()
    - return parts
    - }
    - let result = getProjectName(startingDirName)
    - while (typeof result !== "string" && result.length > 0) {
    - result = getProjectName(result.join("/"))
    - }
    - if (result.length === 0) throw new Error(`Project root "${projectName}" in folder ${startingDirName} not found.`)
    - return result
    - }
    - static escapeRegExp(str) {
    - return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
    - }
    - static sum(arr) {
    - return arr.reduce((curr, next) => curr + next, 0)
    - }
    - static makeVector(length, fill = 0) {
    - return new Array(length).fill(fill)
    - }
    - static makeMatrix(cols, rows, fill = 0) {
    - const matrix = []
    - while (rows) {
    - matrix.push(TreeUtils.makeVector(cols, fill))
    - rows--
    - }
    - return matrix
    - }
    - static removeNonAscii(str) {
    - // https://stackoverflow.com/questions/20856197/remove-non-ascii-character-in-string
    - return str.replace(/[^\x00-\x7F]/g, "")
    - }
    - static getMethodFromDotPath(context, str) {
    - const methodParts = str.split(".")
    - while (methodParts.length > 1) {
    - const methodName = methodParts.shift()
    - if (!contextethodName]) throw new Error(`${methodName} is not a method on ${context}`)
    - context = contextethodName]()
    - }
    - const final = methodParts.shift()
    - return [context, final]
    - }
    - static requireAbsOrRelative(filePath, contextFilePath) {
    - if (!filePath.startsWith(".")) return require(filePath)
    - const path = require("path")
    - const folder = this.getPathWithoutFileName(contextFilePath)
    - const file = path.resolve(folder + "/" + filePath)
    - return require(file)
    - }
    - // Removes last ".*" from this string
    - static removeFileExtension(filename) {
    - return filename ? filename.replace(/\.[^\.]+$/, "") : ""
    - }
    - static getFileName(path) {
    - const parts = path.split("/") // todo: change for windows?
    - return parts.pop()
    - }
    - static getPathWithoutFileName(path) {
    - const parts = path.split("/") // todo: change for windows?
    - parts.pop()
    - return parts.join("/")
    - }
    - static shuffleInPlace(arr, seed = Date.now()) {
    - // https://stackoverflow.com/questions/6274339/how-can-i-shuffle-an-array
    - const randFn = TreeUtils._getPseudoRandom0to1FloatGenerator(seed)
    - for (let index = arr.length - 1; index > 0; index--) {
    - const tempIndex = Math.floor(randFn() * (index + 1))
    - ;[arr[index], arr[tempIndex]] = [arr[tempIndex], arr[index]]
    - }
    - return arr
    - }
    - // Only allows a-zA-Z0-9-_ (And optionally .)
    - static _permalink(str, reg) {
    - return str.length
    - ? str
    - .toLowerCase()
    - .replace(reg, "")
    - .replace(/ /g, "-")
    - : ""
    - }
    - static isValueEmpty(value) {
    - return value === undefined || value === "" || (typeof value === "number" && isNaN(value)) || (value instanceof Date && isNaN(value))
    - }
    - static stringToPermalink(str) {
    - return this._permalink(str, /[^a-z0-9- _\.]/gi)
    - }
    - static getAvailablePermalink(permalink, doesFileExistSyncFn) {
    - const extension = this.getFileExtension(permalink)
    - permalink = this.removeFileExtension(permalink)
    - const originalPermalink = permalink
    - let num = 2
    - let suffix = ""
    - let filename = `${originalPermalink}${suffix}.${extension}`
    - while (doesFileExistSyncFn(filename)) {
    - filename = `${originalPermalink}${suffix}.${extension}`
    - suffix = "-" + num
    - num++
    - }
    - return filename
    - }
    - static getNextOrPrevious(arr, item) {
    - const length = arr.length
    - const index = arr.indexOf(item)
    - if (length === 1) return undefined
    - if (index === length - 1) return arr[index - 1]
    - return arr[index + 1]
    - }
    - static toggle(currentValue, values) {
    - const index = values.indexOf(currentValue)
    - return index === -1 || index + 1 === values.length ? values[0] : values[index + 1]
    - }
    - static getClassNameFromFilePath(filepath) {
    - return this.removeFileExtension(this.getFileName(filepath))
    - }
    - static joinArraysOn(joinOn, arrays, columns) {
    - const rows = {}
    - let index = 0
    - if (!columns) columns = arrays.map(arr => Object.keys(arr[0]))
    - arrays.forEach((arr, index) => {
    - const cols = columns[index]
    - arr.forEach(row => {
    - const key = joinOn ? row[joinOn] : index++
    - if (!rows[key]) rows[key] = {}
    - const obj = rows[key]
    - cols.forEach(col => (obj[col] = row[col]))
    - })
    - })
    - return Object.values(rows)
    - }
    - static getParentFolder(path) {
    - if (path.endsWith("/")) path = this._removeLastSlash(path)
    - return path.replace(/\/[^\/]*$/, "") + "/"
    - }
    - static _removeLastSlash(path) {
    - return path.replace(/\/$/, "")
    - }
    - static _listToEnglishText(list, limit = 5) {
    - const len = list.length
    - if (!len) return ""
    - if (len === 1) return `'${list[0]}'`
    - const clone = list.slice(0, limit).map(item => `'${item}'`)
    - const last = clone.pop()
    - if (len <= limit) return clone.join(", ") + ` and ${last}`
    - return clone.join(", ") + ` and ${len - limit} more`
    - }
    - // todo: refactor so instead of str input takes an array of cells(strings) and scans each indepndently.
    - static _chooseDelimiter(str) {
    - const del = " ,|\t;^%$!#@~*&+-=_:?.{}[]()<>/".split("").find(idea => !str.includes(idea))
    - if (!del) throw new Error("Could not find a delimiter")
    - return del
    - }
    - static flatten(arr) {
    - if (arr.flat) return arr.flat()
    - return arr.reduce((acc, val) => acc.concat(val), [])
    - }
    - static escapeBackTicks(str) {
    - return str.replace(/\`/g, "\\`").replace(/\$\{/g, "\\${")
    - }
    - static ucfirst(str) {
    - return str.charAt(0).toUpperCase() + str.slice(1)
    - }
    - // Adapted from: https://github.com/dcporter/didyoumean.js/blob/master/didYouMean-1.2.1.js
    - static didYouMean(str = "", options = [], caseSensitive = false, threshold = 0.4, thresholdAbsolute = 20) {
    - if (!caseSensitive) str = str.toLowerCase()
    - // Calculate the initial value (the threshold) if present.
    - const thresholdRelative = threshold * str.length
    - let maximumEditDistanceToBeBestMatch
    - if (thresholdRelative !== null && thresholdAbsolute !== null) maximumEditDistanceToBeBestMatch = Math.min(thresholdRelative, thresholdAbsolute)
    - else if (thresholdRelative !== null) maximumEditDistanceToBeBestMatch = thresholdRelative
    - else if (thresholdAbsolute !== null) maximumEditDistanceToBeBestMatch = thresholdAbsolute
    - // Get the edit distance to each option. If the closest one is less than 40% (by default) of str's length, then return it.
    - let closestMatch
    - const len = options.length
    - for (let optionIndex = 0; optionIndex < len; optionIndex++) {
    - const candidate = options[optionIndex]
    - if (!candidate) continue
    - const editDistance = TreeUtils._getEditDistance(str, caseSensitive ? candidate : candidate.toLowerCase(), maximumEditDistanceToBeBestMatch)
    - if (editDistance < maximumEditDistanceToBeBestMatch) {
    - maximumEditDistanceToBeBestMatch = editDistance
    - closestMatch = candidate
    - }
    - }
    - return closestMatch
    - }
    - // Adapted from: https://github.com/dcporter/didyoumean.js/blob/master/didYouMean-1.2.1.js
    - static _getEditDistance(stringA, stringB, maxInt) {
    - // Handle null or undefined max.
    - maxInt = maxInt || maxInt === 0 ? maxInt : TreeUtils.MAX_INT
    - const aLength = stringA.length
    - const bLength = stringB.length
    - // Fast path - no A or B.
    - if (aLength === 0) return Math.min(maxInt + 1, bLength)
    - if (bLength === 0) return Math.min(maxInt + 1, aLength)
    - // Fast path - length diff larger than max.
    - if (Math.abs(aLength - bLength) > maxInt) return maxInt + 1
    - // Slow path.
    - const matrix = []
    - // Set up the first row ([0, 1, 2, 3, etc]).
    - for (let bIndex = 0; bIndex <= bLength; bIndex++) {
    - matrix[bIndex] = [bIndex]
    - }
    - // Set up the first column (same).
    - for (let aIndex = 0; aIndex <= aLength; aIndex++) {
    - matrix[0][aIndex] = aIndex
    - }
    - let colMin
    - let minJ
    - let maxJ
    - // Loop over the rest of the columns.
    - for (let bIndex = 1; bIndex <= bLength; bIndex++) {
    - colMin = TreeUtils.MAX_INT
    - minJ = 1
    - if (bIndex > maxInt) minJ = bIndex - maxInt
    - maxJ = bLength + 1
    - if (maxJ > maxInt + bIndex) maxJ = maxInt + bIndex
    - // Loop over the rest of the rows.
    - for (let aIndex = 1; aIndex <= aLength; aIndex++) {
    - // If j is out of bounds, just put a large value in the slot.
    - if (aIndex < minJ || aIndex > maxJ) matrix[bIndex][aIndex] = maxInt + 1
    - // Otherwise do the normal Levenshtein thing.
    - else {
    - // If the characters are the same, there's no change in edit distance.
    - if (stringB.charAt(bIndex - 1) === stringA.charAt(aIndex - 1)) matrix[bIndex][aIndex] = matrix[bIndex - 1][aIndex - 1]
    - // Otherwise, see if we're substituting, inserting or deleting.
    - else
    - matrix[bIndex][aIndex] = Math.min(
    - matrix[bIndex - 1][aIndex - 1] + 1, // Substitute
    - Math.min(
    - matrix[bIndex][aIndex - 1] + 1, // Insert
    - matrix[bIndex - 1][aIndex] + 1
    - )
    - ) // Delete
    - }
    - // Either way, update colMin.
    - if (matrix[bIndex][aIndex] < colMin) colMin = matrix[bIndex][aIndex]
    - }
    - // If this column's minimum is greater than the allowed maximum, there's no point
    - // in going on with life.
    - if (colMin > maxInt) return maxInt + 1
    - }
    - // If we made it this far without running into the max, then return the final matrix value.
    - return matrix[bLength][aLength]
    - }
    - static getLineIndexAtCharacterPosition(str, index) {
    - const lines = str.split("\n")
    - const len = lines.length
    - let position = 0
    - for (let lineNumber = 0; lineNumber < len; lineNumber++) {
    - position += lines[lineNumber].length
    - if (position >= index) return lineNumber
    - }
    - }
    - static resolvePath(filePath, programFilepath) {
    - // For use in Node.js only
    - if (!filePath.startsWith(".")) return filePath
    - const path = require("path")
    - const folder = this.getPathWithoutFileName(programFilepath)
    - return path.resolve(folder + "/" + filePath)
    - }
    - static resolveProperty(obj, path, separator = ".") {
    - const properties = Array.isArray(path) ? path : path.split(separator)
    - return properties.reduce((prev, curr) => prev && prev[curr], obj)
    - }
    - static appendCodeAndReturnValueOnWindow(code, name) {
    - const script = document.createElement("script")
    - script.innerHTML = code
    - document.head.appendChild(script)
    - return window[name]
    - }
    - static formatStr(str, catchAllCellDelimiter = " ", parameterMap) {
    - return str.replace(/{([^\}]+)}/g, (match, path) => {
    - const val = parameterMap[path]
    - if (!val) return ""
    - return Array.isArray(val) ? val.join(catchAllCellDelimiter) : val
    - })
    - }
    - static stripHtml(text) {
    - return text && text.replace ? text.replace(/<(?:.|\n)*?>/gm, "") : text
    - }
    - static getUniqueWordsArray(allWords) {
    - const words = allWords.replace(/\n/g, " ").split(" ")
    - const index = {}
    - words.forEach(word => {
    - if (!index[word]) index[word] = 0
    - index[word]++
    - })
    - return Object.keys(index).map(key => {
    - return {
    - word: key,
    - count: index[key]
    - }
    - })
    - }
    - static getRandomString(length = 30, letters = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""), seed = Date.now()) {
    - let str = ""
    - const randFn = TreeUtils._getPseudoRandom0to1FloatGenerator(seed)
    - while (length) {
    - str += letters[Math.round(Math.min(randFn() * letters.length, letters.length - 1))]
    - length--
    - }
    - return str
    - }
    - // todo: add seed!
    - static makeRandomTree(lines = 1000, seed = Date.now()) {
    - let str = ""
    - let letters = " 123abc".split("")
    - const randFn = TreeUtils._getPseudoRandom0to1FloatGenerator(seed)
    - while (lines) {
    - let indent = " ".repeat(Math.round(randFn() * 6))
    - let bit = indent
    - let rand = Math.floor(randFn() * 30)
    - while (rand) {
    - bit += letters[Math.round(Math.min(randFn() * letters.length, letters.length - 1))]
    - rand--
    - }
    - bit += "\n"
    - str += bit
    - lines--
    - }
    - return str
    - }
    - // adapted from https://gist.github.com/blixt/f17b47c62508be59987b
    - // 1993 Park-Miller LCG
    - static _getPseudoRandom0to1FloatGenerator(seed) {
    - return function() {
    - seed = Math.imul(48271, seed) | 0 % 2147483647
    - return (seed & 2147483647) / 2147483648
    - }
    - }
    - static sampleWithoutReplacement(population = [], quantity, seed) {
    - const prng = this._getPseudoRandom0to1FloatGenerator(seed)
    - const sampled = {}
    - const populationSize = population.length
    - if (quantity >= populationSize) return population.slice(0)
    - const picked = []
    - while (picked.length < quantity) {
    - const index = Math.floor(prng() * populationSize)
    - if (sampled[index]) continue
    - sampled[index] = true
    - picked.push(population[index])
    - }
    - return picked
    - }
    - static arrayToMap(arr) {
    - const map = {}
    - arr.forEach(val => (map[val] = true))
    - return map
    - }
    - static _replaceNonAlphaNumericCharactersWithCharCodes(str) {
    - return str
    - .replace(/[^a-zA-Z0-9]/g, sub => {
    - return "_" + sub.charCodeAt(0).toString()
    - })
    - .replace(/^([0-9])/, "number$1")
    - }
    - static mapValues(object, fn) {
    - const result = {}
    - Object.keys(object).forEach(key => {
    - result[key] = fn(key)
    - })
    - return result
    - }
    - static javascriptTableWithHeaderRowToObjects(dataTable) {
    - dataTable = dataTable.slice()
    - const header = dataTable.shift()
    - return dataTable.map(row => {
    - const obj = {}
    - header.forEach((colName, index) => (obj[colName] = row[index]))
    - return obj
    - })
    - }
    - static interweave(arrayOfArrays) {
    - const lineCount = Math.max(...arrayOfArrays.map(arr => arr.length))
    - const totalArrays = arrayOfArrays.length
    - const result = []
    - arrayOfArrays.forEach((lineArray, arrayIndex) => {
    - for (let lineIndex = 0; lineIndex < lineCount; lineIndex++) {
    - result[lineIndex * totalArrays + arrayIndex] = lineArray[lineIndex]
    - }
    - })
    - return result
    - }
    - static makeSortByFn(accessorOrAccessors) {
    - const arrayOfFns = Array.isArray(accessorOrAccessors) ? accessorOrAccessors : [accessorOrAccessors]
    - return (objectA, objectB) => {
    - const nodeAFirst = -1
    - const nodeBFirst = 1
    - const accessor = arrayOfFns[0] // todo: handle accessors
    - const av = accessor(objectA)
    - const bv = accessor(objectB)
    - let result = av < bv ? nodeAFirst : av > bv ? nodeBFirst : 0
    - if (av === undefined && bv !== undefined) result = nodeAFirst
    - else if (bv === undefined && av !== undefined) result = nodeBFirst
    - return result
    - }
    - }
    - static _makeGraphSortFunctionFromGraph(idAccessor, graph) {
    - return (nodeA, nodeB) => {
    - const nodeAFirst = -1
    - const nodeBFirst = 1
    - const nodeAUniqueId = idAccessor(nodeA)
    - const nodeBUniqueId = idAccessor(nodeB)
    - const nodeAExtendsNodeB = graph[nodeAUniqueId].has(nodeBUniqueId)
    - const nodeBExtendsNodeA = graph[nodeBUniqueId].has(nodeAUniqueId)
    - if (nodeAExtendsNodeB) return nodeBFirst
    - else if (nodeBExtendsNodeA) return nodeAFirst
    - const nodeAExtendsSomething = graph[nodeAUniqueId].size > 1
    - const nodeBExtendsSomething = graph[nodeBUniqueId].size > 1
    - if (!nodeAExtendsSomething && nodeBExtendsSomething) return nodeAFirst
    - else if (!nodeBExtendsSomething && nodeAExtendsSomething) return nodeBFirst
    - if (nodeAUniqueId > nodeBUniqueId) return nodeBFirst
    - else if (nodeAUniqueId < nodeBUniqueId) return nodeAFirst
    - return 0
    - }
    - }
    - static removeAll(str, needle) {
    - return str.split(needle).join("")
    - }
    - static _makeGraphSortFunction(idAccessor, extendsIdAccessor) {
    - return (nodeA, nodeB) => {
    - // -1 === a before b
    - const nodeAUniqueId = idAccessor(nodeA)
    - const nodeAExtends = extendsIdAccessor(nodeA)
    - const nodeBUniqueId = idAccessor(nodeB)
    - const nodeBExtends = extendsIdAccessor(nodeB)
    - const nodeAExtendsNodeB = nodeAExtends === nodeBUniqueId
    - const nodeBExtendsNodeA = nodeBExtends === nodeAUniqueId
    - const nodeAFirst = -1
    - const nodeBFirst = 1
    - if (!nodeAExtends && !nodeBExtends) {
    - // If neither extends, sort by firstWord
    - if (nodeAUniqueId > nodeBUniqueId) return nodeBFirst
    - else if (nodeAUniqueId < nodeBUniqueId) return nodeAFirst
    - return 0
    - }
    - // If only one extends, the other comes first
    - else if (!nodeAExtends) return nodeAFirst
    - else if (!nodeBExtends) return nodeBFirst
    - // If A extends B, B should come first
    - if (nodeAExtendsNodeB) return nodeBFirst
    - else if (nodeBExtendsNodeA) return nodeAFirst
    - // Sort by what they extend
    - if (nodeAExtends > nodeBExtends) return nodeBFirst
    - else if (nodeAExtends < nodeBExtends) return nodeAFirst
    - // Finally sort by firstWord
    - if (nodeAUniqueId > nodeBUniqueId) return nodeBFirst
    - else if (nodeAUniqueId < nodeBUniqueId) return nodeAFirst
    - // Should never hit this, unless we have a duplicate line.
    - return 0
    - }
    - }
    - }
    - TreeUtils.Timer = Timer
    - //http://stackoverflow.com/questions/37684/how-to-replace-plain-urls-with-links#21925491
    - TreeUtils.linkify = text => {
    - let replacedText
    - let replacePattern1
    - let replacePattern2
    - let replacePattern3
    - //URLs starting with http://, https://, or ftp://
    - replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim
    - replacedText = text.replace(replacePattern1, '$1')
    - //URLs starting with "www." (without // before it, or it'd re-link the ones done above).
    - replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim
    - replacedText = replacedText.replace(replacePattern2, '$1$2')
    - //Change email addresses to mailto:: links.
    - replacePattern3 = /(([a-zA-Z0-9\-\_\.])+@[a-zA-Z\_]+?(\.[a-zA-Z]{2,6})+)/gim
    - replacedText = replacedText.replace(replacePattern3, '$1')
    - return replacedText
    - }
    - // todo: switch algo to: http://indiegamr.com/generate-repeatable-random-numbers-in-js/?
    - TreeUtils.makeSemiRandomFn = (seed = Date.now()) => {
    - return () => {
    - const semiRand = Math.sin(seed++) * 10000
    - return semiRand - Math.floor(semiRand)
    - }
    - }
    - TreeUtils.randomUniformInt = (min, max, seed = Date.now()) => {
    - return Math.floor(TreeUtils.randomUniformFloat(min, max, seed))
    - }
    - TreeUtils.randomUniformFloat = (min, max, seed = Date.now()) => {
    - const randFn = TreeUtils.makeSemiRandomFn(seed)
    - return min + (max - min) * randFn()
    - }
    - TreeUtils.getRange = (startIndex, endIndexExclusive, increment = 1) => {
    - const range = []
    - for (let index = startIndex; index < endIndexExclusive; index = index + increment) {
    - range.push(index)
    - }
    - return range
    - }
    - TreeUtils.MAX_INT = Math.pow(2, 32) - 1
    - window.TreeUtils = TreeUtils
    - class TestRacerTestBlock {
    - constructor(testFile, testName, fn) {
    - this._parentFile = testFile
    - this._testName = testName
    - this._testFn = fn
    - }
    - _emitMessage(message) {
    - this._parentFile.getRunner()._emitMessage(message)
    - return message
    - }
    - async execute() {
    - let passes = []
    - let failures = []
    - const assertEqual = (actual, expected, message = "") => {
    - if (expected === actual) {
    - passes.push(message)
    - } else {
    - failures.push([actual, expected, message])
    - }
    - }
    - try {
    - await this._testFn(assertEqual)
    - } catch (err) {
    - failures.push([
    - "1",
    - "0",
    - `Should not have uncaught errors but in ${this._testName} got error:
    - toString:
    - ${new TreeNode(err.toString()).toString(2)}
    - stack:
    - ${new TreeNode(err.stack).toString(2)}`
    - ])
    - }
    - failures.length ? this._emitBlockFailedMessage(failures) : this._emitBlockPassedMessage(passes)
    - return {
    - passes,
    - failures
    - }
    - }
    - _emitBlockPassedMessage(passes) {
    - this._emitMessage(`ok block ${this._testName} - ${passes.length} passed`)
    - }
    - _emitBlockFailedMessage(failures) {
    - // todo: should replace not replace last newline?
    - // todo: do side by side.
    - // todo: add diff.
    - this._emitMessage(`failed block ${this._testName}`)
    - this._emitMessage(
    - failures
    - .map(failure => {
    - const actualVal = failure[0] === undefined ? "undefined" : failure[0].toString()
    - const expectedVal = failure[1] === undefined ? "undefined" : failure[1].toString()
    - const actual = new jtree.TreeNode(`actual\n${new jtree.TreeNode(actualVal).toString(1)}`)
    - const expected = new jtree.TreeNode(`expected\n${new jtree.TreeNode(expectedVal.toString()).toString(1)}`)
    - const comparison = actual.toComparison(expected)
    - return new jtree.TreeNode(` assertion ${failure[2]}\n${comparison.toSideBySide([actual, expected]).toString(2)}`)
    - })
    - .join("\n")
    - )
    - }
    - }
    - class TestRacerFile {
    - constructor(runner, testTree, fileName) {
    - this._runner = runner
    - this._testTree = {}
    - this._fileName = fileName
    - Object.keys(testTree).forEach(key => {
    - this._testTree[key] = new TestRacerTestBlock(this, key, testTree[key])
    - })
    - }
    - getRunner() {
    - return this._runner
    - }
    - getFileName() {
    - return this._fileName
    - }
    - get length() {
    - return Object.values(this._testTree).length
    - }
    - get skippedTestBlockNames() {
    - const testsToRun = this._filterSkippedTestBlocks()
    - return Object.keys(this._testTree).filter(blockName => !testsToRun.includes(blockName))
    - }
    - _emitMessage(message) {
    - this.getRunner()._emitMessage(message)
    - }
    - _filterSkippedTestBlocks() {
    - // _ prefix = run on these tests block
    - // $ prefix = skip this test
    - const runOnlyTheseTestBlocks = Object.keys(this._testTree).filter(key => key.startsWith("_"))
    - if (runOnlyTheseTestBlocks.length) return runOnlyTheseTestBlocks
    - return Object.keys(this._testTree).filter(key => !key.startsWith("$"))
    - }
    - async execute() {
    - const testBlockNames = this._filterSkippedTestBlocks()
    - this._emitStartFileMessage(testBlockNames.length)
    - const fileTimer = new TreeUtils.Timer()
    - const blockResults = {}
    - const blockPromises = testBlockNames.map(async testName => {
    - const results = await this._testTree[testName].execute()
    - blockResults[testName] = results
    - })
    - await Promise.all(blockPromises)
    - const fileStats = this._aggregateBlockResultsIntoFileResults(blockResults)
    - const fileTimeElapsed = fileTimer.tick()
    - fileStats.blocksFailed ? this._emitFileFailedMessage(fileStats, fileTimeElapsed, testBlockNames.length) : this._emitFilePassedMessage(fileStats, fileTimeElapsed, testBlockNames.length)
    - return fileStats
    - }
    - _aggregateBlockResultsIntoFileResults(fileBlockResults) {
    - const fileStats = {
    - assertionsPassed: 0,
    - assertionsFailed: 0,
    - blocksPassed: 0,
    - blocksFailed: 0,
    - failedBlocks: []
    - }
    - Object.keys(fileBlockResults).forEach(blockName => {
    - const results = fileBlockResults[blockName]
    - fileStats.assertionsPassed += results.passes.length
    - fileStats.assertionsFailed += results.failures.length
    - if (results.failures.length) {
    - fileStats.blocksFailed++
    - fileStats.failedBlocks.push(blockName)
    - } else fileStats.blocksPassed++
    - })
    - return fileStats
    - }
    - _emitStartFileMessage(blockCount) {
    - this._emitMessage(`start file ${blockCount} test blocks in file ${this._fileName}`)
    - }
    - _emitFilePassedMessage(fileStats, fileTimeElapsed, blockCount) {
    - this._emitMessage(`ok file ${this._fileName} in ${fileTimeElapsed}ms. ${blockCount} blocks and ${fileStats.assertionsPassed} assertions passed.`)
    - }
    - _emitFileFailedMessage(fileStats, fileTimeElapsed, blockCount) {
    - this._emitMessage(
    - `failed file ${this._fileName} over ${fileTimeElapsed}ms. ${fileStats.blocksFailed} blocks and ${fileStats.assertionsFailed} failed. ${blockCount - fileStats.blocksFailed} blocks and ${fileStats.assertionsPassed} assertions passed`
    - )
    - }
    - }
    - class TestRacer {
    - constructor(fileTestTree) {
    - this._logFunction = console.log
    - this._timer = new TreeUtils.Timer()
    - this._sessionFilesPassed = 0
    - this._sessionFilesFailed = {}
    - this._sessionBlocksFailed = 0
    - this._sessionBlocksPassed = 0
    - this._sessionAssertionsFailed = 0
    - this._sessionAssertionsPassed = 0
    - this._fileTestTree = {}
    - Object.keys(fileTestTree).forEach(fileName => {
    - this._fileTestTree[fileName] = new TestRacerFile(this, fileTestTree[fileName], fileName)
    - })
    - }
    - setLogFunction(logFunction) {
    - this._logFunction = logFunction
    - return this
    - }
    - _addFileResultsToSessionResults(fileStats, fileName) {
    - this._sessionAssertionsPassed += fileStats.assertionsPassed
    - this._sessionAssertionsFailed += fileStats.assertionsFailed
    - this._sessionBlocksPassed += fileStats.blocksPassed
    - this._sessionBlocksFailed += fileStats.blocksFailed
    - if (!fileStats.blocksFailed) this._sessionFilesPassed++
    - else {
    - this._sessionFilesFailed[fileName] = fileStats.failedBlocks
    - }
    - }
    - async execute() {
    - this._emitSessionPlanMessage()
    - const proms = Object.values(this._fileTestTree).map(async testFile => {
    - const results = await testFile.execute()
    - this._addFileResultsToSessionResults(results, testFile.getFileName())
    - })
    - await Promise.all(proms)
    - return this
    - }
    - finish() {
    - return this._emitSessionFinishMessage()
    - }
    - _emitMessage(message) {
    - this._logFunction(message)
    - return message
    - }
    - get length() {
    - return Object.values(this._fileTestTree).length
    - }
    - _emitSessionPlanMessage() {
    - let blocks = 0
    - Object.values(this._fileTestTree).forEach(value => (blocks += value.length))
    - this._emitMessage(`${this.length} files and ${blocks} blocks to run. ${this._getSkippedBlockNames().length} skipped blocks.`)
    - }
    - _getSkippedBlockNames() {
    - const skippedBlocks = []
    - Object.values(this._fileTestTree).forEach(file => {
    - file.skippedTestBlockNames.forEach(blockName => {
    - skippedBlocks.push(blockName)
    - })
    - })
    - return skippedBlocks
    - }
    - _getFailures() {
    - if (!Object.keys(this._sessionFilesFailed).length) return ""
    - return `
    - failures
    - ${new TreeNode(this._sessionFilesFailed).forEach(row => row.forEach(line => line.deleteWordAt(0))).toString(2)}`
    - }
    - _emitSessionFinishMessage() {
    - const skipped = this._getSkippedBlockNames()
    - return this._emitMessage(`finished in ${this._timer.getTotalElapsedTime()}ms
    - skipped
    - ${skipped.length} blocks${skipped ? " " + skipped.join(" ") : ""}
    - passed
    - ${this._sessionFilesPassed} files
    - ${this._sessionBlocksPassed} blocks
    - ${this._sessionAssertionsPassed} assertions
    - failed
    - ${Object.keys(this._sessionFilesFailed).length} files
    - ${this._sessionBlocksFailed} blocks
    - ${this._sessionAssertionsFailed} assertions${this._getFailures()}`)
    - }
    - static async testSingleFile(fileName, testTree) {
    - const obj = {}
    - obj[fileName] = testTree
    - const session = new TestRacer(obj)
    - await session.execute()
    - session.finish()
    - }
    - }
    - window.TestRacer = TestRacer
    - let _jtreeLatestTime = 0
    - let _jtreeMinTimeIncrement = 0.000000000001
    - class AbstractNode {
    - _getProcessTimeInMilliseconds() {
    - // We add this loop to restore monotonically increasing .now():
    - // https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
    - let time = performance.now()
    - while (time <= _jtreeLatestTime) {
    - if (time === time + _jtreeMinTimeIncrement)
    - // Some browsers have different return values for perf.now()
    - _jtreeMinTimeIncrement = 10 * _jtreeMinTimeIncrement
    - time += _jtreeMinTimeIncrement
    - }
    - _jtreeLatestTime = time
    - return time
    - }
    - }
    - var FileFormat
    - ;(function(FileFormat) {
    - FileFormat["csv"] = "csv"
    - FileFormat["tsv"] = "tsv"
    - FileFormat["tree"] = "tree"
    - })(FileFormat || (FileFormat = {}))
    - class AbstractTreeEvent {
    - constructor(targetNode) {
    - this.targetNode = targetNode
    - }
    - }
    - class ChildAddedTreeEvent extends AbstractTreeEvent {}
    - class ChildRemovedTreeEvent extends AbstractTreeEvent {}
    - class DescendantChangedTreeEvent extends AbstractTreeEvent {}
    - class LineChangedTreeEvent extends AbstractTreeEvent {}
    - class TreeWord {
    - constructor(node, cellIndex) {
    - this._node = node
    - this._cellIndex = cellIndex
    - }
    - replace(newWord) {
    - this._node.setWord(this._cellIndex, newWord)
    - }
    - get word() {
    - return this._node.getWord(this._cellIndex)
    - }
    - }
    - const TreeEvents = { ChildAddedTreeEvent, ChildRemovedTreeEvent, DescendantChangedTreeEvent, LineChangedTreeEvent }
    - var WhereOperators
    - ;(function(WhereOperators) {
    - WhereOperators["equal"] = "="
    - WhereOperators["notEqual"] = "!="
    - WhereOperators["lessThan"] = "<"
    - WhereOperators["lessThanOrEqual"] = "<="
    - WhereOperators["greaterThan"] = ">"
    - WhereOperators["greaterThanOrEqual"] = ">="
    - WhereOperators["includes"] = "includes"
    - WhereOperators["doesNotInclude"] = "doesNotInclude"
    - WhereOperators["in"] = "in"
    - WhereOperators["notIn"] = "notIn"
    - WhereOperators["empty"] = "empty"
    - WhereOperators["notEmpty"] = "notEmpty"
    - })(WhereOperators || (WhereOperators = {}))
    - var TreeNotationConstants
    - ;(function(TreeNotationConstants) {
    - TreeNotationConstants["extends"] = "extends"
    - })(TreeNotationConstants || (TreeNotationConstants = {}))
    - class Parser {
    - constructor(catchAllNodeConstructor, firstWordMap = {}, regexTests = undefined) {
    - this._catchAllNodeConstructor = catchAllNodeConstructor
    - this._firstWordMap = new Map(Object.entries(firstWordMap))
    - this._regexTests = regexTests
    - }
    - getFirstWordOptions() {
    - return Array.from(this._getFirstWordMap().keys())
    - }
    - // todo: remove
    - _getFirstWordMap() {
    - return this._firstWordMap
    - }
    - // todo: remove
    - _getFirstWordMapAsObject() {
    - let obj = {}
    - const map = this._getFirstWordMap()
    - for (let [key, val] of map.entries()) {
    - obj[key] = val
    - }
    - return obj
    - }
    - _getNodeConstructor(line, contextNode, wordBreakSymbol = " ") {
    - return this._getFirstWordMap().get(this._getFirstWord(line, wordBreakSymbol)) || this._getConstructorFromRegexTests(line) || this._getCatchAllNodeConstructor(contextNode)
    - }
    - _getCatchAllNodeConstructor(contextNode) {
    - if (this._catchAllNodeConstructor) return this._catchAllNodeConstructor
    - const parent = contextNode.getParent()
    - if (parent) return parent._getParser()._getCatchAllNodeConstructor(parent)
    - return contextNode.constructor
    - }
    - _getConstructorFromRegexTests(line) {
    - if (!this._regexTests) return undefined
    - const hit = this._regexTests.find(test => test.regex.test(line))
    - if (hit) return hit.nodeConstructor
    - return undefined
    - }
    - _getFirstWord(line, wordBreakSymbol) {
    - const firstBreak = line.indexOf(wordBreakSymbol)
    - return line.substr(0, firstBreak > -1 ? firstBreak : undefined)
    - }
    - }
    - class TreeNode extends AbstractNode {
    - constructor(children, line, parent) {
    - super()
    - // BEGIN MUTABLE METHODS BELOw
    - this._nodeCreationTime = this._getProcessTimeInMilliseconds()
    - this._parent = parent
    - this._setLine(line)
    - this._setChildren(children)
    - }
    - execute() {}
    - async loadRequirements(context) {
    - // todo: remove
    - await Promise.all(this.map(node => node.loadRequirements(context)))
    - }
    - getErrors() {
    - return []
    - }
    - getLineCellTypes() {
    - // todo: make this any a constant
    - return "undefinedCellType ".repeat(this.getWords().length).trim()
    - }
    - isNodeJs() {
    - return typeof exports !== "undefined"
    - }
    - isBrowser() {
    - return !this.isNodeJs()
    - }
    - getOlderSiblings() {
    - if (this.isRoot()) return []
    - return this.getParent().slice(0, this.getIndex())
    - }
    - _getClosestOlderSibling() {
    - const olderSiblings = this.getOlderSiblings()
    - return olderSiblings[olderSiblings.length - 1]
    - }
    - getYoungerSiblings() {
    - if (this.isRoot()) return []
    - return this.getParent().slice(this.getIndex() + 1)
    - }
    - getSiblings() {
    - if (this.isRoot()) return []
    - return this.getParent().filter(node => node !== this)
    - }
    - _getUid() {
    - if (!this._uid) this._uid = TreeNode._makeUniqueId()
    - return this._uid
    - }
    - // todo: rename getMother? grandMother et cetera?
    - getParent() {
    - return this._parent
    - }
    - getIndentLevel(relativeTo) {
    - return this._getIndentLevel(relativeTo)
    - }
    - getIndentation(relativeTo) {
    - return this.getEdgeSymbol().repeat(this._getIndentLevel(relativeTo) - 1)
    - }
    - _getTopDownArray(arr) {
    - this.forEach(child => {
    - arr.push(child)
    - child._getTopDownArray(arr)
    - })
    - }
    - getTopDownArray() {
    - const arr = []
    - this._getTopDownArray(arr)
    - return arr
    - }
    - *getTopDownArrayIterator() {
    - for (let child of this.getChildren()) {
    - yield child
    - yield* child.getTopDownArrayIterator()
    - }
    - }
    - nodeAtLine(lineNumber) {
    - let index = 0
    - for (let node of this.getTopDownArrayIterator()) {
    - if (lineNumber === index) return node
    - index++
    - }
    - }
    - getNumberOfLines() {
    - let lineCount = 0
    - for (let node of this.getTopDownArrayIterator()) {
    - lineCount++
    - }
    - return lineCount
    - }
    - _getMaxUnitsOnALine() {
    - let max = 0
    - for (let node of this.getTopDownArrayIterator()) {
    - const count = node.getWords().length + node.getIndentLevel()
    - if (count > max) max = count
    - }
    - return max
    - }
    - getNumberOfWords() {
    - let wordCount = 0
    - for (let node of this.getTopDownArrayIterator()) {
    - wordCount += node.getWords().length
    - }
    - return wordCount
    - }
    - getLineNumber() {
    - return this._getLineNumberRelativeTo()
    - }
    - _getLineNumber(target = this) {
    - if (this._cachedLineNumber) return this._cachedLineNumber
    - let lineNumber = 1
    - for (let node of this.getRootNode().getTopDownArrayIterator()) {
    - if (node === target) return lineNumber
    - lineNumber++
    - }
    - return lineNumber
    - }
    - isBlankLine() {
    - return !this.length && !this.getLine()
    - }
    - hasDuplicateFirstWords() {
    - return this.length ? new Set(this.getFirstWords()).size !== this.length : false
    - }
    - isEmpty() {
    - return !this.length && !this.getContent()
    - }
    - _getLineNumberRelativeTo(relativeTo) {
    - if (this.isRoot(relativeTo)) return 0
    - const start = relativeTo || this.getRootNode()
    - return start._getLineNumber(this)
    - }
    - isRoot(relativeTo) {
    - return relativeTo === this || !this.getParent()
    - }
    - getRootNode() {
    - return this._getRootNode()
    - }
    - _getRootNode(relativeTo) {
    - if (this.isRoot(relativeTo)) return this
    - return this.getParent()._getRootNode(relativeTo)
    - }
    - toString(indentCount = 0, language = this) {
    - if (this.isRoot()) return this._childrenToString(indentCount, language)
    - return language.getEdgeSymbol().repeat(indentCount) + this.getLine(language) + (this.length ? language.getNodeBreakSymbol() + this._childrenToString(indentCount + 1, language) : "")
    - }
    - printLinesFrom(start, quantity) {
    - return this._printLinesFrom(start, quantity, false)
    - }
    - printLinesWithLineNumbersFrom(start, quantity) {
    - return this._printLinesFrom(start, quantity, true)
    - }
    - _printLinesFrom(start, quantity, printLineNumbers) {
    - // todo: use iterator for better perf?
    - const end = start + quantity
    - this.toString()
    - .split("\n")
    - .slice(start, end)
    - .forEach((line, index) => {
    - if (printLineNumbers) console.log(`${start + index} ${line}`)
    - else console.log(line)
    - })
    - return this
    - }
    - getWord(index) {
    - const words = this._getLine().split(this.getWordBreakSymbol())
    - if (index < 0) index = words.length + index
    - return words[index]
    - }
    - _toHtml(indentCount) {
    - const path = this.getPathVector().join(" ")
    - const classes = {
    - nodeLine: "nodeLine",
    - edgeSymbol: "edgeSymbol",
    - nodeBreakSymbol: "nodeBreakSymbol",
    - nodeChildren: "nodeChildren"
    - }
    - const edge = this.getEdgeSymbol().repeat(indentCount)
    - // Set up the firstWord part of the node
    - const edgeHtml = `${edge}`
    - const lineHtml = this._getLineHtml()
    - const childrenHtml = this.length ? `${this.getNodeBreakSymbol()}` + `${this._childrenToHtml(indentCount + 1)}` : ""
    - return `${edgeHtml}${lineHtml}${childrenHtml}`
    - }
    - _getWords(startFrom) {
    - if (!this._words) this._words = this._getLine().split(this.getWordBreakSymbol())
    - return startFrom ? this._words.slice(startFrom) : this._words
    - }
    - getWords() {
    - return this._getWords(0)
    - }
    - doesExtend(nodeTypeId) {
    - return false
    - }
    - require(moduleName, filePath) {
    - if (!this.isNodeJs()) return windowoduleName]
    - return require(filePath || moduleName)
    - }
    - getWordsFrom(startFrom) {
    - return this._getWords(startFrom)
    - }
    - getFirstAncestor() {
    - const parent = this.getParent()
    - return parent.isRoot() ? this : parent.getFirstAncestor()
    - }
    - isLoaded() {
    - return true
    - }
    - getRunTimePhaseErrors() {
    - if (!this._runTimePhaseErrors) this._runTimePhaseErrors = {}
    - return this._runTimePhaseErrors
    - }
    - setRunTimePhaseError(phase, errorObject) {
    - if (errorObject === undefined) delete this.getRunTimePhaseErrors()[phase]
    - else this.getRunTimePhaseErrors()[phase] = errorObject
    - return this
    - }
    - _getJavascriptPrototypeChainUpTo(stopAtClassName = "TreeNode") {
    - // todo: cross browser test this
    - let constructor = this.constructor
    - const chain = []
    - while (constructor.name !== stopAtClassName) {
    - chain.unshift(constructor.name)
    - constructor = constructor.__proto__
    - }
    - chain.unshift(stopAtClassName)
    - return chain
    - }
    - _getProjectRootDir() {
    - return this.isRoot() ? "" : this.getRootNode()._getProjectRootDir()
    - }
    - getSparsity() {
    - const nodes = this.getChildren()
    - const fields = this._getUnionNames()
    - let count = 0
    - this.getChildren().forEach(node => {
    - fields.forEach(field => {
    - if (node.has(field)) count++
    - })
    - })
    - return 1 - count / (nodes.length * fields.length)
    - }
    - // todo: rename. what is the proper term from set/cat theory?
    - getBiDirectionalMaps(propertyNameOrFn, propertyNameOrFn2 = node => node.getWord(0)) {
    - const oneToTwo = {}
    - const twoToOne = {}
    - const is1Str = typeof propertyNameOrFn === "string"
    - const is2Str = typeof propertyNameOrFn2 === "string"
    - const children = this.getChildren()
    - this.forEach((node, index) => {
    - const value1 = is1Str ? node.get(propertyNameOrFn) : propertyNameOrFn(node, index, children)
    - const value2 = is2Str ? node.get(propertyNameOrFn2) : propertyNameOrFn2(node, index, children)
    - if (value1 !== undefined) {
    - if (!oneToTwo[value1]) oneToTwo[value1] = []
    - oneToTwo[value1].push(value2)
    - }
    - if (value2 !== undefined) {
    - if (!twoToOne[value2]) twoToOne[value2] = []
    - twoToOne[value2].push(value1)
    - }
    - })
    - return [oneToTwo, twoToOne]
    - }
    - _getWordIndexCharacterStartPosition(wordIndex) {
    - const xiLength = this.getEdgeSymbol().length
    - const numIndents = this._getIndentLevel(undefined) - 1
    - const indentPosition = xiLength * numIndents
    - if (wordIndex < 1) return xiLength * (numIndents + wordIndex)
    - return (
    - indentPosition +
    - this.getWords()
    - .slice(0, wordIndex)
    - .join(this.getWordBreakSymbol()).length +
    - this.getWordBreakSymbol().length
    - )
    - }
    - getNodeInScopeAtCharIndex(charIndex) {
    - if (this.isRoot()) return this
    - let wordIndex = this.getWordIndexAtCharacterIndex(charIndex)
    - if (wordIndex > 0) return this
    - let node = this
    - while (wordIndex < 1) {
    - node = node.getParent()
    - wordIndex++
    - }
    - return node
    - }
    - getWordProperties(wordIndex) {
    - const start = this._getWordIndexCharacterStartPosition(wordIndex)
    - const word = wordIndex < 0 ? "" : this.getWord(wordIndex)
    - return {
    - startCharIndex: start,
    - endCharIndex: start + word.length,
    - word: word
    - }
    - }
    - fill(fill = "") {
    - this.getTopDownArray().forEach(line => {
    - line.getWords().forEach((word, index) => {
    - line.setWord(index, fill)
    - })
    - })
    - return this
    - }
    - getAllWordBoundaryCoordinates() {
    - const coordinates = []
    - let lineIndex = 0
    - for (let node of this.getTopDownArrayIterator()) {
    - node.getWordBoundaryCharIndices().forEach((charIndex, wordIndex) => {
    - coordinates.push({
    - lineIndex: lineIndex,
    - charIndex: charIndex,
    - wordIndex: wordIndex
    - })
    - })
    - lineIndex++
    - }
    - return coordinates
    - }
    - getWordBoundaryCharIndices() {
    - let indentLevel = this._getIndentLevel()
    - const wordBreakSymbolLength = this.getWordBreakSymbol().length
    - let elapsed = indentLevel
    - return this.getWords().map((word, wordIndex) => {
    - const boundary = elapsed
    - elapsed += word.length + wordBreakSymbolLength
    - return boundary
    - })
    - }
    - getWordIndexAtCharacterIndex(charIndex) {
    - // todo: is this correct thinking for handling root?
    - if (this.isRoot()) return 0
    - const numberOfIndents = this._getIndentLevel(undefined) - 1
    - // todo: probably want to rewrite this in a performant way.
    - const spots = []
    - while (spots.length < numberOfIndents) {
    - spots.push(-(numberOfIndents - spots.length))
    - }
    - this.getWords().forEach((word, wordIndex) => {
    - word.split("").forEach(letter => {
    - spots.push(wordIndex)
    - })
    - spots.push(wordIndex)
    - })
    - return spots[charIndex]
    - }
    - getAllErrors(lineStartsAt = 1) {
    - const errors = []
    - for (let node of this.getTopDownArray()) {
    - node._cachedLineNumber = lineStartsAt // todo: cleanup
    - const errs = node.getErrors()
    - errs.forEach(err => errors.push(err))
    - // delete node._cachedLineNumber
    - lineStartsAt++
    - }
    - return errors
    - }
    - *getAllErrorsIterator() {
    - let line = 1
    - for (let node of this.getTopDownArrayIterator()) {
    - node._cachedLineNumber = line
    - const errs = node.getErrors()
    - // delete node._cachedLineNumber
    - if (errs.length) yield errs
    - line++
    - }
    - }
    - getFirstWord() {
    - return this.getWords()[0]
    - }
    - getContent() {
    - const words = this.getWordsFrom(1)
    - return words.length ? words.join(this.getWordBreakSymbol()) : undefined
    - }
    - getContentWithChildren() {
    - // todo: deprecate
    - const content = this.getContent()
    - return (content ? content : "") + (this.length ? this.getNodeBreakSymbol() + this._childrenToString() : "")
    - }
    - getFirstNode() {
    - return this.nodeAt(0)
    - }
    - getStack() {
    - return this._getStack()
    - }
    - _getStack(relativeTo) {
    - if (this.isRoot(relativeTo)) return []
    - const parent = this.getParent()
    - if (parent.isRoot(relativeTo)) return [this]
    - else return parent._getStack(relativeTo).concat([this])
    - }
    - getStackString() {
    - return this._getStack()
    - .map((node, index) => this.getEdgeSymbol().repeat(index) + node.getLine())
    - .join(this.getNodeBreakSymbol())
    - }
    - getLine(language) {
    - if (!this._words && !language) return this._getLine() // todo: how does this interact with "language" param?
    - return this.getWords().join((language || this).getWordBreakSymbol())
    - }
    - getColumnNames() {
    - return this._getUnionNames()
    - }
    - getOneHot(column) {
    - const clone = this.clone()
    - const cols = Array.from(new Set(clone.getColumn(column)))
    - clone.forEach(node => {
    - const val = node.get(column)
    - node.delete(column)
    - cols.forEach(col => {
    - node.set(column + "_" + col, val === col ? "1" : "0")
    - })
    - })
    - return clone
    - }
    - // todo: return array? getPathArray?
    - _getFirstWordPath(relativeTo) {
    - if (this.isRoot(relativeTo)) return ""
    - else if (this.getParent().isRoot(relativeTo)) return this.getFirstWord()
    - return this.getParent()._getFirstWordPath(relativeTo) + this.getEdgeSymbol() + this.getFirstWord()
    - }
    - getFirstWordPathRelativeTo(relativeTo) {
    - return this._getFirstWordPath(relativeTo)
    - }
    - getFirstWordPath() {
    - return this._getFirstWordPath()
    - }
    - getPathVector() {
    - return this._getPathVector()
    - }
    - getPathVectorRelativeTo(relativeTo) {
    - return this._getPathVector(relativeTo)
    - }
    - _getPathVector(relativeTo) {
    - if (this.isRoot(relativeTo)) return []
    - const path = this.getParent()._getPathVector(relativeTo)
    - path.push(this.getIndex())
    - return path
    - }
    - getIndex() {
    - return this.getParent()._indexOfNode(this)
    - }
    - isTerminal() {
    - return !this.length
    - }
    - _getLineHtml() {
    - return this.getWords()
    - .map((word, index) => `${TreeUtils.stripHtml(word)}`)
    - .join(`${this.getWordBreakSymbol()}`)
    - }
    - _getXmlContent(indentCount) {
    - if (this.getContent() !== undefined) return this.getContentWithChildren()
    - return this.length ? `${indentCount === -1 ? "" : "\n"}${this._childrenToXml(indentCount > -1 ? indentCount + 2 : -1)}${" ".repeat(indentCount)}` : ""
    - }
    - _toXml(indentCount) {
    - const indent = " ".repeat(indentCount)
    - const tag = this.getFirstWord()
    - return `${indent}<${tag}>${this._getXmlContent(indentCount)}${indentCount === -1 ? "" : "\n"}`
    - }
    - _toObjectTuple() {
    - const content = this.getContent()
    - const length = this.length
    - const hasChildrenNoContent = content === undefined && length
    - const hasContentAndHasChildren = content !== undefined && length
    - // If the node has a content and a subtree return it as a string, as
    - // Javascript object values can't be both a leaf and a tree.
    - const tupleValue = hasChildrenNoContent ? this.toObject() : hasContentAndHasChildren ? this.getContentWithChildren() : content
    - return [this.getFirstWord(), tupleValue]
    - }
    - _indexOfNode(needleNode) {
    - let result = -1
    - this.find((node, index) => {
    - if (node === needleNode) {
    - result = index
    - return true
    - }
    - })
    - return result
    - }
    - getMaxLineWidth() {
    - let maxWidth = 0
    - for (let node of this.getTopDownArrayIterator()) {
    - const lineWidth = node.getLine().length
    - if (lineWidth > maxWidth) maxWidth = lineWidth
    - }
    - return maxWidth
    - }
    - toTreeNode() {
    - return new TreeNode(this.toString())
    - }
    - _rightPad(newWidth, padCharacter) {
    - const line = this.getLine()
    - this.setLine(line + padCharacter.repeat(newWidth - line.length))
    - return this
    - }
    - rightPad(padCharacter = " ") {
    - const newWidth = this.getMaxLineWidth()
    - this.getTopDownArray().forEach(node => node._rightPad(newWidth, padCharacter))
    - return this
    - }
    - lengthen(numberOfLines) {
    - let linesToAdd = numberOfLines - this.getNumberOfLines()
    - while (linesToAdd > 0) {
    - this.appendLine("")
    - linesToAdd--
    - }
    - return this
    - }
    - toSideBySide(treesOrStrings, delimiter = " ") {
    - treesOrStrings = treesOrStrings.map(tree => (tree instanceof TreeNode ? tree : new TreeNode(tree)))
    - const clone = this.toTreeNode()
    - const nodeBreakSymbol = "\n"
    - let next
    - while ((next = treesOrStrings.shift())) {
    - clone.lengthen(next.getNumberOfLines())
    - clone.rightPad()
    - next
    - .toString()
    - .split(nodeBreakSymbol)
    - .forEach((line, index) => {
    - const node = clone.nodeAtLine(index)
    - node.setLine(node.getLine() + delimiter + line)
    - })
    - }
    - return clone
    - }
    - toComparison(treeNode) {
    - const nodeBreakSymbol = "\n"
    - const lines = treeNode.toString().split(nodeBreakSymbol)
    - return new TreeNode(
    - this.toString()
    - .split(nodeBreakSymbol)
    - .map((line, index) => (lines[index] === line ? "" : "x"))
    - .join(nodeBreakSymbol)
    - )
    - }
    - toBraid(treesOrStrings) {
    - treesOrStrings.unshift(this)
    - const nodeDelimiter = this.getNodeBreakSymbol()
    - return new TreeNode(
    - TreeUtils.interweave(treesOrStrings.map(tree => tree.toString().split(nodeDelimiter)))
    - .map(line => (line === undefined ? "" : line))
    - .join(nodeDelimiter)
    - )
    - }
    - getSlice(startIndexInclusive, stopIndexExclusive) {
    - return new TreeNode(
    - this.slice(startIndexInclusive, stopIndexExclusive)
    - .map(child => child.toString())
    - .join("\n")
    - )
    - }
    - _hasColumns(columns) {
    - const words = this.getWords()
    - return columns.every((searchTerm, index) => searchTerm === words[index])
    - }
    - hasWord(index, word) {
    - return this.getWord(index) === word
    - }
    - getNodeByColumns(...columns) {
    - return this.getTopDownArray().find(node => node._hasColumns(columns))
    - }
    - getNodeByColumn(index, name) {
    - return this.find(node => node.getWord(index) === name)
    - }
    - _getNodesByColumn(index, name) {
    - return this.filter(node => node.getWord(index) === name)
    - }
    - // todo: preserve subclasses!
    - select(columnNames) {
    - columnNames = Array.isArray(columnNames) ? columnNames : [columnNames]
    - const result = new TreeNode()
    - this.forEach(node => {
    - const tree = result.appendLine(node.getLine())
    - columnNames.forEach(name => {
    - const valueNode = node.getNode(name)
    - if (valueNode) tree.appendNode(valueNode)
    - })
    - })
    - return result
    - }
    - selectionToString() {
    - return this.getSelectedNodes()
    - .map(node => node.toString())
    - .join("\n")
    - }
    - getSelectedNodes() {
    - return this.getTopDownArray().filter(node => node.isSelected())
    - }
    - clearSelection() {
    - this.getSelectedNodes().forEach(node => node.unselectNode())
    - }
    - // Note: this is for debugging select chains
    - print(message = "") {
    - if (message) console.log(message)
    - console.log(this.toString())
    - return this
    - }
    - // todo: preserve subclasses!
    - // todo: preserve links back to parent so you could edit as normal?
    - where(columnName, operator, fixedValue) {
    - const isArray = Array.isArray(fixedValue)
    - const valueType = isArray ? typeof fixedValue[0] : typeof fixedValue
    - let parser
    - if (valueType === "number") parser = parseFloat
    - const fn = node => {
    - const cell = node.get(columnName)
    - const typedCell = parser ? parser(cell) : cell
    - if (operator === WhereOperators.equal) return fixedValue === typedCell
    - else if (operator === WhereOperators.notEqual) return fixedValue !== typedCell
    - else if (operator === WhereOperators.includes) return typedCell !== undefined && typedCell.includes(fixedValue)
    - else if (operator === WhereOperators.doesNotInclude) return typedCell === undefined || !typedCell.includes(fixedValue)
    - else if (operator === WhereOperators.greaterThan) return typedCell > fixedValue
    - else if (operator === WhereOperators.lessThan) return typedCell < fixedValue
    - else if (operator === WhereOperators.greaterThanOrEqual) return typedCell >= fixedValue
    - else if (operator === WhereOperators.lessThanOrEqual) return typedCell <= fixedValue
    - else if (operator === WhereOperators.empty) return !node.has(columnName)
    - else if (operator === WhereOperators.notEmpty) return node.has(columnName)
    - else if (operator === WhereOperators.in && isArray) return fixedValue.includes(typedCell)
    - else if (operator === WhereOperators.notIn && isArray) return !fixedValue.includes(typedCell)
    - }
    - const result = new TreeNode()
    - this.filter(fn).forEach(node => {
    - result.appendNode(node)
    - })
    - return result
    - }
    - with(firstWord) {
    - return this.filter(node => node.has(firstWord))
    - }
    - without(firstWord) {
    - return this.filter(node => !node.has(firstWord))
    - }
    - first(quantity = 1) {
    - return this.limit(quantity, 0)
    - }
    - last(quantity = 1) {
    - return this.limit(quantity, this.length - quantity)
    - }
    - // todo: preserve subclasses!
    - limit(quantity, offset = 0) {
    - const result = new TreeNode()
    - this.getChildren()
    - .slice(offset, quantity + offset)
    - .forEach(node => {
    - result.appendNode(node)
    - })
    - return result
    - }
    - getChildrenFirstArray() {
    - const arr = []
    - this._getChildrenFirstArray(arr)
    - return arr
    - }
    - _getChildrenFirstArray(arr) {
    - this.forEach(child => {
    - child._getChildrenFirstArray(arr)
    - arr.push(child)
    - })
    - }
    - _getIndentLevel(relativeTo) {
    - return this._getStack(relativeTo).length
    - }
    - getParentFirstArray() {
    - const levels = this._getLevels()
    - const arr = []
    - Object.values(levels).forEach(level => {
    - level.forEach(item => arr.push(item))
    - })
    - return arr
    - }
    - _getLevels() {
    - const levels = {}
    - this.getTopDownArray().forEach(node => {
    - const level = node._getIndentLevel()
    - if (!levels[level]) levels[level] = []
    - levels[level].push(node)
    - })
    - return levels
    - }
    - _getChildrenArray() {
    - if (!this._children) this._children = []
    - return this._children
    - }
    - getLines() {
    - return this.map(node => node.getLine())
    - }
    - getChildren() {
    - return this._getChildrenArray().slice(0)
    - }
    - get length() {
    - return this._getChildrenArray().length
    - }
    - _nodeAt(index) {
    - if (index < 0) index = this.length + index
    - return this._getChildrenArray()[index]
    - }
    - nodeAt(indexOrIndexArray) {
    - if (typeof indexOrIndexArray === "number") return this._nodeAt(indexOrIndexArray)
    - if (indexOrIndexArray.length === 1) return this._nodeAt(indexOrIndexArray[0])
    - const first = indexOrIndexArray[0]
    - const node = this._nodeAt(first)
    - if (!node) return undefined
    - return node.nodeAt(indexOrIndexArray.slice(1))
    - }
    - _toObject() {
    - const obj = {}
    - this.forEach(node => {
    - const tuple = node._toObjectTuple()
    - obj[tuple[0]] = tuple[1]
    - })
    - return obj
    - }
    - toHtml() {
    - return this._childrenToHtml(0)
    - }
    - _toHtmlCubeLine(indents = 0, lineIndex = 0, planeIndex = 0) {
    - const getLine = (cellIndex, word = "") =>
    - `${word}`
    - let cells = []
    - this.getWords().forEach((word, index) => (word ? cells.push(getLine(index + indents, word)) : ""))
    - return cells.join("")
    - }
    - toHtmlCube() {
    - return this.map((plane, planeIndex) =>
    - plane
    - .getTopDownArray()
    - .map((line, lineIndex) => line._toHtmlCubeLine(line.getIndentLevel() - 2, lineIndex, planeIndex))
    - .join("")
    - ).join("")
    - }
    - _getHtmlJoinByCharacter() {
    - return `${this.getNodeBreakSymbol()}`
    - }
    - _childrenToHtml(indentCount) {
    - const joinBy = this._getHtmlJoinByCharacter()
    - return this.map(node => node._toHtml(indentCount)).join(joinBy)
    - }
    - _childrenToString(indentCount, language = this) {
    - return this.map(node => node.toString(indentCount, language)).join(language.getNodeBreakSymbol())
    - }
    - childrenToString(indentCount = 0) {
    - return this._childrenToString(indentCount)
    - }
    - // todo: implement
    - _getChildJoinCharacter() {
    - return "\n"
    - }
    - format() {
    - this.forEach(child => child.format())
    - return this
    - }
    - compile() {
    - return this.map(child => child.compile()).join(this._getChildJoinCharacter())
    - }
    - toXml() {
    - return this._childrenToXml(0)
    - }
    - toDisk(path) {
    - if (!this.isNodeJs()) throw new Error("This method only works in Node.js")
    - const format = TreeNode._getFileFormat(path)
    - const formats = {
    - tree: tree => tree.toString(),
    - csv: tree => tree.toCsv(),
    - tsv: tree => tree.toTsv()
    - }
    - this.require("fs").writeFileSync(path, formats[format](this), "utf8")
    - return this
    - }
    - _lineToYaml(indentLevel, listTag = "") {
    - let prefix = " ".repeat(indentLevel)
    - if (listTag && indentLevel > 1) prefix = " ".repeat(indentLevel - 2) + listTag + " "
    - return prefix + `${this.getFirstWord()}:` + (this.getContent() ? " " + this.getContent() : "")
    - }
    - _isYamlList() {
    - return this.hasDuplicateFirstWords()
    - }
    - toYaml() {
    - return `%YAML 1.2
    - }
    - _childrenToYaml(indentLevel) {
    - if (this._isYamlList()) return this._childrenToYamlList(indentLevel)
    - else return this._childrenToYamlAssociativeArray(indentLevel)
    - }
    - // if your code-to-be-yaml has a list of associative arrays of type N and you don't
    - // want the type N to print
    - _collapseYamlLine() {
    - return false
    - }
    - _toYamlListElement(indentLevel) {
    - const children = this._childrenToYaml(indentLevel + 1)
    - if (this._collapseYamlLine()) {
    - if (indentLevel > 1) return children.join("\n").replace(" ".repeat(indentLevel), " ".repeat(indentLevel - 2) + "- ")
    - return children.join("\n")
    - } else {
    - children.unshift(this._lineToYaml(indentLevel, "-"))
    - return children.join("\n")
    - }
    - }
    - _childrenToYamlList(indentLevel) {
    - return this.map(node => node._toYamlListElement(indentLevel + 2))
    - }
    - _toYamlAssociativeArrayElement(indentLevel) {
    - const children = this._childrenToYaml(indentLevel + 1)
    - children.unshift(this._lineToYaml(indentLevel))
    - return children.join("\n")
    - }
    - _childrenToYamlAssociativeArray(indentLevel) {
    - return this.map(node => node._toYamlAssociativeArrayElement(indentLevel))
    - }
    - toJsonSubset() {
    - return JSON.stringify(this.toObject(), null, " ")
    - }
    - findNodes(firstWordPath) {
    - // todo: can easily speed this up
    - const map = {}
    - if (!Array.isArray(firstWordPath)) firstWordPath = [firstWordPath]
    - firstWordPath.forEach(path => (map[path] = true))
    - return this.getTopDownArray().filter(node => {
    - if (map[node._getFirstWordPath(this)]) return true
    - return false
    - })
    - }
    - evalTemplateString(str) {
    - const that = this
    - return str.replace(/{([^\}]+)}/g, (match, path) => that.get(path) || "")
    - }
    - emitLogMessage(message) {
    - console.log(message)
    - }
    - getColumn(path) {
    - return this.map(node => node.get(path))
    - }
    - getFiltered(fn) {
    - const clone = this.clone()
    - clone
    - .filter((node, index) => !fn(node, index))
    - .forEach(node => {
    - node.destroy()
    - })
    - return clone
    - }
    - getNode(firstWordPath) {
    - return this._getNodeByPath(firstWordPath)
    - }
    - getFrom(prefix) {
    - const hit = this.filter(node => node.getLine().startsWith(prefix))[0]
    - if (hit) return hit.getLine().substr((prefix + this.getWordBreakSymbol()).length)
    - }
    - get(firstWordPath) {
    - const node = this._getNodeByPath(firstWordPath)
    - return node === undefined ? undefined : node.getContent()
    - }
    - getNodesByGlobPath(query) {
    - return this._getNodesByGlobPath(query)
    - }
    - _getNodesByGlobPath(globPath) {
    - const edgeSymbol = this.getEdgeSymbol()
    - if (!globPath.includes(edgeSymbol)) {
    - if (globPath === "*") return this.getChildren()
    - return this.filter(node => node.getFirstWord() === globPath)
    - }
    - const parts = globPath.split(edgeSymbol)
    - const current = parts.shift()
    - const rest = parts.join(edgeSymbol)
    - const matchingNodes = current === "*" ? this.getChildren() : this.filter(child => child.getFirstWord() === current)
    - return [].concat.apply([], matchingNodes.map(node => node._getNodesByGlobPath(rest)))
    - }
    - _getNodeByPath(firstWordPath) {
    - const edgeSymbol = this.getEdgeSymbol()
    - if (!firstWordPath.includes(edgeSymbol)) {
    - const index = this.indexOfLast(firstWordPath)
    - return index === -1 ? undefined : this._nodeAt(index)
    - }
    - const parts = firstWordPath.split(edgeSymbol)
    - const current = parts.shift()
    - const currentNode = this._getChildrenArray()[this._getIndex()[current]]
    - return currentNode ? currentNode._getNodeByPath(parts.join(edgeSymbol)) : undefined
    - }
    - getNext() {
    - if (this.isRoot()) return this
    - const index = this.getIndex()
    - const parent = this.getParent()
    - const length = parent.length
    - const next = index + 1
    - return next === length ? parent._getChildrenArray()[0] : parent._getChildrenArray()[next]
    - }
    - getPrevious() {
    - if (this.isRoot()) return this
    - const index = this.getIndex()
    - const parent = this.getParent()
    - const length = parent.length
    - const prev = index - 1
    - return prev === -1 ? parent._getChildrenArray()[length - 1] : parent._getChildrenArray()[prev]
    - }
    - _getUnionNames() {
    - if (!this.length) return []
    - const obj = {}
    - this.forEach(node => {
    - if (!node.length) return undefined
    - node.forEach(node => {
    - obj[node.getFirstWord()] = 1
    - })
    - })
    - return Object.keys(obj)
    - }
    - getAncestorNodesByInheritanceViaExtendsKeyword(key) {
    - const ancestorNodes = this._getAncestorNodes((node, id) => node._getNodesByColumn(0, id), node => node.get(key), this)
    - ancestorNodes.push(this)
    - return ancestorNodes
    - }
    - // Note: as you can probably tell by the name of this method, I don't recommend using this as it will likely be replaced by something better.
    - getAncestorNodesByInheritanceViaColumnIndices(thisColumnNumber, extendsColumnNumber) {
    - const ancestorNodes = this._getAncestorNodes((node, id) => node._getNodesByColumn(thisColumnNumber, id), node => node.getWord(extendsColumnNumber), this)
    - ancestorNodes.push(this)
    - return ancestorNodes
    - }
    - _getAncestorNodes(getPotentialParentNodesByIdFn, getParentIdFn, cannotContainNode) {
    - const parentId = getParentIdFn(this)
    - if (!parentId) return []
    - const potentialParentNodes = getPotentialParentNodesByIdFn(this.getParent(), parentId)
    - if (!potentialParentNodes.length) throw new Error(`"${this.getLine()} tried to extend "${parentId}" but "${parentId}" not found.`)
    - if (potentialParentNodes.length > 1) throw new Error(`Invalid inheritance family tree. Multiple unique ids found for "${parentId}"`)
    - const parentNode = potentialParentNodes[0]
    - // todo: detect loops
    - if (parentNode === cannotContainNode) throw new Error(`Loop detected between '${this.getLine()}' and '${parentNode.getLine()}'`)
    - const ancestorNodes = parentNode._getAncestorNodes(getPotentialParentNodesByIdFn, getParentIdFn, cannotContainNode)
    - ancestorNodes.push(parentNode)
    - return ancestorNodes
    - }
    - pathVectorToFirstWordPath(pathVector) {
    - const path = pathVector.slice() // copy array
    - const names = []
    - let node = this
    - while (path.length) {
    - if (!node) return names
    - names.push(node.nodeAt(path[0]).getFirstWord())
    - node = node.nodeAt(path.shift())
    - }
    - return names
    - }
    - toStringWithLineNumbers() {
    - return this.toString()
    - .split("\n")
    - .map((line, index) => `${index + 1} ${line}`)
    - .join("\n")
    - }
    - toCsv() {
    - return this.toDelimited(",")
    - }
    - _getTypes(header) {
    - const matrix = this._getMatrix(header)
    - const types = header.map(i => "int")
    - matrix.forEach(row => {
    - row.forEach((value, index) => {
    - const type = types[index]
    - if (type === "string") return 1
    - if (value === undefined || value === "") return 1
    - if (type === "float") {
    - if (value.match(/^\-?[0-9]*\.?[0-9]*$/)) return 1
    - types[index] = "string"
    - }
    - if (value.match(/^\-?[0-9]+$/)) return 1
    - types[index] = "string"
    - })
    - })
    - return types
    - }
    - toDataTable(header = this._getUnionNames()) {
    - const types = this._getTypes(header)
    - const parsers = {
    - string: str => str,
    - float: parseFloat,
    - int: parseInt
    - }
    - const cellFn = (cellValue, rowIndex, columnIndex) => (rowIndex ? parsers[types[columnIndex]](cellValue) : cellValue)
    - const arrays = this._toArrays(header, cellFn)
    - arrays.rows.unshift(arrays.header)
    - return arrays.rows
    - }
    - toDelimited(delimiter, header = this._getUnionNames()) {
    - const regex = new RegExp(`(\\n|\\"|\\${delimiter})`)
    - const cellFn = (str, row, column) => (!str.toString().match(regex) ? str : `"` + str.replace(/\"/g, `""`) + `"`)
    - return this._toDelimited(delimiter, header, cellFn)
    - }
    - _getMatrix(columns) {
    - const matrix = []
    - this.forEach(child => {
    - const row = []
    - columns.forEach(col => {
    - row.push(child.get(col))
    - })
    - matrix.push(row)
    - })
    - return matrix
    - }
    - _toArrays(header, cellFn) {
    - const skipHeaderRow = 1
    - const headerArray = header.map((columnName, index) => cellFn(columnName, 0, index))
    - const rows = this.map((node, rowNumber) =>
    - header.map((columnName, columnIndex) => {
    - const childNode = node.getNode(columnName)
    - const content = childNode ? childNode.getContentWithChildren() : ""
    - return cellFn(content, rowNumber + skipHeaderRow, columnIndex)
    - })
    - )
    - return {
    - rows: rows,
    - header: headerArray
    - }
    - }
    - _toDelimited(delimiter, header, cellFn) {
    - const data = this._toArrays(header, cellFn)
    - return data.header.join(delimiter) + "\n" + data.rows.map(row => row.join(delimiter)).join("\n")
    - }
    - toTable() {
    - // Output a table for printing
    - return this._toTable(100, false)
    - }
    - toFormattedTable(maxCharactersPerColumn, alignRight = false) {
    - return this._toTable(maxCharactersPerColumn, alignRight)
    - }
    - _toTable(maxCharactersPerColumn, alignRight = false) {
    - const header = this._getUnionNames()
    - // Set initial column widths
    - const widths = header.map(col => (col.length > maxCharactersPerColumn ? maxCharactersPerColumn : col.length))
    - // Expand column widths if needed
    - this.forEach(node => {
    - if (!node.length) return true
    - header.forEach((col, index) => {
    - const cellValue = node.get(col)
    - if (!cellValue) return true
    - const length = cellValue.toString().length
    - if (length > widths[index]) widths[index] = length > maxCharactersPerColumn ? maxCharactersPerColumn : length
    - })
    - })
    - const cellFn = (cellText, row, col) => {
    - const width = widths[col]
    - // Strip newlines in fixedWidth output
    - const cellValue = cellText.toString().replace(/\n/g, "\\n")
    - const cellLength = cellValue.length
    - if (cellLength > width) return cellValue.substr(0, width) + "..."
    - const padding = " ".repeat(width - cellLength)
    - return alignRight ? padding + cellValue : cellValue + padding
    - }
    - return this._toDelimited(" ", header, cellFn)
    - }
    - toSsv() {
    - return this.toDelimited(" ")
    - }
    - toOutline() {
    - return this._toOutline(node => node.getLine())
    - }
    - toMappedOutline(nodeFn) {
    - return this._toOutline(nodeFn)
    - }
    - // Adapted from: https://github.com/notatestuser/treeify.js
    - _toOutline(nodeFn) {
    - const growBranch = (outlineTreeNode, last, lastStates, nodeFn, callback) => {
    - let lastStatesCopy = lastStates.slice(0)
    - const node = outlineTreeNode.node
    - if (lastStatesCopy.push([outlineTreeNode, last]) && lastStates.length > 0) {
    - let line = ""
    - // firstWordd on the "was last element" states of whatever we're nested within,
    - // we need to append either blankness or a branch to our line
    - lastStates.forEach((lastState, idx) => {
    - if (idx > 0) line += lastState[1] ? " " : "│"
    - })
    - // the prefix varies firstWordd on whether the key contains something to show and
    - // whether we're dealing with the last element in this collection
    - // the extra "-" just makes things stand out more.
    - line += (last ? "└" : "├") + nodeFn(node)
    - callback(line)
    - }
    - if (!node) return
    - const length = node.length
    - let index = 0
    - node.forEach(node => {
    - let lastKey = ++index === length
    - growBranch({ node: node }, lastKey, lastStatesCopy, nodeFn, callback)
    - })
    - }
    - let output = ""
    - growBranch({ node: this }, false, [], nodeFn, line => (output += line + "\n"))
    - return output
    - }
    - copyTo(node, index) {
    - return node._insertLineAndChildren(this.getLine(), this.childrenToString(), index)
    - }
    - // Note: Splits using a positive lookahead
    - // this.split("foo").join("\n") === this.toString()
    - split(firstWord) {
    - const constructor = this.constructor
    - const NodeBreakSymbol = this.getNodeBreakSymbol()
    - const WordBreakSymbol = this.getWordBreakSymbol()
    - // todo: cleanup. the escaping is wierd.
    - return this.toString()
    - .split(new RegExp(`\\${NodeBreakSymbol}(?=${firstWord}(?:${WordBreakSymbol}|\\${NodeBreakSymbol}))`, "g"))
    - .map(str => new constructor(str))
    - }
    - toMarkdownTable() {
    - return this.toMarkdownTableAdvanced(this._getUnionNames(), val => val)
    - }
    - toMarkdownTableAdvanced(columns, formatFn) {
    - const matrix = this._getMatrix(columns)
    - const empty = columns.map(col => "-")
    - matrix.unshift(empty)
    - matrix.unshift(columns)
    - const lines = matrix.map((row, rowIndex) => {
    - const formattedValues = row.map((val, colIndex) => formatFn(val, rowIndex, colIndex))
    - return `|${formattedValues.join("|")}|`
    - })
    - return lines.join("\n")
    - }
    - toTsv() {
    - return this.toDelimited("\t")
    - }
    - getNodeBreakSymbol() {
    - return "\n"
    - }
    - getWordBreakSymbol() {
    - return " "
    - }
    - getNodeBreakSymbolRegex() {
    - return new RegExp(this.getNodeBreakSymbol(), "g")
    - }
    - getEdgeSymbol() {
    - return " "
    - }
    - _textToContentAndChildrenTuple(text) {
    - const lines = text.split(this.getNodeBreakSymbolRegex())
    - const firstLine = lines.shift()
    - const children = !lines.length
    - ? undefined
    - : lines
    - .map(line => (line.substr(0, 1) === this.getEdgeSymbol() ? line : this.getEdgeSymbol() + line))
    - .map(line => line.substr(1))
    - .join(this.getNodeBreakSymbol())
    - return [firstLine, children]
    - }
    - _getLine() {
    - return this._line
    - }
    - _setLine(line = "") {
    - this._line = line
    - if (this._words) delete this._words
    - return this
    - }
    - _clearChildren() {
    - this._deleteByIndexes(TreeUtils.getRange(0, this.length))
    - delete this._children
    - return this
    - }
    - _setChildren(content, circularCheckArray) {
    - this._clearChildren()
    - if (!content) return this
    - // set from string
    - if (typeof content === "string") {
    - this._appendChildrenFromString(content)
    - return this
    - }
    - // set from tree object
    - if (content instanceof TreeNode) {
    - content.forEach(node => this._insertLineAndChildren(node.getLine(), node.childrenToString()))
    - return this
    - }
    - // If we set from object, create an array of inserted objects to avoid circular loops
    - if (!circularCheckArray) circularCheckArray = [content]
    - return this._setFromObject(content, circularCheckArray)
    - }
    - _setFromObject(content, circularCheckArray) {
    - for (let firstWord in content) {
    - if (!content.hasOwnProperty(firstWord)) continue
    - // Branch the circularCheckArray, as we only have same branch circular arrays
    - this._appendFromJavascriptObjectTuple(firstWord, content[firstWord], circularCheckArray.slice(0))
    - }
    - return this
    - }
    - // todo: refactor the below.
    - _appendFromJavascriptObjectTuple(firstWord, content, circularCheckArray) {
    - const type = typeof content
    - let line
    - let children
    - if (content === null) line = firstWord + " " + null
    - else if (content === undefined) line = firstWord
    - else if (type === "string") {
    - const tuple = this._textToContentAndChildrenTuple(content)
    - line = firstWord + " " + tuple[0]
    - children = tuple[1]
    - } else if (type === "function") line = firstWord + " " + content.toString()
    - else if (type !== "object") line = firstWord + " " + content
    - else if (content instanceof Date) line = firstWord + " " + content.getTime().toString()
    - else if (content instanceof TreeNode) {
    - line = firstWord
    - children = new TreeNode(content.childrenToString(), content.getLine())
    - } else if (circularCheckArray.indexOf(content) === -1) {
    - circularCheckArray.push(content)
    - line = firstWord
    - const length = content instanceof Array ? content.length : Object.keys(content).length
    - if (length) children = new TreeNode()._setChildren(content, circularCheckArray)
    - } else {
    - // iirc this is return early from circular
    - return
    - }
    - this._insertLineAndChildren(line, children)
    - }
    - _insertLineAndChildren(line, children, index = this.length) {
    - const nodeConstructor = this._getParser()._getNodeConstructor(line, this)
    - const newNode = new nodeConstructor(children, line, this)
    - const adjustedIndex = index < 0 ? this.length + index : index
    - this._getChildrenArray().splice(adjustedIndex, 0, newNode)
    - if (this._index) this._makeIndex(adjustedIndex)
    - return newNode
    - }
    - _appendChildrenFromString(str) {
    - const lines = str.split(this.getNodeBreakSymbolRegex())
    - const parentStack = []
    - let currentIndentCount = -1
    - let lastNode = this
    - lines.forEach(line => {
    - const indentCount = this._getIndentCount(line)
    - if (indentCount > currentIndentCount) {
    - currentIndentCount++
    - parentStack.push(lastNode)
    - } else if (indentCount < currentIndentCount) {
    - // pop things off stack
    - while (indentCount < currentIndentCount) {
    - parentStack.pop()
    - currentIndentCount--
    - }
    - }
    - const lineContent = line.substr(currentIndentCount)
    - const parent = parentStack[parentStack.length - 1]
    - const nodeConstructor = parent._getParser()._getNodeConstructor(lineContent, parent)
    - lastNode = new nodeConstructor(undefined, lineContent, parent)
    - parent._getChildrenArray().push(lastNode)
    - })
    - }
    - _getIndex() {
    - // StringMap {firstWord: index}
    - // When there are multiple tails with the same firstWord, _index stores the last content.
    - // todo: change the above behavior: when a collision occurs, create an array.
    - return this._index || this._makeIndex()
    - }
    - getContentsArray() {
    - return this.map(node => node.getContent())
    - }
    - // todo: rename to getChildrenByConstructor(?)
    - getChildrenByNodeConstructor(constructor) {
    - return this.filter(child => child instanceof constructor)
    - }
    - getAncestorByNodeConstructor(constructor) {
    - if (this instanceof constructor) return this
    - if (this.isRoot()) return undefined
    - const parent = this.getParent()
    - return parent instanceof constructor ? parent : parent.getAncestorByNodeConstructor(constructor)
    - }
    - // todo: rename to getNodeByConstructor(?)
    - getNodeByType(constructor) {
    - return this.find(child => child instanceof constructor)
    - }
    - indexOfLast(firstWord) {
    - const result = this._getIndex()[firstWord]
    - return result === undefined ? -1 : result
    - }
    - // todo: renmae to indexOfFirst?
    - indexOf(firstWord) {
    - if (!this.has(firstWord)) return -1
    - const length = this.length
    - const nodes = this._getChildrenArray()
    - for (let index = 0; index < length; index++) {
    - if (nodes[index].getFirstWord() === firstWord) return index
    - }
    - }
    - toObject() {
    - return this._toObject()
    - }
    - getFirstWords() {
    - return this.map(node => node.getFirstWord())
    - }
    - _makeIndex(startAt = 0) {
    - if (!this._index || !startAt) this._index = {}
    - const nodes = this._getChildrenArray()
    - const newIndex = this._index
    - const length = nodes.length
    - for (let index = startAt; index < length; index++) {
    - newIndex[nodes[index].getFirstWord()] = index
    - }
    - return newIndex
    - }
    - _childrenToXml(indentCount) {
    - return this.map(node => node._toXml(indentCount)).join("")
    - }
    - _getIndentCount(str) {
    - let level = 0
    - const edgeChar = this.getEdgeSymbol()
    - while (str[level] === edgeChar) {
    - level++
    - }
    - return level
    - }
    - clone() {
    - return new this.constructor(this.childrenToString(), this.getLine())
    - }
    - // todo: rename to hasFirstWord
    - has(firstWord) {
    - return this._hasFirstWord(firstWord)
    - }
    - hasNode(node) {
    - const needle = node.toString()
    - return this.getChildren().some(node => node.toString() === needle)
    - }
    - _hasFirstWord(firstWord) {
    - return this._getIndex()[firstWord] !== undefined
    - }
    - map(fn) {
    - return this.getChildren().map(fn)
    - }
    - filter(fn = item => item) {
    - return this.getChildren().filter(fn)
    - }
    - find(fn) {
    - return this.getChildren().find(fn)
    - }
    - findLast(fn) {
    - return this.getChildren()
    - .reverse()
    - .find(fn)
    - }
    - every(fn) {
    - let index = 0
    - for (let node of this.getTopDownArrayIterator()) {
    - if (!fn(node, index)) return false
    - index++
    - }
    - return true
    - }
    - forEach(fn) {
    - this.getChildren().forEach(fn)
    - return this
    - }
    - // Recurse if predicate passes
    - deepVisit(predicate) {
    - this.forEach(node => {
    - if (predicate(node) !== false) node.deepVisit(predicate)
    - })
    - }
    - // todo: protected?
    - _clearIndex() {
    - delete this._index
    - }
    - slice(start, end) {
    - return this.getChildren().slice(start, end)
    - }
    - // todo: make 0 and 1 a param
    - getInheritanceTree() {
    - const paths = {}
    - const result = new TreeNode()
    - this.forEach(node => {
    - const key = node.getWord(0)
    - const parentKey = node.getWord(1)
    - const parentPath = paths[parentKey]
    - paths[key] = parentPath ? [parentPath, key].join(" ") : key
    - result.touchNode(paths[key])
    - })
    - return result
    - }
    - _getGrandParent() {
    - return this.isRoot() || this.getParent().isRoot() ? undefined : this.getParent().getParent()
    - }
    - _getParser() {
    - if (!TreeNode._parsers.has(this.constructor)) TreeNode._parsers.set(this.constructor, this.createParser())
    - return TreeNode._parsers.get(this.constructor)
    - }
    - createParser() {
    - return new Parser(this.constructor)
    - }
    - static _makeUniqueId() {
    - if (this._uniqueId === undefined) this._uniqueId = 0
    - this._uniqueId++
    - return this._uniqueId
    - }
    - static _getFileFormat(path) {
    - const format = path.split(".").pop()
    - return FileFormat[format] ? format : FileFormat.tree
    - }
    - getLineModifiedTime() {
    - return this._lineModifiedTime || this._nodeCreationTime
    - }
    - getChildArrayModifiedTime() {
    - return this._childArrayModifiedTime || this._nodeCreationTime
    - }
    - _setChildArrayMofifiedTime(value) {
    - this._childArrayModifiedTime = value
    - return this
    - }
    - getLineOrChildrenModifiedTime() {
    - return Math.max(this.getLineModifiedTime(), this.getChildArrayModifiedTime(), Math.max.apply(null, this.map(child => child.getLineOrChildrenModifiedTime())))
    - }
    - _setVirtualParentTree(tree) {
    - this._virtualParentTree = tree
    - return this
    - }
    - _getVirtualParentTreeNode() {
    - return this._virtualParentTree
    - }
    - _setVirtualAncestorNodesByInheritanceViaColumnIndicesAndThenExpand(nodes, thisIdColumnNumber, extendsIdColumnNumber) {
    - const map = {}
    - for (let node of nodes) {
    - const nodeId = node.getWord(thisIdColumnNumber)
    - if (map[nodeId]) throw new Error(`Tried to define a node with id "${nodeId}" but one is already defined.`)
    - map[nodeId] = {
    - nodeId: nodeId,
    - node: node,
    - parentId: node.getWord(extendsIdColumnNumber)
    - }
    - }
    - // Add parent Nodes
    - Object.values(map).forEach(nodeInfo => {
    - const parentId = nodeInfo.parentId
    - const parentNode = map[parentId]
    - if (parentId && !parentNode) throw new Error(`Node "${nodeInfo.nodeId}" tried to extend "${parentId}" but "${parentId}" not found.`)
    - if (parentId) nodeInfo.node._setVirtualParentTree(parentNode.node)
    - })
    - nodes.forEach(node => node._expandFromVirtualParentTree())
    - return this
    - }
    - _expandFromVirtualParentTree() {
    - if (this._isVirtualExpanded) return this
    - this._isExpanding = true
    - let parentNode = this._getVirtualParentTreeNode()
    - if (parentNode) {
    - if (parentNode._isExpanding) throw new Error(`Loop detected: '${this.getLine()}' is the ancestor of one of its ancestors.`)
    - parentNode._expandFromVirtualParentTree()
    - const clone = this.clone()
    - this._setChildren(parentNode.childrenToString())
    - this.extend(clone)
    - }
    - this._isExpanding = false
    - this._isVirtualExpanded = true
    - }
    - // todo: solve issue related to whether extend should overwrite or append.
    - _expandChildren(thisIdColumnNumber, extendsIdColumnNumber, childrenThatNeedExpanding = this.getChildren()) {
    - return this._setVirtualAncestorNodesByInheritanceViaColumnIndicesAndThenExpand(childrenThatNeedExpanding, thisIdColumnNumber, extendsIdColumnNumber)
    - }
    - // todo: add more testing.
    - // todo: solve issue with where extend should overwrite or append
    - // todo: should take a grammar? to decide whether to overwrite or append.
    - // todo: this is slow.
    - extend(nodeOrStr) {
    - const node = nodeOrStr instanceof TreeNode ? nodeOrStr : new TreeNode(nodeOrStr)
    - const usedFirstWords = new Set()
    - node.forEach(sourceNode => {
    - const firstWord = sourceNode.getFirstWord()
    - let targetNode
    - const isAnArrayNotMap = usedFirstWords.has(firstWord)
    - if (!this.has(firstWord)) {
    - usedFirstWords.add(firstWord)
    - this.appendLineAndChildren(sourceNode.getLine(), sourceNode.childrenToString())
    - return true
    - }
    - if (isAnArrayNotMap) targetNode = this.appendLine(sourceNode.getLine())
    - else {
    - targetNode = this.touchNode(firstWord).setContent(sourceNode.getContent())
    - usedFirstWords.add(firstWord)
    - }
    - if (sourceNode.length) targetNode.extend(sourceNode)
    - })
    - return this
    - }
    - macroExpand(macroDefinitionWord, macroUsageWord) {
    - const clone = this.clone()
    - const defs = clone.findNodes(macroDefinitionWord)
    - const allUses = clone.findNodes(macroUsageWord)
    - const wordBreakSymbol = clone.getWordBreakSymbol()
    - defs.forEach(def => {
    - const macroName = def.getWord(1)
    - const uses = allUses.filter(node => node.hasWord(1, macroName))
    - const params = def.getWordsFrom(2)
    - const replaceFn = str => {
    - const paramValues = str.split(wordBreakSymbol).slice(2)
    - let newTree = def.childrenToString()
    - params.forEach((param, index) => {
    - newTree = newTree.replace(new RegExp(param, "g"), paramValues[index])
    - })
    - return newTree
    - }
    - uses.forEach(node => {
    - node.replaceNode(replaceFn)
    - })
    - def.destroy()
    - })
    - return clone
    - }
    - setChildren(children) {
    - return this._setChildren(children)
    - }
    - _updateLineModifiedTimeAndTriggerEvent() {
    - this._lineModifiedTime = this._getProcessTimeInMilliseconds()
    - }
    - insertWord(index, word) {
    - const wi = this.getWordBreakSymbol()
    - const words = this._getLine().split(wi)
    - words.splice(index, 0, word)
    - this.setLine(words.join(wi))
    - return this
    - }
    - deleteDuplicates() {
    - const set = new Set()
    - this.getTopDownArray().forEach(node => {
    - const str = node.toString()
    - if (set.has(str)) node.destroy()
    - else set.add(str)
    - })
    - return this
    - }
    - setWord(index, word) {
    - const wi = this.getWordBreakSymbol()
    - const words = this._getLine().split(wi)
    - words[index] = word
    - this.setLine(words.join(wi))
    - return this
    - }
    - deleteChildren() {
    - return this._clearChildren()
    - }
    - setContent(content) {
    - if (content === this.getContent()) return this
    - const newArray = [this.getFirstWord()]
    - if (content !== undefined) {
    - content = content.toString()
    - if (content.match(this.getNodeBreakSymbol())) return this.setContentWithChildren(content)
    - newArray.push(content)
    - }
    - this._setLine(newArray.join(this.getWordBreakSymbol()))
    - this._updateLineModifiedTimeAndTriggerEvent()
    - return this
    - }
    - prependSibling(line, children) {
    - return this.getParent().insertLineAndChildren(line, children, this.getIndex())
    - }
    - appendSibling(line, children) {
    - return this.getParent().insertLineAndChildren(line, children, this.getIndex() + 1)
    - }
    - setContentWithChildren(text) {
    - // todo: deprecate
    - if (!text.includes(this.getNodeBreakSymbol())) {
    - this._clearChildren()
    - return this.setContent(text)
    - }
    - const lines = text.split(this.getNodeBreakSymbolRegex())
    - const firstLine = lines.shift()
    - this.setContent(firstLine)
    - // tood: cleanup.
    - const remainingString = lines.join(this.getNodeBreakSymbol())
    - const children = new TreeNode(remainingString)
    - if (!remainingString) children.appendLine("")
    - this.setChildren(children)
    - return this
    - }
    - setFirstWord(firstWord) {
    - return this.setWord(0, firstWord)
    - }
    - setLine(line) {
    - if (line === this.getLine()) return this
    - // todo: clear parent TMTimes
    - this.getParent()._clearIndex()
    - this._setLine(line)
    - this._updateLineModifiedTimeAndTriggerEvent()
    - return this
    - }
    - duplicate() {
    - return this.getParent()._insertLineAndChildren(this.getLine(), this.childrenToString(), this.getIndex() + 1)
    - }
    - trim() {
    - // todo: could do this so only the trimmed rows are deleted.
    - this.setChildren(this.childrenToString().trim())
    - return this
    - }
    - destroy() {
    - this.getParent()._deleteNode(this)
    - }
    - set(firstWordPath, text) {
    - return this.touchNode(firstWordPath).setContentWithChildren(text)
    - }
    - setFromText(text) {
    - if (this.toString() === text) return this
    - const tuple = this._textToContentAndChildrenTuple(text)
    - this.setLine(tuple[0])
    - return this._setChildren(tuple[1])
    - }
    - // todo: throw error if line contains a \n
    - appendLine(line) {
    - return this._insertLineAndChildren(line)
    - }
    - appendLineAndChildren(line, children) {
    - return this._insertLineAndChildren(line, children)
    - }
    - getNodesByRegex(regex) {
    - const matches = []
    - regex = regex instanceof RegExp ? [regex] : regex
    - this._getNodesByLineRegex(matches, regex)
    - return matches
    - }
    - // todo: remove?
    - getNodesByLinePrefixes(columns) {
    - const matches = []
    - this._getNodesByLineRegex(matches, columns.map(str => new RegExp("^" + str)))
    - return matches
    - }
    - nodesThatStartWith(prefix) {
    - return this.filter(node => node.getLine().startsWith(prefix))
    - }
    - _getNodesByLineRegex(matches, regs) {
    - const rgs = regs.slice(0)
    - const reg = rgs.shift()
    - const candidates = this.filter(child => child.getLine().match(reg))
    - if (!rgs.length) return candidates.forEach(cand => matches.push(cand))
    - candidates.forEach(cand => cand._getNodesByLineRegex(matches, rgs))
    - }
    - concat(node) {
    - if (typeof node === "string") node = new TreeNode(node)
    - return node.map(node => this._insertLineAndChildren(node.getLine(), node.childrenToString()))
    - }
    - _deleteByIndexes(indexesToDelete) {
    - if (!indexesToDelete.length) return this
    - this._clearIndex()
    - // note: assumes indexesToDelete is in ascending order
    - const deletedNodes = indexesToDelete.reverse().map(index => this._getChildrenArray().splice(index, 1)[0])
    - this._setChildArrayMofifiedTime(this._getProcessTimeInMilliseconds())
    - return this
    - }
    - _deleteNode(node) {
    - const index = this._indexOfNode(node)
    - return index > -1 ? this._deleteByIndexes([index]) : 0
    - }
    - reverse() {
    - this._clearIndex()
    - this._getChildrenArray().reverse()
    - return this
    - }
    - shift() {
    - if (!this.length) return null
    - const node = this._getChildrenArray().shift()
    - return node.copyTo(new this.constructor(), 0)
    - }
    - sort(fn) {
    - this._getChildrenArray().sort(fn)
    - this._clearIndex()
    - return this
    - }
    - invert() {
    - this.forEach(node => node.getWords().reverse())
    - return this
    - }
    - _rename(oldFirstWord, newFirstWord) {
    - const index = this.indexOf(oldFirstWord)
    - if (index === -1) return this
    - const node = this._getChildrenArray()[index]
    - node.setFirstWord(newFirstWord)
    - this._clearIndex()
    - return this
    - }
    - // Does not recurse.
    - remap(map) {
    - this.forEach(node => {
    - const firstWord = node.getFirstWord()
    - if (map[firstWord] !== undefined) node.setFirstWord(map[firstWord])
    - })
    - return this
    - }
    - rename(oldFirstWord, newFirstWord) {
    - this._rename(oldFirstWord, newFirstWord)
    - return this
    - }
    - renameAll(oldName, newName) {
    - this.findNodes(oldName).forEach(node => node.setFirstWord(newName))
    - return this
    - }
    - _deleteAllChildNodesWithFirstWord(firstWord) {
    - if (!this.has(firstWord)) return this
    - const allNodes = this._getChildrenArray()
    - const indexesToDelete = []
    - allNodes.forEach((node, index) => {
    - if (node.getFirstWord() === firstWord) indexesToDelete.push(index)
    - })
    - return this._deleteByIndexes(indexesToDelete)
    - }
    - delete(path = "") {
    - const edgeSymbol = this.getEdgeSymbol()
    - if (!path.includes(edgeSymbol)) return this._deleteAllChildNodesWithFirstWord(path)
    - const parts = path.split(edgeSymbol)
    - const nextFirstWord = parts.pop()
    - const targetNode = this.getNode(parts.join(edgeSymbol))
    - return targetNode ? targetNode._deleteAllChildNodesWithFirstWord(nextFirstWord) : 0
    - }
    - deleteColumn(firstWord = "") {
    - this.forEach(node => node.delete(firstWord))
    - return this
    - }
    - _getNonMaps() {
    - const results = this.getTopDownArray().filter(node => node.hasDuplicateFirstWords())
    - if (this.hasDuplicateFirstWords()) results.unshift(this)
    - return results
    - }
    - replaceNode(fn) {
    - const parent = this.getParent()
    - const index = this.getIndex()
    - const newNodes = new TreeNode(fn(this.toString()))
    - const returnedNodes = []
    - newNodes.forEach((child, childIndex) => {
    - const newNode = parent.insertLineAndChildren(child.getLine(), child.childrenToString(), index + childIndex)
    - returnedNodes.push(newNode)
    - })
    - this.destroy()
    - return returnedNodes
    - }
    - insertLineAndChildren(line, children, index) {
    - return this._insertLineAndChildren(line, children, index)
    - }
    - insertLine(line, index) {
    - return this._insertLineAndChildren(line, undefined, index)
    - }
    - prependLine(line) {
    - return this.insertLine(line, 0)
    - }
    - pushContentAndChildren(content, children) {
    - let index = this.length
    - while (this.has(index.toString())) {
    - index++
    - }
    - const line = index.toString() + (content === undefined ? "" : this.getWordBreakSymbol() + content)
    - return this.appendLineAndChildren(line, children)
    - }
    - deleteBlanks() {
    - this.getChildren()
    - .filter(node => node.isBlankLine())
    - .forEach(node => node.destroy())
    - return this
    - }
    - // todo: add "globalReplace" method? Which runs a global regex or string replace on the Tree doc as a string?
    - firstWordSort(firstWordOrder) {
    - return this._firstWordSort(firstWordOrder)
    - }
    - deleteWordAt(wordIndex) {
    - const words = this.getWords()
    - words.splice(wordIndex, 1)
    - return this.setWords(words)
    - }
    - trigger(event) {
    - if (this._listeners && this._listeners.has(event.constructor)) {
    - const listeners = this._listeners.get(event.constructor)
    - const listenersToRemove = []
    - for (let index = 0; index < listeners.length; index++) {
    - const listener = listeners[index]
    - if (listener(event) === true) listenersToRemove.push(index)
    - }
    - listenersToRemove.reverse().forEach(index => listenersToRemove.splice(index, 1))
    - }
    - }
    - triggerAncestors(event) {
    - if (this.isRoot()) return
    - const parent = this.getParent()
    - parent.trigger(event)
    - parent.triggerAncestors(event)
    - }
    - onLineChanged(eventHandler) {
    - return this._addEventListener(LineChangedTreeEvent, eventHandler)
    - }
    - onDescendantChanged(eventHandler) {
    - return this._addEventListener(DescendantChangedTreeEvent, eventHandler)
    - }
    - onChildAdded(eventHandler) {
    - return this._addEventListener(ChildAddedTreeEvent, eventHandler)
    - }
    - onChildRemoved(eventHandler) {
    - return this._addEventListener(ChildRemovedTreeEvent, eventHandler)
    - }
    - _addEventListener(eventClass, eventHandler) {
    - if (!this._listeners) this._listeners = new Map()
    - if (!this._listeners.has(eventClass)) this._listeners.set(eventClass, [])
    - this._listeners.get(eventClass).push(eventHandler)
    - return this
    - }
    - setWords(words) {
    - return this.setLine(words.join(this.getWordBreakSymbol()))
    - }
    - setWordsFrom(index, words) {
    - this.setWords(
    - this.getWords()
    - .slice(0, index)
    - .concat(words)
    - )
    - return this
    - }
    - appendWord(word) {
    - const words = this.getWords()
    - words.push(word)
    - return this.setWords(words)
    - }
    - _firstWordSort(firstWordOrder, secondarySortFn) {
    - const nodeAFirst = -1
    - const nodeBFirst = 1
    - const map = {}
    - firstWordOrder.forEach((word, index) => {
    - map[word] = index
    - })
    - this.sort((nodeA, nodeB) => {
    - const valA = map[nodeA.getFirstWord()]
    - const valB = map[nodeB.getFirstWord()]
    - if (valA > valB) return nodeBFirst
    - if (valA < valB) return nodeAFirst
    - return secondarySortFn ? secondarySortFn(nodeA, nodeB) : 0
    - })
    - return this
    - }
    - _touchNode(firstWordPathArray) {
    - let contextNode = this
    - firstWordPathArray.forEach(firstWord => {
    - contextNode = contextNode.getNode(firstWord) || contextNode.appendLine(firstWord)
    - })
    - return contextNode
    - }
    - _touchNodeByString(str) {
    - str = str.replace(this.getNodeBreakSymbolRegex(), "") // todo: do we want to do this sanitization?
    - return this._touchNode(str.split(this.getWordBreakSymbol()))
    - }
    - touchNode(str) {
    - return this._touchNodeByString(str)
    - }
    - appendNode(node) {
    - return this.appendLineAndChildren(node.getLine(), node.childrenToString())
    - }
    - hasLine(line) {
    - return this.getChildren().some(node => node.getLine() === line)
    - }
    - getNodesByLine(line) {
    - return this.filter(node => node.getLine() === line)
    - }
    - toggleLine(line) {
    - const lines = this.getNodesByLine(line)
    - if (lines.length) {
    - lines.map(line => line.destroy())
    - return this
    - }
    - return this.appendLine(line)
    - }
    - // todo: remove?
    - sortByColumns(indexOrIndices) {
    - const indices = indexOrIndices instanceof Array ? indexOrIndices : [indexOrIndices]
    - const length = indices.length
    - this.sort((nodeA, nodeB) => {
    - const wordsA = nodeA.getWords()
    - const wordsB = nodeB.getWords()
    - for (let index = 0; index < length; index++) {
    - const col = indices[index]
    - const av = wordsA[col]
    - const bv = wordsB[col]
    - if (av === undefined) return -1
    - if (bv === undefined) return 1
    - if (av > bv) return 1
    - else if (av < bv) return -1
    - }
    - return 0
    - })
    - return this
    - }
    - getWordsAsSet() {
    - return new Set(this.getWordsFrom(1))
    - }
    - appendWordIfMissing(word) {
    - if (this.getWordsAsSet().has(word)) return this
    - return this.appendWord(word)
    - }
    - // todo: check to ensure identical objects
    - addObjectsAsDelimited(arrayOfObjects, delimiter = TreeUtils._chooseDelimiter(new TreeNode(arrayOfObjects).toString())) {
    - const header = Object.keys(arrayOfObjects[0])
    - .join(delimiter)
    - .replace(/[\n\r]/g, "")
    - const rows = arrayOfObjects.map(item =>
    - Object.values(item)
    - .join(delimiter)
    - .replace(/[\n\r]/g, "")
    - )
    - return this.addUniqueRowsToNestedDelimited(header, rows)
    - }
    - setChildrenAsDelimited(tree, delimiter = TreeUtils._chooseDelimiter(tree.toString())) {
    - tree = tree instanceof TreeNode ? tree : new TreeNode(tree)
    - return this.setChildren(tree.toDelimited(delimiter))
    - }
    - convertChildrenToDelimited(delimiter = TreeUtils._chooseDelimiter(this.childrenToString())) {
    - // todo: handle newlines!!!
    - return this.setChildren(this.toDelimited(delimiter))
    - }
    - addUniqueRowsToNestedDelimited(header, rowsAsStrings) {
    - if (!this.length) this.appendLine(header)
    - // todo: this looks brittle
    - rowsAsStrings.forEach(row => {
    - if (!this.toString().includes(row)) this.appendLine(row)
    - })
    - return this
    - }
    - shiftLeft() {
    - const grandParent = this._getGrandParent()
    - if (!grandParent) return this
    - const parentIndex = this.getParent().getIndex()
    - const newNode = grandParent.insertLineAndChildren(this.getLine(), this.length ? this.childrenToString() : undefined, parentIndex + 1)
    - this.destroy()
    - return newNode
    - }
    - pasteText(text) {
    - const parent = this.getParent()
    - const index = this.getIndex()
    - const newNodes = new TreeNode(text)
    - const firstNode = newNodes.nodeAt(0)
    - if (firstNode) {
    - this.setLine(firstNode.getLine())
    - if (firstNode.length) this.setChildren(firstNode.childrenToString())
    - } else {
    - this.setLine("")
    - }
    - newNodes.forEach((child, childIndex) => {
    - if (!childIndex)
    - // skip first
    - return true
    - parent.insertLineAndChildren(child.getLine(), child.childrenToString(), index + childIndex)
    - })
    - return this
    - }
    - templateToString(obj) {
    - // todo: compile/cache for perf?
    - const tree = this.clone()
    - tree.getTopDownArray().forEach(node => {
    - const line = node.getLine().replace(/{([^\}]+)}/g, (match, path) => {
    - const replacement = obj[path]
    - if (replacement === undefined) throw new Error(`In string template no match found on line "${node.getLine()}"`)
    - return replacement
    - })
    - node.pasteText(line)
    - })
    - return tree.toString()
    - }
    - shiftRight() {
    - const olderSibling = this._getClosestOlderSibling()
    - if (!olderSibling) return this
    - const newNode = olderSibling.appendLineAndChildren(this.getLine(), this.length ? this.childrenToString() : undefined)
    - this.destroy()
    - return newNode
    - }
    - shiftYoungerSibsRight() {
    - const nodes = this.getYoungerSiblings()
    - nodes.forEach(node => node.shiftRight())
    - return this
    - }
    - sortBy(nameOrNames) {
    - const names = nameOrNames instanceof Array ? nameOrNames : [nameOrNames]
    - const length = names.length
    - this.sort((nodeA, nodeB) => {
    - if (!nodeB.length && !nodeA.length) return 0
    - else if (!nodeA.length) return -1
    - else if (!nodeB.length) return 1
    - for (let index = 0; index < length; index++) {
    - const firstWord = names[index]
    - const av = nodeA.get(firstWord)
    - const bv = nodeB.get(firstWord)
    - if (av > bv) return 1
    - else if (av < bv) return -1
    - }
    - return 0
    - })
    - return this
    - }
    - selectNode() {
    - this._selected = true
    - }
    - unselectNode() {
    - delete this._selected
    - }
    - isSelected() {
    - return !!this._selected
    - }
    - async saveVersion() {
    - const newVersion = this.toString()
    - const topUndoVersion = this._getTopUndoVersion()
    - if (newVersion === topUndoVersion) return undefined
    - this._recordChange(newVersion)
    - this._setSavedVersion(this.toString())
    - return this
    - }
    - hasUnsavedChanges() {
    - return this.toString() !== this._getSavedVersion()
    - }
    - async redo() {
    - const undoStack = this._getUndoStack()
    - const redoStack = this._getRedoStack()
    - if (!redoStack.length) return undefined
    - undoStack.push(redoStack.pop())
    - return this._reloadFromUndoTop()
    - }
    - async undo() {
    - const undoStack = this._getUndoStack()
    - const redoStack = this._getRedoStack()
    - if (undoStack.length === 1) return undefined
    - redoStack.push(undoStack.pop())
    - return this._reloadFromUndoTop()
    - }
    - _getSavedVersion() {
    - return this._savedVersion
    - }
    - _setSavedVersion(str) {
    - this._savedVersion = str
    - return this
    - }
    - _clearRedoStack() {
    - const redoStack = this._getRedoStack()
    - redoStack.splice(0, redoStack.length)
    - }
    - getChangeHistory() {
    - return this._getUndoStack().slice(0)
    - }
    - _getUndoStack() {
    - if (!this._undoStack) this._undoStack = []
    - return this._undoStack
    - }
    - _getRedoStack() {
    - if (!this._redoStack) this._redoStack = []
    - return this._redoStack
    - }
    - _getTopUndoVersion() {
    - const undoStack = this._getUndoStack()
    - return undoStack[undoStack.length - 1]
    - }
    - async _reloadFromUndoTop() {
    - this.setChildren(this._getTopUndoVersion())
    - }
    - _recordChange(newVersion) {
    - this._clearRedoStack()
    - this._getUndoStack().push(newVersion) // todo: use diffs?
    - }
    - static fromCsv(str) {
    - return this.fromDelimited(str, ",", '"')
    - }
    - static fromJsonSubset(str) {
    - return new TreeNode(JSON.parse(str))
    - }
    - static fromSsv(str) {
    - return this.fromDelimited(str, " ", '"')
    - }
    - static fromTsv(str) {
    - return this.fromDelimited(str, "\t", '"')
    - }
    - static fromDelimited(str, delimiter, quoteChar = '"') {
    - str = str.replace(/\r/g, "") // remove windows newlines if present
    - const rows = this._getEscapedRows(str, delimiter, quoteChar)
    - return this._rowsToTreeNode(rows, delimiter, true)
    - }
    - static _getEscapedRows(str, delimiter, quoteChar) {
    - return str.includes(quoteChar) ? this._strToRows(str, delimiter, quoteChar) : str.split("\n").map(line => line.split(delimiter))
    - }
    - static fromDelimitedNoHeaders(str, delimiter, quoteChar) {
    - str = str.replace(/\r/g, "") // remove windows newlines if present
    - const rows = this._getEscapedRows(str, delimiter, quoteChar)
    - return this._rowsToTreeNode(rows, delimiter, false)
    - }
    - static _strToRows(str, delimiter, quoteChar, newLineChar = "\n") {
    - const rows = [[]]
    - const newLine = "\n"
    - const length = str.length
    - let currentCell = ""
    - let inQuote = str.substr(0, 1) === quoteChar
    - let currentPosition = inQuote ? 1 : 0
    - let nextChar
    - let isLastChar
    - let currentRow = 0
    - let char
    - let isNextCharAQuote
    - while (currentPosition < length) {
    - char = str[currentPosition]
    - isLastChar = currentPosition + 1 === length
    - nextChar = str[currentPosition + 1]
    - isNextCharAQuote = nextChar === quoteChar
    - if (inQuote) {
    - if (char !== quoteChar) currentCell += char
    - else if (isNextCharAQuote) {
    - // Both the current and next char are ", so the " is escaped
    - currentCell += nextChar
    - currentPosition++ // Jump 2
    - } else {
    - // If the current char is a " and the next char is not, it's the end of the quotes
    - inQuote = false
    - if (isLastChar) rows[currentRow].push(currentCell)
    - }
    - } else {
    - if (char === delimiter) {
    - rows[currentRow].push(currentCell)
    - currentCell = ""
    - if (isNextCharAQuote) {
    - inQuote = true
    - currentPosition++ // Jump 2
    - }
    - } else if (char === newLine) {
    - rows[currentRow].push(currentCell)
    - currentCell = ""
    - currentRow++
    - if (nextChar) rows[currentRow] = []
    - if (isNextCharAQuote) {
    - inQuote = true
    - currentPosition++ // Jump 2
    - }
    - } else if (isLastChar) rows[currentRow].push(currentCell + char)
    - else currentCell += char
    - }
    - currentPosition++
    - }
    - return rows
    - }
    - static multiply(nodeA, nodeB) {
    - const productNode = nodeA.clone()
    - productNode.forEach((node, index) => {
    - node.setChildren(node.length ? this.multiply(node, nodeB) : nodeB.clone())
    - })
    - return productNode
    - }
    - // Given an array return a tree
    - static _rowsToTreeNode(rows, delimiter, hasHeaders) {
    - const numberOfColumns = rows[0].length
    - const treeNode = new TreeNode()
    - const names = this._getHeader(rows, hasHeaders)
    - const rowCount = rows.length
    - for (let rowIndex = hasHeaders ? 1 : 0; rowIndex < rowCount; rowIndex++) {
    - let row = rows[rowIndex]
    - // If the row contains too many columns, shift the extra columns onto the last one.
    - // This allows you to not have to escape delimiter characters in the final column.
    - if (row.length > numberOfColumns) {
    - row[numberOfColumns - 1] = row.slice(numberOfColumns - 1).join(delimiter)
    - row = row.slice(0, numberOfColumns)
    - } else if (row.length < numberOfColumns) {
    - // If the row is missing columns add empty columns until it is full.
    - // This allows you to make including delimiters for empty ending columns in each row optional.
    - while (row.length < numberOfColumns) {
    - row.push("")
    - }
    - }
    - const obj = {}
    - row.forEach((cellValue, index) => {
    - obj[names[index]] = cellValue
    - })
    - treeNode.pushContentAndChildren(undefined, obj)
    - }
    - return treeNode
    - }
    - static _initializeXmlParser() {
    - if (this._xmlParser) return
    - const windowObj = window
    - if (typeof windowObj.DOMParser !== "undefined") this._xmlParser = xmlStr => new windowObj.DOMParser().parseFromString(xmlStr, "text/xml")
    - else if (typeof windowObj.ActiveXObject !== "undefined" && new windowObj.ActiveXObject("Microsoft.XMLDOM")) {
    - this._xmlParser = xmlStr => {
    - const xmlDoc = new windowObj.ActiveXObject("Microsoft.XMLDOM")
    - xmlDoc.async = "false"
    - xmlDoc.loadXML(xmlStr)
    - return xmlDoc
    - }
    - } else throw new Error("No XML parser found")
    - }
    - static fromXml(str) {
    - this._initializeXmlParser()
    - const xml = this._xmlParser(str)
    - try {
    - return this._treeNodeFromXml(xml).getNode("children")
    - } catch (err) {
    - return this._treeNodeFromXml(this._parseXml2(str)).getNode("children")
    - }
    - }
    - static _zipObject(keys, values) {
    - const obj = {}
    - keys.forEach((key, index) => (obj[key] = values[index]))
    - return obj
    - }
    - static fromShape(shapeArr, rootNode = new TreeNode()) {
    - const part = shapeArr.shift()
    - if (part !== undefined) {
    - for (let index = 0; index < part; index++) {
    - rootNode.appendLine(index.toString())
    - }
    - }
    - if (shapeArr.length) rootNode.forEach(node => TreeNode.fromShape(shapeArr.slice(0), node))
    - return rootNode
    - }
    - static fromDataTable(table) {
    - const header = table.shift()
    - return new TreeNode(table.map(row => this._zipObject(header, row)))
    - }
    - static _parseXml2(str) {
    - const el = document.createElement("div")
    - el.innerHTML = str
    - return el
    - }
    - // todo: cleanup typings
    - static _treeNodeFromXml(xml) {
    - const result = new TreeNode()
    - const children = new TreeNode()
    - // Set attributes
    - if (xml.attributes) {
    - for (let index = 0; index < xml.attributes.length; index++) {
    - result.set(xml.attributes[index].name, xml.attributes[index].value)
    - }
    - }
    - if (xml.data) children.pushContentAndChildren(xml.data)
    - // Set content
    - if (xml.childNodes && xml.childNodes.length > 0) {
    - for (let index = 0; index < xml.childNodes.length; index++) {
    - const child = xml.childNodes[index]
    - if (child.tagName && child.tagName.match(/parsererror/i)) throw new Error("Parse Error")
    - if (child.childNodes.length > 0 && child.tagName) children.appendLineAndChildren(child.tagName, this._treeNodeFromXml(child))
    - else if (child.tagName) children.appendLine(child.tagName)
    - else if (child.data) {
    - const data = child.data.trim()
    - if (data) children.pushContentAndChildren(data)
    - }
    - }
    - }
    - if (children.length > 0) result.touchNode("children").setChildren(children)
    - return result
    - }
    - static _getHeader(rows, hasHeaders) {
    - const numberOfColumns = rows[0].length
    - const headerRow = hasHeaders ? rows[0] : []
    - const WordBreakSymbol = " "
    - const ziRegex = new RegExp(WordBreakSymbol, "g")
    - if (hasHeaders) {
    - // Strip any WordBreakSymbols from column names in the header row.
    - // This makes the mapping not quite 1 to 1 if there are any WordBreakSymbols in names.
    - for (let index = 0; index < numberOfColumns; index++) {
    - headerRow[index] = headerRow[index].replace(ziRegex, "")
    - }
    - } else {
    - // If str has no headers, create them as 0,1,2,3
    - for (let index = 0; index < numberOfColumns; index++) {
    - headerRow.push(index.toString())
    - }
    - }
    - return headerRow
    - }
    - static nest(str, xValue) {
    - const NodeBreakSymbol = "\n"
    - const WordBreakSymbol = " "
    - const indent = NodeBreakSymbol + WordBreakSymbol.repeat(xValue)
    - return str ? indent + str.replace(/\n/g, indent) : ""
    - }
    - static fromDisk(path) {
    - const format = this._getFileFormat(path)
    - const content = require("fs").readFileSync(path, "utf8")
    - const methods = {
    - tree: content => new TreeNode(content),
    - csv: content => this.fromCsv(content),
    - tsv: content => this.fromTsv(content)
    - }
    - return methods[format](content)
    - }
    - }
    - TreeNode._parsers = new Map()
    - TreeNode.Parser = Parser
    - TreeNode.iris = `sepal_length,sepal_width,petal_length,petal_width,species
    - 6.1,3,4.9,1.8,virginica
    - 5.6,2.7,4.2,1.3,versicolor
    - 5.6,2.8,4.9,2,virginica
    - 6.2,2.8,4.8,1.8,virginica
    - 7.7,3.8,6.7,2.2,virginica
    - 5.3,3.7,1.5,0.2,setosa
    - 6.2,3.4,5.4,2.3,virginica
    - 4.9,2.5,4.5,1.7,virginica
    - 5.1,3.5,1.4,0.2,setosa
    - 5,3.4,1.5,0.2,setosa`
    - TreeNode.getVersion = () => "49.8.0"
    - class AbstractExtendibleTreeNode extends TreeNode {
    - _getFromExtended(firstWordPath) {
    - const hit = this._getNodeFromExtended(firstWordPath)
    - return hit ? hit.get(firstWordPath) : undefined
    - }
    - _getFamilyTree() {
    - const tree = new TreeNode()
    - this.forEach(node => {
    - const path = node._getAncestorsArray().map(node => node._getId())
    - path.reverse()
    - tree.touchNode(path.join(" "))
    - })
    - return tree
    - }
    - // todo: be more specific with the param
    - _getChildrenByNodeConstructorInExtended(constructor) {
    - return TreeUtils.flatten(this._getAncestorsArray().map(node => node.getChildrenByNodeConstructor(constructor)))
    - }
    - _getExtendedParent() {
    - return this._getAncestorsArray()[1]
    - }
    - _hasFromExtended(firstWordPath) {
    - return !!this._getNodeFromExtended(firstWordPath)
    - }
    - _getNodeFromExtended(firstWordPath) {
    - return this._getAncestorsArray().find(node => node.has(firstWordPath))
    - }
    - _getConcatBlockStringFromExtended(firstWordPath) {
    - return this._getAncestorsArray()
    - .filter(node => node.has(firstWordPath))
    - .map(node => node.getNode(firstWordPath).childrenToString())
    - .reverse()
    - .join("\n")
    - }
    - _doesExtend(nodeTypeId) {
    - return this._getAncestorSet().has(nodeTypeId)
    - }
    - _getAncestorSet() {
    - if (!this._cache_ancestorSet) this._cache_ancestorSet = new Set(this._getAncestorsArray().map(def => def._getId()))
    - return this._cache_ancestorSet
    - }
    - // Note: the order is: [this, parent, grandParent, ...]
    - _getAncestorsArray(cannotContainNodes) {
    - this._initAncestorsArrayCache(cannotContainNodes)
    - return this._cache_ancestorsArray
    - }
    - _getIdThatThisExtends() {
    - return this.get(TreeNotationConstants.extends)
    - }
    - _initAncestorsArrayCache(cannotContainNodes) {
    - if (this._cache_ancestorsArray) return undefined
    - if (cannotContainNodes && cannotContainNodes.includes(this)) throw new Error(`Loop detected: '${this.getLine()}' is the ancestor of one of its ancestors.`)
    - cannotContainNodes = cannotContainNodes || [this]
    - let ancestors = [this]
    - const extendedId = this._getIdThatThisExtends()
    - if (extendedId) {
    - const parentNode = this._getIdToNodeMap()[extendedId]
    - if (!parentNode) throw new Error(`${extendedId} not found`)
    - ancestors = ancestors.concat(parentNode._getAncestorsArray(cannotContainNodes))
    - }
    - this._cache_ancestorsArray = ancestors
    - }
    - }
    - class ExtendibleTreeNode extends AbstractExtendibleTreeNode {
    - _getIdToNodeMap() {
    - if (!this.isRoot()) return this.getRootNode()._getIdToNodeMap()
    - if (!this._nodeMapCache) {
    - this._nodeMapCache = {}
    - this.forEach(child => {
    - this._nodeMapCache[child._getId()] = child
    - })
    - }
    - return this._nodeMapCache
    - }
    - _getId() {
    - return this.getWord(0)
    - }
    - }
    - window.TreeNode = TreeNode
    - window.ExtendibleTreeNode = ExtendibleTreeNode
    - window.AbstractExtendibleTreeNode = AbstractExtendibleTreeNode
    - window.TreeEvents = TreeEvents
    - window.TreeWord = TreeWord
    - var GrammarConstantsCompiler
    - ;(function(GrammarConstantsCompiler) {
    - GrammarConstantsCompiler["stringTemplate"] = "stringTemplate"
    - GrammarConstantsCompiler["indentCharacter"] = "indentCharacter"
    - GrammarConstantsCompiler["catchAllCellDelimiter"] = "catchAllCellDelimiter"
    - GrammarConstantsCompiler["openChildren"] = "openChildren"
    - GrammarConstantsCompiler["joinChildrenWith"] = "joinChildrenWith"
    - GrammarConstantsCompiler["closeChildren"] = "closeChildren"
    - })(GrammarConstantsCompiler || (GrammarConstantsCompiler = {}))
    - var SqlLiteTypes
    - ;(function(SqlLiteTypes) {
    - SqlLiteTypes["integer"] = "INTEGER"
    - SqlLiteTypes["float"] = "FLOAT"
    - SqlLiteTypes["text"] = "TEXT"
    - })(SqlLiteTypes || (SqlLiteTypes = {}))
    - var GrammarConstantsMisc
    - ;(function(GrammarConstantsMisc) {
    - GrammarConstantsMisc["doNotSynthesize"] = "doNotSynthesize"
    - GrammarConstantsMisc["tableName"] = "tableName"
    - })(GrammarConstantsMisc || (GrammarConstantsMisc = {}))
    - var PreludeCellTypeIds
    - ;(function(PreludeCellTypeIds) {
    - PreludeCellTypeIds["anyCell"] = "anyCell"
    - PreludeCellTypeIds["keywordCell"] = "keywordCell"
    - PreludeCellTypeIds["extraWordCell"] = "extraWordCell"
    - PreludeCellTypeIds["floatCell"] = "floatCell"
    - PreludeCellTypeIds["numberCell"] = "numberCell"
    - PreludeCellTypeIds["bitCell"] = "bitCell"
    - PreludeCellTypeIds["boolCell"] = "boolCell"
    - PreludeCellTypeIds["intCell"] = "intCell"
    - })(PreludeCellTypeIds || (PreludeCellTypeIds = {}))
    - var GrammarConstantsConstantTypes
    - ;(function(GrammarConstantsConstantTypes) {
    - GrammarConstantsConstantTypes["boolean"] = "boolean"
    - GrammarConstantsConstantTypes["string"] = "string"
    - GrammarConstantsConstantTypes["int"] = "int"
    - GrammarConstantsConstantTypes["float"] = "float"
    - })(GrammarConstantsConstantTypes || (GrammarConstantsConstantTypes = {}))
    - var GrammarBundleFiles
    - ;(function(GrammarBundleFiles) {
    - GrammarBundleFiles["package"] = "package.json"
    - GrammarBundleFiles["readme"] = "readme.md"
    - GrammarBundleFiles["indexHtml"] = "index.html"
    - GrammarBundleFiles["indexJs"] = "index.js"
    - GrammarBundleFiles["testJs"] = "test.js"
    - })(GrammarBundleFiles || (GrammarBundleFiles = {}))
    - var GrammarCellParser
    - ;(function(GrammarCellParser) {
    - GrammarCellParser["prefix"] = "prefix"
    - GrammarCellParser["postfix"] = "postfix"
    - GrammarCellParser["omnifix"] = "omnifix"
    - })(GrammarCellParser || (GrammarCellParser = {}))
    - var GrammarConstants
    - ;(function(GrammarConstants) {
    - // node types
    - GrammarConstants["extensions"] = "extensions"
    - GrammarConstants["toolingDirective"] = "tooling"
    - GrammarConstants["todoComment"] = "todo"
    - GrammarConstants["version"] = "version"
    - GrammarConstants["nodeType"] = "nodeType"
    - GrammarConstants["cellType"] = "cellType"
    - GrammarConstants["grammarFileExtension"] = "grammar"
    - GrammarConstants["nodeTypeSuffix"] = "Node"
    - GrammarConstants["cellTypeSuffix"] = "Cell"
    - // error check time
    - GrammarConstants["regex"] = "regex"
    - GrammarConstants["reservedWords"] = "reservedWords"
    - GrammarConstants["enumFromCellTypes"] = "enumFromCellTypes"
    - GrammarConstants["enum"] = "enum"
    - GrammarConstants["examples"] = "examples"
    - GrammarConstants["min"] = "min"
    - GrammarConstants["max"] = "max"
    - // baseNodeTypes
    - GrammarConstants["baseNodeType"] = "baseNodeType"
    - GrammarConstants["blobNode"] = "blobNode"
    - GrammarConstants["errorNode"] = "errorNode"
    - // parse time
    - GrammarConstants["extends"] = "extends"
    - GrammarConstants["abstract"] = "abstract"
    - GrammarConstants["root"] = "root"
    - GrammarConstants["crux"] = "crux"
    - GrammarConstants["pattern"] = "pattern"
    - GrammarConstants["inScope"] = "inScope"
    - GrammarConstants["cells"] = "cells"
    - GrammarConstants["catchAllCellType"] = "catchAllCellType"
    - GrammarConstants["cellParser"] = "cellParser"
    - GrammarConstants["catchAllNodeType"] = "catchAllNodeType"
    - GrammarConstants["constants"] = "constants"
    - GrammarConstants["required"] = "required"
    - GrammarConstants["single"] = "single"
    - GrammarConstants["tags"] = "tags"
    - GrammarConstants["_extendsJsClass"] = "_extendsJsClass"
    - GrammarConstants["_rootNodeJsHeader"] = "_rootNodeJsHeader"
    - // default catchAll nodeType
    - GrammarConstants["BlobNode"] = "BlobNode"
    - GrammarConstants["defaultRootNode"] = "defaultRootNode"
    - // code
    - GrammarConstants["javascript"] = "javascript"
    - // compile time
    - GrammarConstants["compilerNodeType"] = "compiler"
    - GrammarConstants["compilesTo"] = "compilesTo"
    - // develop time
    - GrammarConstants["description"] = "description"
    - GrammarConstants["example"] = "example"
    - GrammarConstants["frequency"] = "frequency"
    - GrammarConstants["highlightScope"] = "highlightScope"
    - })(GrammarConstants || (GrammarConstants = {}))
    - class TypedWord extends TreeWord {
    - constructor(node, cellIndex, type) {
    - super(node, cellIndex)
    - this._type = type
    - }
    - get type() {
    - return this._type
    - }
    - toString() {
    - return this.word + ":" + this.type
    - }
    - }
    - // todo: can we merge these methods into base TreeNode and ditch this class?
    - class GrammarBackedNode extends TreeNode {
    - getDefinition() {
    - const handGrammarProgram = this.getHandGrammarProgram()
    - return this.isRoot() ? handGrammarProgram : handGrammarProgram.getNodeTypeDefinitionByNodeTypeId(this.constructor.name)
    - }
    - toSqlLiteInsertStatement(primaryKeyFunction = node => node.getWord(0)) {
    - const def = this.getDefinition()
    - const tableName = def.getTableNameIfAny() || def._getId()
    - const columns = def.getSqlLiteTableColumns()
    - const hits = columns.filter(colDef => this.has(colDef.columnName))
    - const values = hits.map(colDef => {
    - const node = this.getNode(colDef.columnName)
    - const content = node.getContent()
    - return colDef.type === SqlLiteTypes.text ? `"${content}"` : content
    - })
    - hits.unshift({ columnName: "id", type: SqlLiteTypes.text })
    - values.unshift(`"${primaryKeyFunction(this)}"`)
    - return `INSERT INTO ${tableName} (${hits.map(col => col.columnName).join(",")}) VALUES (${values.join(",")});`
    - }
    - getAutocompleteResults(partialWord, cellIndex) {
    - return cellIndex === 0 ? this._getAutocompleteResultsForFirstWord(partialWord) : this._getAutocompleteResultsForCell(partialWord, cellIndex)
    - }
    - getChildInstancesOfNodeTypeId(nodeTypeId) {
    - return this.filter(node => node.doesExtend(nodeTypeId))
    - }
    - doesExtend(nodeTypeId) {
    - return this.getDefinition()._doesExtend(nodeTypeId)
    - }
    - _getErrorNodeErrors() {
    - return [this.getFirstWord() ? new UnknownNodeTypeError(this) : new BlankLineError(this)]
    - }
    - _getBlobNodeCatchAllNodeType() {
    - return BlobNode
    - }
    - _getAutocompleteResultsForFirstWord(partialWord) {
    - const keywordMap = this.getDefinition().getFirstWordMapWithDefinitions()
    - let keywords = Object.keys(keywordMap)
    - if (partialWord) keywords = keywords.filter(keyword => keyword.includes(partialWord))
    - return keywords.map(keyword => {
    - const def = keywordMap[keyword]
    - const description = def.getDescription()
    - return {
    - text: keyword,
    - displayText: keyword + (description ? " " + description : "")
    - }
    - })
    - }
    - _getAutocompleteResultsForCell(partialWord, cellIndex) {
    - // todo: root should be [] correct?
    - const cell = this._getParsedCells()[cellIndex]
    - return cell ? cell.getAutoCompleteWords(partialWord) : []
    - }
    - // note: this is overwritten by the root node of a runtime grammar program.
    - // some of the magic that makes this all work. but maybe there's a better way.
    - getHandGrammarProgram() {
    - if (this.isRoot()) throw new Error(`Root node without getHandGrammarProgram defined.`)
    - return this.getRootNode().getHandGrammarProgram()
    - }
    - getRunTimeEnumOptions(cell) {
    - return undefined
    - }
    - _sortNodesByInScopeOrder() {
    - const nodeTypeOrder = this.getDefinition()._getMyInScopeNodeTypeIds()
    - if (!nodeTypeOrder.length) return this
    - const orderMap = {}
    - nodeTypeOrder.forEach((word, index) => {
    - orderMap[word] = index
    - })
    - this.sort(
    - TreeUtils.makeSortByFn(runtimeNode => {
    - return orderMap[runtimeNode.getDefinition().getNodeTypeIdFromDefinition()]
    - })
    - )
    - return this
    - }
    - _getRequiredNodeErrors(errors = []) {
    - Object.values(this.getDefinition().getFirstWordMapWithDefinitions()).forEach(def => {
    - if (def.isRequired()) {
    - if (!this.getChildren().some(node => node.getDefinition() === def)) errors.push(new MissingRequiredNodeTypeError(this, def.getNodeTypeIdFromDefinition()))
    - }
    - })
    - return errors
    - }
    - getProgramAsCells() {
    - // todo: what is this?
    - return this.getTopDownArray().map(node => {
    - const cells = node._getParsedCells()
    - let indents = node.getIndentLevel() - 1
    - while (indents) {
    - cells.unshift(undefined)
    - indents--
    - }
    - return cells
    - })
    - }
    - getProgramWidth() {
    - return Math.max(...this.getProgramAsCells().map(line => line.length))
    - }
    - getAllTypedWords() {
    - const words = []
    - this.getTopDownArray().forEach(node => {
    - node.getWordTypes().forEach((cell, index) => {
    - words.push(new TypedWord(node, index, cell.getCellTypeId()))
    - })
    - })
    - return words
    - }
    - findAllWordsWithCellType(cellTypeId) {
    - return this.getAllTypedWords().filter(typedWord => typedWord.type === cellTypeId)
    - }
    - findAllNodesWithNodeType(nodeTypeId) {
    - return this.getTopDownArray().filter(node => node.getDefinition().getNodeTypeIdFromDefinition() === nodeTypeId)
    - }
    - toCellTypeTree() {
    - return this.getTopDownArray()
    - .map(child => child.getIndentation() + child.getLineCellTypes())
    - .join("\n")
    - }
    - getParseTable(maxColumnWidth = 40) {
    - const tree = new TreeNode(this.toCellTypeTree())
    - return new TreeNode(
    - tree.getTopDownArray().map((node, lineNumber) => {
    - const sourceNode = this.nodeAtLine(lineNumber)
    - const errs = sourceNode.getErrors()
    - const errorCount = errs.length
    - const obj = {
    - lineNumber: lineNumber,
    - source: sourceNode.getIndentation() + sourceNode.getLine(),
    - nodeType: sourceNode.constructor.name,
    - cellTypes: node.getContent(),
    - errorCount: errorCount
    - }
    - if (errorCount) obj.errorMessages = errs.map(err => err.getMessage()).join(";")
    - return obj
    - })
    - ).toFormattedTable(maxColumnWidth)
    - }
    - // Helper method for selecting potential nodeTypes needed to update grammar file.
    - getInvalidNodeTypes() {
    - return Array.from(
    - new Set(
    - this.getAllErrors()
    - .filter(err => err instanceof UnknownNodeTypeError)
    - .map(err => err.getNode().getFirstWord())
    - )
    - )
    - }
    - _getAllAutoCompleteWords() {
    - return this.getAllWordBoundaryCoordinates().map(coordinate => {
    - const results = this.getAutocompleteResultsAt(coordinate.lineIndex, coordinate.charIndex)
    - return {
    - lineIndex: coordinate.lineIndex,
    - charIndex: coordinate.charIndex,
    - wordIndex: coordinate.wordIndex,
    - word: results.word,
    - suggestions: results.matches
    - }
    - })
    - }
    - toAutoCompleteCube(fillChar = "") {
    - const trees = [this.clone()]
    - const filled = this.clone().fill(fillChar)
    - this._getAllAutoCompleteWords().forEach(hole => {
    - hole.suggestions.forEach((suggestion, index) => {
    - if (!trees[index + 1]) trees[index + 1] = filled.clone()
    - trees[index + 1].nodeAtLine(hole.lineIndex).setWord(hole.wordIndex, suggestion.text)
    - })
    - })
    - return new TreeNode(trees)
    - }
    - toAutoCompleteTable() {
    - return new TreeNode(
    - this._getAllAutoCompleteWords().map(result => {
    - result.suggestions = result.suggestions.map(node => node.text).join(" ")
    - return result
    - })
    - ).toTable()
    - }
    - getAutocompleteResultsAt(lineIndex, charIndex) {
    - const lineNode = this.nodeAtLine(lineIndex) || this
    - const nodeInScope = lineNode.getNodeInScopeAtCharIndex(charIndex)
    - // todo: add more tests
    - // todo: second param this.childrenToString()
    - // todo: change to getAutocomplete definitions
    - const wordIndex = lineNode.getWordIndexAtCharacterIndex(charIndex)
    - const wordProperties = lineNode.getWordProperties(wordIndex)
    - return {
    - startCharIndex: wordProperties.startCharIndex,
    - endCharIndex: wordProperties.endCharIndex,
    - word: wordProperties.word,
    - matches: nodeInScope.getAutocompleteResults(wordProperties.word, wordIndex)
    - }
    - }
    - _sortWithParentNodeTypesUpTop() {
    - const familyTree = new HandGrammarProgram(this.toString()).getNodeTypeFamilyTree()
    - const rank = {}
    - familyTree.getTopDownArray().forEach((node, index) => {
    - rank[node.getWord(0)] = index
    - })
    - const nodeAFirst = -1
    - const nodeBFirst = 1
    - this.sort((nodeA, nodeB) => {
    - const nodeARank = rank[nodeA.getWord(0)]
    - const nodeBRank = rank[nodeB.getWord(0)]
    - return nodeARank < nodeBRank ? nodeAFirst : nodeBFirst
    - })
    - return this
    - }
    - format() {
    - if (this.isRoot()) {
    - this._sortNodesByInScopeOrder()
    - try {
    - this._sortWithParentNodeTypesUpTop()
    - } catch (err) {
    - console.log(`Warning: ${err}`)
    - }
    - }
    - this.getTopDownArray().forEach(child => {
    - child.format()
    - })
    - return this
    - }
    - getNodeTypeUsage(filepath = "") {
    - // returns a report on what nodeTypes from its language the program uses
    - const usage = new TreeNode()
    - const handGrammarProgram = this.getHandGrammarProgram()
    - handGrammarProgram.getValidConcreteAndAbstractNodeTypeDefinitions().forEach(def => {
    - const requiredCellTypeIds = def.getCellParser().getRequiredCellTypeIds()
    - usage.appendLine([def.getNodeTypeIdFromDefinition(), "line-id", "nodeType", requiredCellTypeIds.join(" ")].join(" "))
    - })
    - this.getTopDownArray().forEach((node, lineNumber) => {
    - const stats = usage.getNode(node.getNodeTypeId())
    - stats.appendLine([filepath + "-" + lineNumber, node.getWords().join(" ")].join(" "))
    - })
    - return usage
    - }
    - toHighlightScopeTree() {
    - return this.getTopDownArray()
    - .map(child => child.getIndentation() + child.getLineHighlightScopes())
    - .join("\n")
    - }
    - toDefinitionLineNumberTree() {
    - return this.getTopDownArray()
    - .map(child => child.getDefinition().getLineNumber() + " " + child.getIndentation() + child.getCellDefinitionLineNumbers().join(" "))
    - .join("\n")
    - }
    - toCellTypeTreeWithNodeConstructorNames() {
    - return this.getTopDownArray()
    - .map(child => child.constructor.name + this.getWordBreakSymbol() + child.getIndentation() + child.getLineCellTypes())
    - .join("\n")
    - }
    - toPreludeCellTypeTreeWithNodeConstructorNames() {
    - return this.getTopDownArray()
    - .map(child => child.constructor.name + this.getWordBreakSymbol() + child.getIndentation() + child.getLineCellPreludeTypes())
    - .join("\n")
    - }
    - getTreeWithNodeTypes() {
    - return this.getTopDownArray()
    - .map(child => child.constructor.name + this.getWordBreakSymbol() + child.getIndentation() + child.getLine())
    - .join("\n")
    - }
    - getCellHighlightScopeAtPosition(lineIndex, wordIndex) {
    - this._initCellTypeCache()
    - const typeNode = this._cache_highlightScopeTree.getTopDownArray()[lineIndex - 1]
    - return typeNode ? typeNode.getWord(wordIndex - 1) : undefined
    - }
    - _initCellTypeCache() {
    - const treeMTime = this.getLineOrChildrenModifiedTime()
    - if (this._cache_programCellTypeStringMTime === treeMTime) return undefined
    - this._cache_typeTree = new TreeNode(this.toCellTypeTree())
    - this._cache_highlightScopeTree = new TreeNode(this.toHighlightScopeTree())
    - this._cache_programCellTypeStringMTime = treeMTime
    - }
    - createParser() {
    - return this.isRoot()
    - ? new TreeNode.Parser(BlobNode)
    - : new TreeNode.Parser(
    - this.getParent()
    - ._getParser()
    - ._getCatchAllNodeConstructor(this.getParent()),
    - {}
    - )
    - }
    - getNodeTypeId() {
    - return this.getDefinition().getNodeTypeIdFromDefinition()
    - }
    - getWordTypes() {
    - return this._getParsedCells().filter(cell => cell.getWord() !== undefined)
    - }
    - getErrors() {
    - const errors = this._getParsedCells()
    - .map(check => check.getErrorIfAny())
    - .filter(identity => identity)
    - const firstWord = this.getFirstWord()
    - if (this.getDefinition().has(GrammarConstants.single))
    - this.getParent()
    - .findNodes(firstWord)
    - .forEach((node, index) => {
    - if (index) errors.push(new NodeTypeUsedMultipleTimesError(node))
    - })
    - return this._getRequiredNodeErrors(errors)
    - }
    - _getParsedCells() {
    - return this.getDefinition()
    - .getCellParser()
    - .getCellArray(this)
    - }
    - // todo: just make a fn that computes proper spacing and then is given a node to print
    - getLineCellTypes() {
    - return this._getParsedCells()
    - .map(slot => slot.getCellTypeId())
    - .join(" ")
    - }
    - getLineCellPreludeTypes() {
    - return this._getParsedCells()
    - .map(slot => {
    - const def = slot._getCellTypeDefinition()
    - //todo: cleanup
    - return def ? def._getPreludeKindId() : PreludeCellTypeIds.anyCell
    - })
    - .join(" ")
    - }
    - getLineHighlightScopes(defaultScope = "source") {
    - return this._getParsedCells()
    - .map(slot => slot.getHighlightScope() || defaultScope)
    - .join(" ")
    - }
    - getCellDefinitionLineNumbers() {
    - return this._getParsedCells().map(cell => cell.getDefinitionLineNumber())
    - }
    - _getCompiledIndentation() {
    - const indentCharacter = this.getDefinition()._getCompilerObject()[GrammarConstantsCompiler.indentCharacter]
    - const indent = this.getIndentation()
    - return indentCharacter !== undefined ? indentCharacter.repeat(indent.length) : indent
    - }
    - _getFields() {
    - // fields are like cells
    - const fields = {}
    - this.forEach(node => {
    - const def = node.getDefinition()
    - if (def.isRequired() || def.has(GrammarConstants.single)) fields[node.getWord(0)] = node.getContent()
    - })
    - return fields
    - }
    - _getCompiledLine() {
    - const compiler = this.getDefinition()._getCompilerObject()
    - const catchAllCellDelimiter = compiler[GrammarConstantsCompiler.catchAllCellDelimiter]
    - const str = compiler[GrammarConstantsCompiler.stringTemplate]
    - return str !== undefined ? TreeUtils.formatStr(str, catchAllCellDelimiter, Object.assign(this._getFields(), this.cells)) : this.getLine()
    - }
    - compile() {
    - if (this.isRoot()) return super.compile()
    - const def = this.getDefinition()
    - if (def.isTerminalNodeType()) return this._getCompiledIndentation() + this._getCompiledLine()
    - const compiler = def._getCompilerObject()
    - const openChildrenString = compiler[GrammarConstantsCompiler.openChildren] || ""
    - const closeChildrenString = compiler[GrammarConstantsCompiler.closeChildren] || ""
    - const childJoinCharacter = compiler[GrammarConstantsCompiler.joinChildrenWith] || "\n"
    - const compiledLine = this._getCompiledLine()
    - const indent = this._getCompiledIndentation()
    - const compiledChildren = this.map(child => child.compile()).join(childJoinCharacter)
    - return `${indent}${compiledLine}${openChildrenString}
    - ${compiledChildren}
    - ${indent}${closeChildrenString}`
    - }
    - // todo: remove
    - get cells() {
    - const cells = {}
    - this._getParsedCells().forEach(cell => {
    - const cellTypeId = cell.getCellTypeId()
    - if (!cell.isCatchAll()) cells[cellTypeId] = cell.getParsed()
    - else {
    - if (!cells[cellTypeId]) cells[cellTypeId] = []
    - cells[cellTypeId].push(cell.getParsed())
    - }
    - })
    - return cells
    - }
    - }
    - class BlobNode extends GrammarBackedNode {
    - createParser() {
    - return new TreeNode.Parser(BlobNode, {})
    - }
    - getErrors() {
    - return []
    - }
    - }
    - // todo: can we remove this? hard to extend.
    - class UnknownNodeTypeNode extends GrammarBackedNode {
    - createParser() {
    - return new TreeNode.Parser(UnknownNodeTypeNode, {})
    - }
    - getErrors() {
    - return [new UnknownNodeTypeError(this)]
    - }
    - }
    - /*
    - A cell contains a word but also the type information for that word.
    - */
    - class AbstractGrammarBackedCell {
    - constructor(node, index, typeDef, cellTypeId, isCatchAll, nodeTypeDef) {
    - this._typeDef = typeDef
    - this._node = node
    - this._isCatchAll = isCatchAll
    - this._index = index
    - this._cellTypeId = cellTypeId
    - this._nodeTypeDefinition = nodeTypeDef
    - }
    - getWord() {
    - return this._node.getWord(this._index)
    - }
    - getDefinitionLineNumber() {
    - return this._typeDef.getLineNumber()
    - }
    - getSqlLiteType() {
    - return SqlLiteTypes.text
    - }
    - getCellTypeId() {
    - return this._cellTypeId
    - }
    - getNode() {
    - return this._node
    - }
    - getCellIndex() {
    - return this._index
    - }
    - isCatchAll() {
    - return this._isCatchAll
    - }
    - get min() {
    - return this._getCellTypeDefinition().get(GrammarConstants.min) || "0"
    - }
    - get max() {
    - return this._getCellTypeDefinition().get(GrammarConstants.max) || "100"
    - }
    - get placeholder() {
    - return this._getCellTypeDefinition().get(GrammarConstants.examples) || ""
    - }
    - getHighlightScope() {
    - const definition = this._getCellTypeDefinition()
    - if (definition) return definition.getHighlightScope() // todo: why the undefined?
    - }
    - getAutoCompleteWords(partialWord = "") {
    - const cellDef = this._getCellTypeDefinition()
    - let words = cellDef ? cellDef._getAutocompleteWordOptions(this.getNode().getRootNode()) : []
    - const runTimeOptions = this.getNode().getRunTimeEnumOptions(this)
    - if (runTimeOptions) words = runTimeOptions.concat(words)
    - if (partialWord) words = words.filter(word => word.includes(partialWord))
    - return words.map(word => {
    - return {
    - text: word,
    - displayText: word
    - }
    - })
    - }
    - synthesizeCell(seed = Date.now()) {
    - // todo: cleanup
    - const cellDef = this._getCellTypeDefinition()
    - const enumOptions = cellDef._getFromExtended(GrammarConstants.enum)
    - if (enumOptions) return TreeUtils.getRandomString(1, enumOptions.split(" "))
    - return this._synthesizeCell(seed)
    - }
    - _getStumpEnumInput(crux) {
    - const cellDef = this._getCellTypeDefinition()
    - const enumOptions = cellDef._getFromExtended(GrammarConstants.enum)
    - if (!enumOptions) return undefined
    - const options = new TreeNode(
    - enumOptions
    - .split(" ")
    - .map(option => `option ${option}`)
    - .join("\n")
    - )
    - return `select
    - name ${crux}
    - ${options.toString(1)}`
    - }
    - _toStumpInput(crux) {
    - // todo: remove
    - const enumInput = this._getStumpEnumInput(crux)
    - if (enumInput) return enumInput
    - // todo: cleanup. We shouldn't have these dual cellType classes.
    - return `input
    - name ${crux}
    - placeholder ${this.placeholder}`
    - }
    - _getCellTypeDefinition() {
    - return this._typeDef
    - }
    - _getFullLine() {
    - return this.getNode().getLine()
    - }
    - _getErrorContext() {
    - return this._getFullLine().split(" ")[0] // todo: WordBreakSymbol
    - }
    - isValid() {
    - const runTimeOptions = this.getNode().getRunTimeEnumOptions(this)
    - const word = this.getWord()
    - if (runTimeOptions) return runTimeOptions.includes(word)
    - return this._getCellTypeDefinition().isValid(word, this.getNode().getRootNode()) && this._isValid()
    - }
    - getErrorIfAny() {
    - const word = this.getWord()
    - if (word !== undefined && this.isValid()) return undefined
    - // todo: refactor invalidwordError. We want better error messages.
    - return word === undefined || word === "" ? new MissingWordError(this) : new InvalidWordError(this)
    - }
    - }
    - AbstractGrammarBackedCell.parserFunctionName = ""
    - class GrammarBitCell extends AbstractGrammarBackedCell {
    - _isValid() {
    - const word = this.getWord()
    - return word === "0" || word === "1"
    - }
    - _synthesizeCell() {
    - return TreeUtils.getRandomString(1, "01".split(""))
    - }
    - getRegexString() {
    - return "[01]"
    - }
    - getParsed() {
    - const word = this.getWord()
    - return !!parseInt(word)
    - }
    - }
    - GrammarBitCell.defaultHighlightScope = "constant.numeric"
    - class GrammarNumericCell extends AbstractGrammarBackedCell {
    - _toStumpInput(crux) {
    - return `input
    - name ${crux}
    - type number
    - placeholder ${this.placeholder}
    - min ${this.min}
    - max ${this.max}`
    - }
    - }
    - class GrammarIntCell extends GrammarNumericCell {
    - _isValid() {
    - const word = this.getWord()
    - const num = parseInt(word)
    - if (isNaN(num)) return false
    - return num.toString() === word
    - }
    - _synthesizeCell(seed) {
    - return TreeUtils.randomUniformInt(parseInt(this.min), parseInt(this.max), seed).toString()
    - }
    - getRegexString() {
    - return "-?[0-9]+"
    - }
    - getSqlLiteType() {
    - return SqlLiteTypes.integer
    - }
    - getParsed() {
    - const word = this.getWord()
    - return parseInt(word)
    - }
    - }
    - GrammarIntCell.defaultHighlightScope = "constant.numeric.integer"
    - GrammarIntCell.parserFunctionName = "parseInt"
    - class GrammarFloatCell extends GrammarNumericCell {
    - _isValid() {
    - const word = this.getWord()
    - const num = parseFloat(word)
    - return !isNaN(num) && /^-?\d*(\.\d+)?$/.test(word)
    - }
    - getSqlLiteType() {
    - return SqlLiteTypes.float
    - }
    - _synthesizeCell(seed) {
    - return TreeUtils.randomUniformFloat(parseFloat(this.min), parseFloat(this.max), seed).toString()
    - }
    - getRegexString() {
    - return "-?d*(.d+)?"
    - }
    - getParsed() {
    - const word = this.getWord()
    - return parseFloat(word)
    - }
    - }
    - GrammarFloatCell.defaultHighlightScope = "constant.numeric.float"
    - GrammarFloatCell.parserFunctionName = "parseFloat"
    - // ErrorCellType => grammar asks for a '' cell type here but the grammar does not specify a '' cell type. (todo: bring in didyoumean?)
    - class GrammarBoolCell extends AbstractGrammarBackedCell {
    - constructor() {
    - super(...arguments)
    - this._trues = new Set(["1", "true", "t", "yes"])
    - this._falses = new Set(["0", "false", "f", "no"])
    - }
    - _isValid() {
    - const word = this.getWord()
    - const str = word.toLowerCase()
    - return this._trues.has(str) || this._falses.has(str)
    - }
    - _synthesizeCell() {
    - return TreeUtils.getRandomString(1, ["1", "true", "t", "yes", "0", "false", "f", "no"])
    - }
    - _getOptions() {
    - return Array.from(this._trues).concat(Array.from(this._falses))
    - }
    - getRegexString() {
    - return "(?:" + this._getOptions().join("|") + ")"
    - }
    - getParsed() {
    - const word = this.getWord()
    - return this._trues.has(word.toLowerCase())
    - }
    - }
    - GrammarBoolCell.defaultHighlightScope = "constant.numeric"
    - class GrammarAnyCell extends AbstractGrammarBackedCell {
    - _isValid() {
    - return true
    - }
    - _synthesizeCell() {
    - const examples = this._getCellTypeDefinition()._getFromExtended(GrammarConstants.examples)
    - if (examples) return TreeUtils.getRandomString(1, examples.split(" "))
    - return this._nodeTypeDefinition.getNodeTypeIdFromDefinition() + "-" + this.constructor.name
    - }
    - getRegexString() {
    - return "[^ ]+"
    - }
    - getParsed() {
    - return this.getWord()
    - }
    - }
    - class GrammarKeywordCell extends GrammarAnyCell {
    - _synthesizeCell() {
    - return this._nodeTypeDefinition._getCruxIfAny()
    - }
    - }
    - GrammarKeywordCell.defaultHighlightScope = "keyword"
    - class GrammarExtraWordCellTypeCell extends AbstractGrammarBackedCell {
    - _isValid() {
    - return false
    - }
    - synthesizeCell() {
    - throw new Error(`Trying to synthesize a GrammarExtraWordCellTypeCell`)
    - return this._synthesizeCell()
    - }
    - _synthesizeCell() {
    - return "extraWord" // should never occur?
    - }
    - getParsed() {
    - return this.getWord()
    - }
    - getErrorIfAny() {
    - return new ExtraWordError(this)
    - }
    - }
    - class GrammarUnknownCellTypeCell extends AbstractGrammarBackedCell {
    - _isValid() {
    - return false
    - }
    - synthesizeCell() {
    - throw new Error(`Trying to synthesize an GrammarUnknownCellTypeCell`)
    - return this._synthesizeCell()
    - }
    - _synthesizeCell() {
    - return "extraWord" // should never occur?
    - }
    - getParsed() {
    - return this.getWord()
    - }
    - getErrorIfAny() {
    - return new UnknownCellTypeError(this)
    - }
    - }
    - class AbstractTreeError {
    - constructor(node) {
    - this._node = node
    - }
    - getLineIndex() {
    - return this.getLineNumber() - 1
    - }
    - getLineNumber() {
    - return this.getNode()._getLineNumber() // todo: handle sourcemaps
    - }
    - isCursorOnWord(lineIndex, characterIndex) {
    - return lineIndex === this.getLineIndex() && this._doesCharacterIndexFallOnWord(characterIndex)
    - }
    - _doesCharacterIndexFallOnWord(characterIndex) {
    - return this.getCellIndex() === this.getNode().getWordIndexAtCharacterIndex(characterIndex)
    - }
    - // convenience method. may be removed.
    - isBlankLineError() {
    - return false
    - }
    - // convenience method. may be removed.
    - isMissingWordError() {
    - return false
    - }
    - getIndent() {
    - return this.getNode().getIndentation()
    - }
    - getCodeMirrorLineWidgetElement(onApplySuggestionCallBack = () => {}) {
    - const suggestion = this.getSuggestionMessage()
    - if (this.isMissingWordError()) return this._getCodeMirrorLineWidgetElementCellTypeHints()
    - if (suggestion) return this._getCodeMirrorLineWidgetElementWithSuggestion(onApplySuggestionCallBack, suggestion)
    - return this._getCodeMirrorLineWidgetElementWithoutSuggestion()
    - }
    - getNodeTypeId() {
    - return this.getNode()
    - .getDefinition()
    - .getNodeTypeIdFromDefinition()
    - }
    - _getCodeMirrorLineWidgetElementCellTypeHints() {
    - const el = document.createElement("div")
    - el.appendChild(
    - document.createTextNode(
    - this.getIndent() +
    - this.getNode()
    - .getDefinition()
    - .getLineHints()
    - )
    - )
    - el.className = "LintCellTypeHints"
    - return el
    - }
    - _getCodeMirrorLineWidgetElementWithoutSuggestion() {
    - const el = document.createElement("div")
    - el.appendChild(document.createTextNode(this.getIndent() + this.getMessage()))
    - el.className = "LintError"
    - return el
    - }
    - _getCodeMirrorLineWidgetElementWithSuggestion(onApplySuggestionCallBack, suggestion) {
    - const el = document.createElement("div")
    - el.appendChild(document.createTextNode(this.getIndent() + `${this.getErrorTypeName()}. Suggestion: ${suggestion}`))
    - el.className = "LintErrorWithSuggestion"
    - el.onclick = () => {
    - this.applySuggestion()
    - onApplySuggestionCallBack()
    - }
    - return el
    - }
    - getLine() {
    - return this.getNode().getLine()
    - }
    - getExtension() {
    - return this.getNode()
    - .getHandGrammarProgram()
    - .getExtensionName()
    - }
    - getNode() {
    - return this._node
    - }
    - getErrorTypeName() {
    - return this.constructor.name.replace("Error", "")
    - }
    - getCellIndex() {
    - return 0
    - }
    - toObject() {
    - return {
    - type: this.getErrorTypeName(),
    - line: this.getLineNumber(),
    - cell: this.getCellIndex(),
    - suggestion: this.getSuggestionMessage(),
    - path: this.getNode().getFirstWordPath(),
    - message: this.getMessage()
    - }
    - }
    - hasSuggestion() {
    - return this.getSuggestionMessage() !== ""
    - }
    - getSuggestionMessage() {
    - return ""
    - }
    - toString() {
    - return this.getMessage()
    - }
    - applySuggestion() {}
    - getMessage() {
    - return `${this.getErrorTypeName()} at line ${this.getLineNumber()} cell ${this.getCellIndex()}.`
    - }
    - }
    - class AbstractCellError extends AbstractTreeError {
    - constructor(cell) {
    - super(cell.getNode())
    - this._cell = cell
    - }
    - getCell() {
    - return this._cell
    - }
    - getCellIndex() {
    - return this._cell.getCellIndex()
    - }
    - _getWordSuggestion() {
    - return TreeUtils.didYouMean(
    - this.getCell().getWord(),
    - this.getCell()
    - .getAutoCompleteWords()
    - .map(option => option.text)
    - )
    - }
    - }
    - class UnknownNodeTypeError extends AbstractTreeError {
    - getMessage() {
    - const node = this.getNode()
    - const parentNode = node.getParent()
    - const options = parentNode._getParser().getFirstWordOptions()
    - return super.getMessage() + ` Invalid nodeType "${node.getFirstWord()}". Valid nodeTypes are: ${TreeUtils._listToEnglishText(options, 7)}.`
    - }
    - _getWordSuggestion() {
    - const node = this.getNode()
    - const parentNode = node.getParent()
    - return TreeUtils.didYouMean(node.getFirstWord(), parentNode.getAutocompleteResults("", 0).map(option => option.text))
    - }
    - getSuggestionMessage() {
    - const suggestion = this._getWordSuggestion()
    - const node = this.getNode()
    - if (suggestion) return `Change "${node.getFirstWord()}" to "${suggestion}"`
    - return ""
    - }
    - applySuggestion() {
    - const suggestion = this._getWordSuggestion()
    - if (suggestion) this.getNode().setWord(this.getCellIndex(), suggestion)
    - return this
    - }
    - }
    - class BlankLineError extends UnknownNodeTypeError {
    - getMessage() {
    - return super.getMessage() + ` Line: "${this.getNode().getLine()}". Blank lines are errors.`
    - }
    - // convenience method
    - isBlankLineError() {
    - return true
    - }
    - getSuggestionMessage() {
    - return `Delete line ${this.getLineNumber()}`
    - }
    - applySuggestion() {
    - this.getNode().destroy()
    - return this
    - }
    - }
    - class MissingRequiredNodeTypeError extends AbstractTreeError {
    - constructor(node, missingNodeTypeId) {
    - super(node)
    - this._missingNodeTypeId = missingNodeTypeId
    - }
    - getMessage() {
    - return super.getMessage() + ` A "${this._missingNodeTypeId}" is required.`
    - }
    - }
    - class NodeTypeUsedMultipleTimesError extends AbstractTreeError {
    - getMessage() {
    - return super.getMessage() + ` Multiple "${this.getNode().getFirstWord()}" found.`
    - }
    - getSuggestionMessage() {
    - return `Delete line ${this.getLineNumber()}`
    - }
    - applySuggestion() {
    - return this.getNode().destroy()
    - }
    - }
    - class UnknownCellTypeError extends AbstractCellError {
    - getMessage() {
    - return super.getMessage() + ` No cellType "${this.getCell().getCellTypeId()}" found. Language grammar for "${this.getExtension()}" may need to be fixed.`
    - }
    - }
    - class InvalidWordError extends AbstractCellError {
    - getMessage() {
    - return super.getMessage() + ` "${this.getCell().getWord()}" does not fit in cellType "${this.getCell().getCellTypeId()}".`
    - }
    - getSuggestionMessage() {
    - const suggestion = this._getWordSuggestion()
    - if (suggestion) return `Change "${this.getCell().getWord()}" to "${suggestion}"`
    - return ""
    - }
    - applySuggestion() {
    - const suggestion = this._getWordSuggestion()
    - if (suggestion) this.getNode().setWord(this.getCellIndex(), suggestion)
    - return this
    - }
    - }
    - class ExtraWordError extends AbstractCellError {
    - getMessage() {
    - return super.getMessage() + ` Extra word "${this.getCell().getWord()}" in ${this.getNodeTypeId()}.`
    - }
    - getSuggestionMessage() {
    - return `Delete word "${this.getCell().getWord()}" at cell ${this.getCellIndex()}`
    - }
    - applySuggestion() {
    - return this.getNode().deleteWordAt(this.getCellIndex())
    - }
    - }
    - class MissingWordError extends AbstractCellError {
    - // todo: autocomplete suggestion
    - getMessage() {
    - return super.getMessage() + ` Missing word for cell "${this.getCell().getCellTypeId()}".`
    - }
    - isMissingWordError() {
    - return true
    - }
    - }
    - // todo: add standard types, enum types, from disk types
    - class AbstractGrammarWordTestNode extends TreeNode {}
    - class GrammarRegexTestNode extends AbstractGrammarWordTestNode {
    - isValid(str) {
    - if (!this._regex) this._regex = new RegExp("^" + this.getContent() + "$")
    - return !!str.match(this._regex)
    - }
    - }
    - class GrammarReservedWordsTestNode extends AbstractGrammarWordTestNode {
    - isValid(str) {
    - if (!this._set) this._set = new Set(this.getContent().split(" "))
    - return !this._set.has(str)
    - }
    - }
    - // todo: remove in favor of custom word type constructors
    - class EnumFromCellTypesTestNode extends AbstractGrammarWordTestNode {
    - _getEnumFromCellTypes(programRootNode) {
    - const cellTypeIds = this.getWordsFrom(1)
    - const enumGroup = cellTypeIds.join(" ")
    - // note: hack where we store it on the program. otherwise has global effects.
    - if (!programRootNode._enumMaps) programRootNode._enumMaps = {}
    - if (programRootNode._enumMaps[enumGroup]) return programRootNode._enumMaps[enumGroup]
    - const wordIndex = 1
    - const map = {}
    - const cellTypeMap = {}
    - cellTypeIds.forEach(typeId => (cellTypeMap[typeId] = true))
    - programRootNode
    - .getAllTypedWords()
    - .filter(typedWord => cellTypeMap[typedWord.type])
    - .forEach(typedWord => {
    - map[typedWord.word] = true
    - })
    - programRootNode._enumMaps[enumGroup] = map
    - return map
    - }
    - // todo: remove
    - isValid(str, programRootNode) {
    - return this._getEnumFromCellTypes(programRootNode)[str] === true
    - }
    - }
    - class GrammarEnumTestNode extends AbstractGrammarWordTestNode {
    - isValid(str) {
    - // enum c c++ java
    - return !!this.getOptions()[str]
    - }
    - getOptions() {
    - if (!this._map) this._map = TreeUtils.arrayToMap(this.getWordsFrom(1))
    - return this._map
    - }
    - }
    - class cellTypeDefinitionNode extends AbstractExtendibleTreeNode {
    - createParser() {
    - const types = {}
    - types[GrammarConstants.regex] = GrammarRegexTestNode
    - types[GrammarConstants.reservedWords] = GrammarReservedWordsTestNode
    - types[GrammarConstants.enumFromCellTypes] = EnumFromCellTypesTestNode
    - types[GrammarConstants.enum] = GrammarEnumTestNode
    - types[GrammarConstants.highlightScope] = TreeNode
    - types[GrammarConstants.todoComment] = TreeNode
    - types[GrammarConstants.examples] = TreeNode
    - types[GrammarConstants.min] = TreeNode
    - types[GrammarConstants.max] = TreeNode
    - types[GrammarConstants.description] = TreeNode
    - types[GrammarConstants.extends] = TreeNode
    - return new TreeNode.Parser(undefined, types)
    - }
    - _getId() {
    - return this.getWord(0)
    - }
    - _getIdToNodeMap() {
    - return this.getParent().getCellTypeDefinitions()
    - }
    - getGetter(wordIndex) {
    - const wordToNativeJavascriptTypeParser = this.getCellConstructor().parserFunctionName
    - return `get ${this.getCellTypeId()}() {
    - return ${wordToNativeJavascriptTypeParser ? wordToNativeJavascriptTypeParser + `(this.getWord(${wordIndex}))` : `this.getWord(${wordIndex})`}
    - }`
    - }
    - getCatchAllGetter(wordIndex) {
    - const wordToNativeJavascriptTypeParser = this.getCellConstructor().parserFunctionName
    - return `get ${this.getCellTypeId()}() {
    - return ${wordToNativeJavascriptTypeParser ? `this.getWordsFrom(${wordIndex}).map(val => ${wordToNativeJavascriptTypeParser}(val))` : `this.getWordsFrom(${wordIndex})`}
    - }`
    - }
    - // `this.getWordsFrom(${requireds.length + 1})`
    - // todo: cleanup typings. todo: remove this hidden logic. have a "baseType" property?
    - getCellConstructor() {
    - return this._getPreludeKind() || GrammarAnyCell
    - }
    - _getPreludeKind() {
    - return PreludeKinds[this.getWord(0)] || PreludeKinds[this._getExtendedCellTypeId()]
    - }
    - _getPreludeKindId() {
    - if (PreludeKinds[this.getWord(0)]) return this.getWord(0)
    - else if (PreludeKinds[this._getExtendedCellTypeId()]) return this._getExtendedCellTypeId()
    - return PreludeCellTypeIds.anyCell
    - }
    - _getExtendedCellTypeId() {
    - const arr = this._getAncestorsArray()
    - return arr[arr.length - 1]._getId()
    - }
    - getHighlightScope() {
    - const hs = this._getFromExtended(GrammarConstants.highlightScope)
    - if (hs) return hs
    - const preludeKind = this._getPreludeKind()
    - if (preludeKind) return preludeKind.defaultHighlightScope
    - }
    - _getEnumOptions() {
    - const enumNode = this._getNodeFromExtended(GrammarConstants.enum)
    - if (!enumNode) return undefined
    - // we sort by longest first to capture longest match first. todo: add test
    - const options = Object.keys(enumNode.getNode(GrammarConstants.enum).getOptions())
    - options.sort((a, b) => b.length - a.length)
    - return options
    - }
    - _getEnumFromCellTypeOptions(program) {
    - const node = this._getNodeFromExtended(GrammarConstants.enumFromCellTypes)
    - return node ? Object.keys(node.getNode(GrammarConstants.enumFromCellTypes)._getEnumFromCellTypes(program)) : undefined
    - }
    - _getAutocompleteWordOptions(program) {
    - return this._getEnumOptions() || this._getEnumFromCellTypeOptions(program) || []
    - }
    - getRegexString() {
    - // todo: enum
    - const enumOptions = this._getEnumOptions()
    - return this._getFromExtended(GrammarConstants.regex) || (enumOptions ? "(?:" + enumOptions.join("|") + ")" : "[^ ]*")
    - }
    - isValid(str, programRootNode) {
    - return this._getChildrenByNodeConstructorInExtended(AbstractGrammarWordTestNode).every(node => node.isValid(str, programRootNode))
    - }
    - getCellTypeId() {
    - return this.getWord(0)
    - }
    - }
    - class AbstractCellParser {
    - constructor(definition) {
    - this._definition = definition
    - }
    - getCatchAllCellTypeId() {
    - return this._definition._getFromExtended(GrammarConstants.catchAllCellType)
    - }
    - // todo: improve layout (use bold?)
    - getLineHints() {
    - const catchAllCellTypeId = this.getCatchAllCellTypeId()
    - const nodeTypeId = this._definition.get(GrammarConstants.crux) || this._definition._getId() // todo: cleanup
    - return `${nodeTypeId}: ${this.getRequiredCellTypeIds().join(" ")}${catchAllCellTypeId ? ` ${catchAllCellTypeId}...` : ""}`
    - }
    - getRequiredCellTypeIds() {
    - const parameters = this._definition._getFromExtended(GrammarConstants.cells)
    - return parameters ? parameters.split(" ") : []
    - }
    - _getCellTypeId(cellIndex, requiredCellTypeIds, totalWordCount) {
    - return requiredCellTypeIds[cellIndex]
    - }
    - _isCatchAllCell(cellIndex, numberOfRequiredCells, totalWordCount) {
    - return cellIndex >= numberOfRequiredCells
    - }
    - getCellArray(node = undefined) {
    - const wordCount = node ? node.getWords().length : 0
    - const def = this._definition
    - const grammarProgram = def.getLanguageDefinitionProgram()
    - const requiredCellTypeIds = this.getRequiredCellTypeIds()
    - const numberOfRequiredCells = requiredCellTypeIds.length
    - const actualWordCountOrRequiredCellCount = Math.max(wordCount, numberOfRequiredCells)
    - const cells = []
    - // A for loop instead of map because "numberOfCellsToFill" can be longer than words.length
    - for (let cellIndex = 0; cellIndex < actualWordCountOrRequiredCellCount; cellIndex++) {
    - const isCatchAll = this._isCatchAllCell(cellIndex, numberOfRequiredCells, wordCount)
    - let cellTypeId = isCatchAll ? this.getCatchAllCellTypeId() : this._getCellTypeId(cellIndex, requiredCellTypeIds, wordCount)
    - let cellTypeDefinition = grammarProgram.getCellTypeDefinitionById(cellTypeId)
    - let cellConstructor
    - if (cellTypeDefinition) cellConstructor = cellTypeDefinition.getCellConstructor()
    - else if (cellTypeId) cellConstructor = GrammarUnknownCellTypeCell
    - else {
    - cellConstructor = GrammarExtraWordCellTypeCell
    - cellTypeId = PreludeCellTypeIds.extraWordCell
    - cellTypeDefinition = grammarProgram.getCellTypeDefinitionById(cellTypeId)
    - }
    - cells[cellIndex] = new cellConstructor(node, cellIndex, cellTypeDefinition, cellTypeId, isCatchAll, def)
    - }
    - return cells
    - }
    - }
    - class PrefixCellParser extends AbstractCellParser {}
    - class PostfixCellParser extends AbstractCellParser {
    - _isCatchAllCell(cellIndex, numberOfRequiredCells, totalWordCount) {
    - return cellIndex < totalWordCount - numberOfRequiredCells
    - }
    - _getCellTypeId(cellIndex, requiredCellTypeIds, totalWordCount) {
    - const catchAllWordCount = Math.max(totalWordCount - requiredCellTypeIds.length, 0)
    - return requiredCellTypeIds[cellIndex - catchAllWordCount]
    - }
    - }
    - class OmnifixCellParser extends AbstractCellParser {
    - getCellArray(node = undefined) {
    - const cells = []
    - const def = this._definition
    - const program = node ? node.getRootNode() : undefined
    - const grammarProgram = def.getLanguageDefinitionProgram()
    - const words = node ? node.getWords() : []
    - const requiredCellTypeDefs = this.getRequiredCellTypeIds().map(cellTypeId => grammarProgram.getCellTypeDefinitionById(cellTypeId))
    - const catchAllCellTypeId = this.getCatchAllCellTypeId()
    - const catchAllCellTypeDef = catchAllCellTypeId && grammarProgram.getCellTypeDefinitionById(catchAllCellTypeId)
    - words.forEach((word, wordIndex) => {
    - let cellConstructor
    - for (let index = 0; index < requiredCellTypeDefs.length; index++) {
    - const cellTypeDefinition = requiredCellTypeDefs[index]
    - if (cellTypeDefinition.isValid(word, program)) {
    - // todo: cleanup cellIndex/wordIndex stuff
    - cellConstructor = cellTypeDefinition.getCellConstructor()
    - cells.push(new cellConstructor(node, wordIndex, cellTypeDefinition, cellTypeDefinition._getId(), false, def))
    - requiredCellTypeDefs.splice(index, 1)
    - return true
    - }
    - }
    - if (catchAllCellTypeDef && catchAllCellTypeDef.isValid(word, program)) {
    - cellConstructor = catchAllCellTypeDef.getCellConstructor()
    - cells.push(new cellConstructor(node, wordIndex, catchAllCellTypeDef, catchAllCellTypeId, true, def))
    - return true
    - }
    - cells.push(new GrammarUnknownCellTypeCell(node, wordIndex, undefined, undefined, false, def))
    - })
    - const wordCount = words.length
    - requiredCellTypeDefs.forEach((cellTypeDef, index) => {
    - let cellConstructor = cellTypeDef.getCellConstructor()
    - cells.push(new cellConstructor(node, wordCount + index, cellTypeDef, cellTypeDef._getId(), false, def))
    - })
    - return cells
    - }
    - }
    - class GrammarExampleNode extends TreeNode {}
    - class GrammarCompilerNode extends TreeNode {
    - createParser() {
    - const types = [
    - GrammarConstantsCompiler.stringTemplate,
    - GrammarConstantsCompiler.indentCharacter,
    - GrammarConstantsCompiler.catchAllCellDelimiter,
    - GrammarConstantsCompiler.joinChildrenWith,
    - GrammarConstantsCompiler.openChildren,
    - GrammarConstantsCompiler.closeChildren
    - ]
    - const map = {}
    - types.forEach(type => {
    - map[type] = TreeNode
    - })
    - return new TreeNode.Parser(undefined, map)
    - }
    - }
    - class GrammarNodeTypeConstant extends TreeNode {
    - getGetter() {
    - return `get ${this.getIdentifier()}() { return ${this.getConstantValueAsJsText()} }`
    - }
    - getIdentifier() {
    - return this.getWord(1)
    - }
    - getConstantValueAsJsText() {
    - const words = this.getWordsFrom(2)
    - return words.length > 1 ? `[${words.join(",")}]` : words[0]
    - }
    - getConstantValue() {
    - return JSON.parse(this.getConstantValueAsJsText())
    - }
    - }
    - class GrammarNodeTypeConstantInt extends GrammarNodeTypeConstant {}
    - class GrammarNodeTypeConstantString extends GrammarNodeTypeConstant {
    - getConstantValueAsJsText() {
    - return "`" + TreeUtils.escapeBackTicks(this.getConstantValue()) + "`"
    - }
    - getConstantValue() {
    - return this.length ? this.childrenToString() : this.getWordsFrom(2).join(" ")
    - }
    - }
    - class GrammarNodeTypeConstantFloat extends GrammarNodeTypeConstant {}
    - class GrammarNodeTypeConstantBoolean extends GrammarNodeTypeConstant {}
    - class AbstractGrammarDefinitionNode extends AbstractExtendibleTreeNode {
    - createParser() {
    - // todo: some of these should just be on nonRootNodes
    - const types = [
    - GrammarConstants.frequency,
    - GrammarConstants.inScope,
    - GrammarConstants.cells,
    - GrammarConstants.extends,
    - GrammarConstants.description,
    - GrammarConstants.catchAllNodeType,
    - GrammarConstants.catchAllCellType,
    - GrammarConstants.cellParser,
    - GrammarConstants.extensions,
    - GrammarConstants.version,
    - GrammarConstants.tags,
    - GrammarConstants.crux,
    - GrammarConstants.pattern,
    - GrammarConstants.baseNodeType,
    - GrammarConstants.required,
    - GrammarConstants.root,
    - GrammarConstants._extendsJsClass,
    - GrammarConstants._rootNodeJsHeader,
    - GrammarConstants.javascript,
    - GrammarConstants.compilesTo,
    - GrammarConstants.abstract,
    - GrammarConstants.javascript,
    - GrammarConstants.single,
    - GrammarConstants.todoComment
    - ]
    - const map = {}
    - types.forEach(type => {
    - map[type] = TreeNode
    - })
    - map[GrammarConstantsConstantTypes.boolean] = GrammarNodeTypeConstantBoolean
    - map[GrammarConstantsConstantTypes.int] = GrammarNodeTypeConstantInt
    - map[GrammarConstantsConstantTypes.string] = GrammarNodeTypeConstantString
    - map[GrammarConstantsConstantTypes.float] = GrammarNodeTypeConstantFloat
    - map[GrammarConstants.compilerNodeType] = GrammarCompilerNode
    - map[GrammarConstants.example] = GrammarExampleNode
    - return new TreeNode.Parser(undefined, map)
    - }
    - getTableNameIfAny() {
    - return this.getFrom(`${GrammarConstantsConstantTypes.string} ${GrammarConstantsMisc.tableName}`)
    - }
    - getSqlLiteTableColumns() {
    - return this._getConcreteNonErrorInScopeNodeDefinitions(this._getInScopeNodeTypeIds()).map(node => {
    - const firstNonKeywordCellType = node.getCellParser().getCellArray()[1]
    - const type = firstNonKeywordCellType ? firstNonKeywordCellType.getSqlLiteType() : SqlLiteTypes.text
    - return {
    - columnName: node._getIdWithoutSuffix(),
    - type
    - }
    - })
    - }
    - toSqlLiteTableSchema() {
    - const columns = this.getSqlLiteTableColumns().map(columnDef => `${columnDef.columnName} ${columnDef.type}`)
    - return `create table ${this.getTableNameIfAny() || this._getId()} (
    - id TEXT NOT NULL PRIMARY KEY,
    - ${columns.join(",\n ")}
    - );`
    - }
    - _getId() {
    - return this.getWord(0)
    - }
    - _getIdWithoutSuffix() {
    - return this._getId().replace(HandGrammarProgram.nodeTypeSuffixRegex, "")
    - }
    - getConstantsObject() {
    - const obj = this._getUniqueConstantNodes()
    - Object.keys(obj).forEach(key => {
    - obj[key] = obj[key].getConstantValue()
    - })
    - return obj
    - }
    - _getUniqueConstantNodes(extended = true) {
    - const obj = {}
    - const items = extended ? this._getChildrenByNodeConstructorInExtended(GrammarNodeTypeConstant) : this.getChildrenByNodeConstructor(GrammarNodeTypeConstant)
    - items.reverse() // Last definition wins.
    - items.forEach(node => {
    - obj[node.getIdentifier()] = node
    - })
    - return obj
    - }
    - getExamples() {
    - return this._getChildrenByNodeConstructorInExtended(GrammarExampleNode)
    - }
    - getNodeTypeIdFromDefinition() {
    - return this.getWord(0)
    - }
    - // todo: remove? just reused nodeTypeId
    - _getGeneratedClassName() {
    - return this.getNodeTypeIdFromDefinition()
    - }
    - _hasValidNodeTypeId() {
    - return !!this._getGeneratedClassName()
    - }
    - _isAbstract() {
    - return this.has(GrammarConstants.abstract)
    - }
    - _getConcreteDescendantDefinitions() {
    - const defs = this._getProgramNodeTypeDefinitionCache()
    - const id = this._getId()
    - return Object.values(defs).filter(def => {
    - return def._doesExtend(id) && !def._isAbstract()
    - })
    - }
    - _getCruxIfAny() {
    - return this.get(GrammarConstants.crux)
    - }
    - _getRegexMatch() {
    - return this.get(GrammarConstants.pattern)
    - }
    - _getFirstCellEnumOptions() {
    - const firstCellDef = this._getMyCellTypeDefs()[0]
    - return firstCellDef ? firstCellDef._getEnumOptions() : undefined
    - }
    - getLanguageDefinitionProgram() {
    - return this.getParent()
    - }
    - _getCustomJavascriptMethods() {
    - const hasJsCode = this.has(GrammarConstants.javascript)
    - return hasJsCode ? this.getNode(GrammarConstants.javascript).childrenToString() : ""
    - }
    - getFirstWordMapWithDefinitions() {
    - if (!this._cache_firstWordToNodeDefMap) this._cache_firstWordToNodeDefMap = this._createParserInfo(this._getInScopeNodeTypeIds()).firstWordMap
    - return this._cache_firstWordToNodeDefMap
    - }
    - // todo: remove
    - getRunTimeFirstWordsInScope() {
    - return this._getParser().getFirstWordOptions()
    - }
    - _getMyCellTypeDefs() {
    - const requiredCells = this.get(GrammarConstants.cells)
    - if (!requiredCells) return []
    - const grammarProgram = this.getLanguageDefinitionProgram()
    - return requiredCells.split(" ").map(cellTypeId => {
    - const cellTypeDef = grammarProgram.getCellTypeDefinitionById(cellTypeId)
    - if (!cellTypeDef) throw new Error(`No cellType "${cellTypeId}" found`)
    - return cellTypeDef
    - })
    - }
    - // todo: what happens when you have a cell getter and constant with same name?
    - _getCellGettersAndNodeTypeConstants() {
    - // todo: add cellType parsings
    - const grammarProgram = this.getLanguageDefinitionProgram()
    - const getters = this._getMyCellTypeDefs().map((cellTypeDef, index) => cellTypeDef.getGetter(index))
    - const catchAllCellTypeId = this.get(GrammarConstants.catchAllCellType)
    - if (catchAllCellTypeId) getters.push(grammarProgram.getCellTypeDefinitionById(catchAllCellTypeId).getCatchAllGetter(getters.length))
    - // Constants
    - Object.values(this._getUniqueConstantNodes(false)).forEach(node => {
    - getters.push(node.getGetter())
    - })
    - return getters.join("\n")
    - }
    - _createParserInfo(nodeTypeIdsInScope) {
    - const result = {
    - firstWordMap: {},
    - regexTests: []
    - }
    - if (!nodeTypeIdsInScope.length) return result
    - const allProgramNodeTypeDefinitionsMap = this._getProgramNodeTypeDefinitionCache()
    - Object.keys(allProgramNodeTypeDefinitionsMap)
    - .filter(nodeTypeId => allProgramNodeTypeDefinitionsMap[nodeTypeId].isOrExtendsANodeTypeInScope(nodeTypeIdsInScope))
    - .filter(nodeTypeId => !allProgramNodeTypeDefinitionsMap[nodeTypeId]._isAbstract())
    - .forEach(nodeTypeId => {
    - const def = allProgramNodeTypeDefinitionsMap[nodeTypeId]
    - const regex = def._getRegexMatch()
    - const crux = def._getCruxIfAny()
    - const enumOptions = def._getFirstCellEnumOptions()
    - if (regex) result.regexTests.push({ regex: regex, nodeConstructor: def.getNodeTypeIdFromDefinition() })
    - else if (crux) result.firstWordMap[crux] = def
    - else if (enumOptions) {
    - enumOptions.forEach(option => {
    - result.firstWordMap[option] = def
    - })
    - }
    - })
    - return result
    - }
    - getTopNodeTypeDefinitions() {
    - const arr = Object.values(this.getFirstWordMapWithDefinitions())
    - arr.sort(TreeUtils.makeSortByFn(definition => definition.getFrequency()))
    - arr.reverse()
    - return arr
    - }
    - _getMyInScopeNodeTypeIds() {
    - const nodeTypesNode = this.getNode(GrammarConstants.inScope)
    - return nodeTypesNode ? nodeTypesNode.getWordsFrom(1) : []
    - }
    - _getInScopeNodeTypeIds() {
    - // todo: allow multiple of these if we allow mixins?
    - const ids = this._getMyInScopeNodeTypeIds()
    - const parentDef = this._getExtendedParent()
    - return parentDef ? ids.concat(parentDef._getInScopeNodeTypeIds()) : ids
    - }
    - isRequired() {
    - return this._hasFromExtended(GrammarConstants.required)
    - }
    - getNodeTypeDefinitionByNodeTypeId(nodeTypeId) {
    - // todo: return catch all?
    - const def = this._getProgramNodeTypeDefinitionCache()[nodeTypeId]
    - if (def) return def
    - // todo: cleanup
    - this.getLanguageDefinitionProgram()._addDefaultCatchAllBlobNode()
    - return this._getProgramNodeTypeDefinitionCache()[nodeTypeId]
    - }
    - isDefined(nodeTypeId) {
    - return !!this._getProgramNodeTypeDefinitionCache()[nodeTypeId]
    - }
    - _getIdToNodeMap() {
    - return this._getProgramNodeTypeDefinitionCache()
    - }
    - _amIRoot() {
    - if (this._cache_isRoot === undefined) this._cache_isRoot = this._getLanguageRootNode() === this
    - return this._cache_isRoot
    - }
    - _getLanguageRootNode() {
    - return this.getParent().getRootNodeTypeDefinitionNode()
    - }
    - _isErrorNodeType() {
    - return this.get(GrammarConstants.baseNodeType) === GrammarConstants.errorNode
    - }
    - _isBlobNodeType() {
    - // Do not check extended classes. Only do once.
    - return this.get(GrammarConstants.baseNodeType) === GrammarConstants.blobNode
    - }
    - _getErrorMethodToJavascript() {
    - if (this._isBlobNodeType()) return "getErrors() { return [] }" // Skips parsing child nodes for perf gains.
    - if (this._isErrorNodeType()) return "getErrors() { return this._getErrorNodeErrors() }"
    - return ""
    - }
    - _getParserToJavascript() {
    - if (this._isBlobNodeType())
    - // todo: do we need this?
    - return "createParser() { return new jtree.TreeNode.Parser(this._getBlobNodeCatchAllNodeType())}"
    - const parserInfo = this._createParserInfo(this._getMyInScopeNodeTypeIds())
    - const myFirstWordMap = parserInfo.firstWordMap
    - const regexRules = parserInfo.regexTests
    - // todo: use constants in first word maps?
    - // todo: cache the super extending?
    - const firstWords = Object.keys(myFirstWordMap)
    - const hasFirstWords = firstWords.length
    - const catchAllConstructor = this._getCatchAllNodeConstructorToJavascript()
    - if (!hasFirstWords && !catchAllConstructor && !regexRules.length) return ""
    - const firstWordsStr = hasFirstWords
    - ? `Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {` + firstWords.map(firstWord => `"${firstWord}" : ${myFirstWordMap[firstWord].getNodeTypeIdFromDefinition()}`).join(",\n") + "})"
    - : "undefined"
    - const regexStr = regexRules.length
    - ? `[${regexRules
    - .map(rule => {
    - return `{regex: /${rule.regex}/, nodeConstructor: ${rule.nodeConstructor}}`
    - })
    - .join(",")}]`
    - : "undefined"
    - const catchAllStr = catchAllConstructor ? catchAllConstructor : this._amIRoot() ? `this._getBlobNodeCatchAllNodeType()` : "undefined"
    - return `createParser() {
    - return new jtree.TreeNode.Parser(${catchAllStr}, ${firstWordsStr}, ${regexStr})
    - }`
    - }
    - _getCatchAllNodeConstructorToJavascript() {
    - if (this._isBlobNodeType()) return "this._getBlobNodeCatchAllNodeType()"
    - const nodeTypeId = this.get(GrammarConstants.catchAllNodeType)
    - if (!nodeTypeId) return ""
    - const nodeDef = this.getNodeTypeDefinitionByNodeTypeId(nodeTypeId)
    - if (!nodeDef) throw new Error(`No definition found for nodeType id "${nodeTypeId}"`)
    - return nodeDef._getGeneratedClassName()
    - }
    - _nodeDefToJavascriptClass() {
    - const components = [this._getParserToJavascript(), this._getErrorMethodToJavascript(), this._getCellGettersAndNodeTypeConstants(), this._getCustomJavascriptMethods()].filter(identity => identity)
    - if (this._amIRoot()) {
    - components.push(`getHandGrammarProgram() {
    - if (!this._cachedHandGrammarProgramRoot)
    - this._cachedHandGrammarProgramRoot = new jtree.HandGrammarProgram(\`${TreeUtils.escapeBackTicks(
    - this.getParent()
    - .toString()
    - .replace(/\\/g, "\\\\")
    - )}\`)
    - return this._cachedHandGrammarProgramRoot
    - }`)
    - const nodeTypeMap = this.getLanguageDefinitionProgram()
    - .getValidConcreteAndAbstractNodeTypeDefinitions()
    - .map(def => {
    - const id = def.getNodeTypeIdFromDefinition()
    - return `"${id}": ${id}`
    - })
    - .join(",\n")
    - components.push(`static getNodeTypeMap() { return {${nodeTypeMap} }}`)
    - }
    - return `class ${this._getGeneratedClassName()} extends ${this._getExtendsClassName()} {
    - ${components.join("\n")}
    - }`
    - }
    - _getExtendsClassName() {
    - // todo: this is hopefully a temporary line in place for now for the case where you want your base class to extend something other than another treeclass
    - const hardCodedExtend = this.get(GrammarConstants._extendsJsClass)
    - if (hardCodedExtend) return hardCodedExtend
    - const extendedDef = this._getExtendedParent()
    - return extendedDef ? extendedDef._getGeneratedClassName() : "jtree.GrammarBackedNode"
    - }
    - _getCompilerObject() {
    - let obj = {}
    - const items = this._getChildrenByNodeConstructorInExtended(GrammarCompilerNode)
    - items.reverse() // Last definition wins.
    - items.forEach(node => {
    - obj = Object.assign(obj, node.toObject()) // todo: what about multiline strings?
    - })
    - return obj
    - }
    - // todo: improve layout (use bold?)
    - getLineHints() {
    - return this.getCellParser().getLineHints()
    - }
    - isOrExtendsANodeTypeInScope(firstWordsInScope) {
    - const chain = this._getNodeTypeInheritanceSet()
    - return firstWordsInScope.some(firstWord => chain.has(firstWord))
    - }
    - isTerminalNodeType() {
    - return !this._getFromExtended(GrammarConstants.inScope) && !this._getFromExtended(GrammarConstants.catchAllNodeType)
    - }
    - _getSublimeMatchLine() {
    - const regexMatch = this._getRegexMatch()
    - if (regexMatch) return `'${regexMatch}'`
    - const cruxMatch = this._getCruxIfAny()
    - if (cruxMatch) return `'^ *${TreeUtils.escapeRegExp(cruxMatch)}(?: |$)'`
    - const enumOptions = this._getFirstCellEnumOptions()
    - if (enumOptions) return `'^ *(${TreeUtils.escapeRegExp(enumOptions.join("|"))})(?: |$)'`
    - }
    - // todo: refactor. move some parts to cellParser?
    - _toSublimeMatchBlock() {
    - const defaultHighlightScope = "source"
    - const program = this.getLanguageDefinitionProgram()
    - const cellParser = this.getCellParser()
    - const requiredCellTypeIds = cellParser.getRequiredCellTypeIds()
    - const catchAllCellTypeId = cellParser.getCatchAllCellTypeId()
    - const firstCellTypeDef = program.getCellTypeDefinitionById(requiredCellTypeIds[0])
    - const firstWordHighlightScope = (firstCellTypeDef ? firstCellTypeDef.getHighlightScope() : defaultHighlightScope) + "." + this.getNodeTypeIdFromDefinition()
    - const topHalf = ` '${this.getNodeTypeIdFromDefinition()}':
    - - match: ${this._getSublimeMatchLine()}
    - scope: ${firstWordHighlightScope}`
    - if (catchAllCellTypeId) requiredCellTypeIds.push(catchAllCellTypeId)
    - if (!requiredCellTypeIds.length) return topHalf
    - const captures = requiredCellTypeIds
    - .map((cellTypeId, index) => {
    - const cellTypeDefinition = program.getCellTypeDefinitionById(cellTypeId) // todo: cleanup
    - if (!cellTypeDefinition) throw new Error(`No ${GrammarConstants.cellType} ${cellTypeId} found`) // todo: standardize error/capture error at grammar time
    - return ` ${index + 1}: ${(cellTypeDefinition.getHighlightScope() || defaultHighlightScope) + "." + cellTypeDefinition.getCellTypeId()}`
    - })
    - .join("\n")
    - const cellTypesToRegex = cellTypeIds => cellTypeIds.map(cellTypeId => `({{${cellTypeId}}})?`).join(" ?")
    - return `${topHalf}
    - push:
    - - match: ${cellTypesToRegex(requiredCellTypeIds)}
    - captures:
    - ${captures}
    - - match: $
    - pop: true`
    - }
    - _getNodeTypeInheritanceSet() {
    - if (!this._cache_nodeTypeInheritanceSet) this._cache_nodeTypeInheritanceSet = new Set(this.getAncestorNodeTypeIdsArray())
    - return this._cache_nodeTypeInheritanceSet
    - }
    - getAncestorNodeTypeIdsArray() {
    - if (!this._cache_ancestorNodeTypeIdsArray) {
    - this._cache_ancestorNodeTypeIdsArray = this._getAncestorsArray().map(def => def.getNodeTypeIdFromDefinition())
    - this._cache_ancestorNodeTypeIdsArray.reverse()
    - }
    - return this._cache_ancestorNodeTypeIdsArray
    - }
    - _getProgramNodeTypeDefinitionCache() {
    - return this.getLanguageDefinitionProgram()._getProgramNodeTypeDefinitionCache()
    - }
    - getDescription() {
    - return this._getFromExtended(GrammarConstants.description) || ""
    - }
    - getFrequency() {
    - const val = this._getFromExtended(GrammarConstants.frequency)
    - return val ? parseFloat(val) : 0
    - }
    - _getExtendedNodeTypeId() {
    - const ancestorIds = this.getAncestorNodeTypeIdsArray()
    - if (ancestorIds.length > 1) return ancestorIds[ancestorIds.length - 2]
    - }
    - _toStumpString() {
    - const crux = this._getCruxIfAny()
    - const cellArray = this.getCellParser()
    - .getCellArray()
    - .filter((item, index) => index) // for now this only works for keyword langs
    - if (!cellArray.length)
    - // todo: remove this! just doing it for now until we refactor getCellArray to handle catchAlls better.
    - return ""
    - const cells = new TreeNode(cellArray.map((cell, index) => cell._toStumpInput(crux)).join("\n"))
    - return `div
    - label ${crux}
    - ${cells.toString(1)}`
    - }
    - toStumpString() {
    - const nodeBreakSymbol = "\n"
    - return this._getConcreteNonErrorInScopeNodeDefinitions(this._getInScopeNodeTypeIds())
    - .map(def => def._toStumpString())
    - .filter(identity => identity)
    - .join(nodeBreakSymbol)
    - }
    - _generateSimulatedLine(seed) {
    - // todo: generate simulated data from catch all
    - const crux = this._getCruxIfAny()
    - return this.getCellParser()
    - .getCellArray()
    - .map((cell, index) => (!index && crux ? crux : cell.synthesizeCell(seed)))
    - .join(" ")
    - }
    - _shouldSynthesize(def, nodeTypeChain) {
    - if (def._isErrorNodeType() || def._isAbstract()) return false
    - if (nodeTypeChain.includes(def._getId())) return false
    - const tags = def.get(GrammarConstants.tags)
    - if (tags && tags.includes(GrammarConstantsMisc.doNotSynthesize)) return false
    - return true
    - }
    - _getConcreteNonErrorInScopeNodeDefinitions(nodeTypeIds) {
    - const results = []
    - nodeTypeIds.forEach(nodeTypeId => {
    - const def = this.getNodeTypeDefinitionByNodeTypeId(nodeTypeId)
    - if (def._isErrorNodeType()) return true
    - else if (def._isAbstract()) {
    - def._getConcreteDescendantDefinitions().forEach(def => results.push(def))
    - } else {
    - results.push(def)
    - }
    - })
    - return results
    - }
    - // todo: refactor
    - synthesizeNode(nodeCount = 1, indentCount = -1, nodeTypesAlreadySynthesized = [], seed = Date.now()) {
    - let inScopeNodeTypeIds = this._getInScopeNodeTypeIds()
    - const catchAllNodeTypeId = this._getFromExtended(GrammarConstants.catchAllNodeType)
    - if (catchAllNodeTypeId) inScopeNodeTypeIds.push(catchAllNodeTypeId)
    - const thisId = this._getId()
    - if (!nodeTypesAlreadySynthesized.includes(thisId)) nodeTypesAlreadySynthesized.push(thisId)
    - const lines = []
    - while (nodeCount) {
    - const line = this._generateSimulatedLine(seed)
    - if (line) lines.push(" ".repeat(indentCount >= 0 ? indentCount : 0) + line)
    - this._getConcreteNonErrorInScopeNodeDefinitions(inScopeNodeTypeIds.filter(nodeTypeId => !nodeTypesAlreadySynthesized.includes(nodeTypeId)))
    - .filter(def => this._shouldSynthesize(def, nodeTypesAlreadySynthesized))
    - .forEach(def => {
    - const chain = nodeTypesAlreadySynthesized // .slice(0)
    - chain.push(def._getId())
    - def.synthesizeNode(1, indentCount + 1, chain, seed).forEach(line => {
    - lines.push(line)
    - })
    - })
    - nodeCount--
    - }
    - return lines
    - }
    - getCellParser() {
    - if (!this._cellParser) {
    - const cellParsingStrategy = this._getFromExtended(GrammarConstants.cellParser)
    - if (cellParsingStrategy === GrammarCellParser.postfix) this._cellParser = new PostfixCellParser(this)
    - else if (cellParsingStrategy === GrammarCellParser.omnifix) this._cellParser = new OmnifixCellParser(this)
    - else this._cellParser = new PrefixCellParser(this)
    - }
    - return this._cellParser
    - }
    - }
    - // todo: remove?
    - class nodeTypeDefinitionNode extends AbstractGrammarDefinitionNode {}
    - // HandGrammarProgram is a constructor that takes a grammar file, and builds a new
    - // constructor for new language that takes files in that language to execute, compile, etc.
    - class HandGrammarProgram extends AbstractGrammarDefinitionNode {
    - createParser() {
    - const map = {}
    - map[GrammarConstants.toolingDirective] = TreeNode
    - map[GrammarConstants.todoComment] = TreeNode
    - return new TreeNode.Parser(UnknownNodeTypeNode, map, [{ regex: HandGrammarProgram.nodeTypeFullRegex, nodeConstructor: nodeTypeDefinitionNode }, { regex: HandGrammarProgram.cellTypeFullRegex, nodeConstructor: cellTypeDefinitionNode }])
    - }
    - _compileAndEvalGrammar() {
    - if (!this.isNodeJs()) this._cache_compiledLoadedNodeTypes = TreeUtils.appendCodeAndReturnValueOnWindow(this.toBrowserJavascript(), this.getRootNodeTypeId()).getNodeTypeMap()
    - else {
    - const code = this.toNodeJsJavascript(__dirname + "/../index.js")
    - try {
    - const rootNode = this._requireInVmNodeJsRootNodeTypeConstructor(code)
    - this._cache_compiledLoadedNodeTypes = rootNode.getNodeTypeMap()
    - if (!this._cache_compiledLoadedNodeTypes) throw new Error(`Failed to getNodeTypeMap`)
    - } catch (err) {
    - // todo: figure out best error pattern here for debugging
    - console.log(err)
    - // console.log(`Error in code: `)
    - // console.log(new TreeNode(code).toStringWithLineNumbers())
    - }
    - }
    - }
    - trainModel(programs, programConstructor = this.compileAndReturnRootConstructor()) {
    - const nodeDefs = this.getValidConcreteAndAbstractNodeTypeDefinitions()
    - const nodeDefCountIncludingRoot = nodeDefs.length + 1
    - const matrix = TreeUtils.makeMatrix(nodeDefCountIncludingRoot, nodeDefCountIncludingRoot, 0)
    - const idToIndex = {}
    - const indexToId = {}
    - nodeDefs.forEach((def, index) => {
    - const id = def._getId()
    - idToIndex[id] = index + 1
    - indexToId[index + 1] = id
    - })
    - programs.forEach(code => {
    - const exampleProgram = new programConstructor(code)
    - exampleProgram.getTopDownArray().forEach(node => {
    - const nodeIndex = idToIndex[node.getDefinition()._getId()]
    - const parentNode = node.getParent()
    - if (!nodeIndex) return undefined
    - if (parentNode.isRoot()) matrix[0][nodeIndex]++
    - else {
    - const parentIndex = idToIndex[parentNode.getDefinition()._getId()]
    - if (!parentIndex) return undefined
    - matrix[parentIndex][nodeIndex]++
    - }
    - })
    - })
    - return {
    - idToIndex,
    - indexToId,
    - matrix
    - }
    - }
    - _mapPredictions(predictionsVector, model) {
    - const total = TreeUtils.sum(predictionsVector)
    - const predictions = predictionsVector.slice(1).map((count, index) => {
    - const id = model.indexToId[index + 1]
    - return {
    - id: id,
    - def: this.getNodeTypeDefinitionByNodeTypeId(id),
    - count,
    - prob: count / total
    - }
    - })
    - predictions.sort(TreeUtils.makeSortByFn(prediction => prediction.count)).reverse()
    - return predictions
    - }
    - predictChildren(model, node) {
    - return this._mapPredictions(this._predictChildren(model, node), model)
    - }
    - predictParents(model, node) {
    - return this._mapPredictions(this._predictParents(model, node), model)
    - }
    - _predictChildren(model, node) {
    - return model.matrix[node.isRoot() ? 0 : model.idToIndex[node.getDefinition()._getId()]]
    - }
    - _predictParents(model, node) {
    - if (node.isRoot()) return []
    - const nodeIndex = model.idToIndex[node.getDefinition()._getId()]
    - return model.matrix.map(row => row[nodeIndex])
    - }
    - _compileAndReturnNodeTypeMap() {
    - if (!this._cache_compiledLoadedNodeTypes) this._compileAndEvalGrammar()
    - return this._cache_compiledLoadedNodeTypes
    - }
    - _setDirName(name) {
    - this._dirName = name
    - return this
    - }
    - _requireInVmNodeJsRootNodeTypeConstructor(code) {
    - const vm = require("vm")
    - // todo: cleanup up
    - try {
    - global.jtree = require(__dirname + "/../index.js")
    - global.require = require
    - global.__dirname = this._dirName
    - global.module = {}
    - return vm.runInThisContext(code)
    - } catch (err) {
    - // todo: figure out best error pattern here for debugging
    - console.log(`Error in compiled grammar code for language "${this.getGrammarName()}"`)
    - // console.log(new TreeNode(code).toStringWithLineNumbers())
    - console.log(err)
    - throw err
    - }
    - }
    - examplesToTestBlocks(programConstructor = this.compileAndReturnRootConstructor(), expectedErrorMessage = "") {
    - const testBlocks = {}
    - this.getValidConcreteAndAbstractNodeTypeDefinitions().forEach(def =>
    - def.getExamples().forEach(example => {
    - const id = def._getId() + example.getContent()
    - testBlocks[id] = equal => {
    - const exampleProgram = new programConstructor(example.childrenToString())
    - const errors = exampleProgram.getAllErrors(example._getLineNumber() + 1)
    - equal(errors.join("\n"), expectedErrorMessage, `Expected no errors in ${id}`)
    - }
    - })
    - )
    - return testBlocks
    - }
    - toReadMe() {
    - const languageName = this.getExtensionName()
    - const rootNodeDef = this.getRootNodeTypeDefinitionNode()
    - const cellTypes = this.getCellTypeDefinitions()
    - const nodeTypeFamilyTree = this.getNodeTypeFamilyTree()
    - const exampleNode = rootNodeDef.getExamples()[0]
    - return `title ${languageName} Readme
    -
    - paragraph ${rootNodeDef.getDescription()}
    -
    - subtitle Quick Example
    -
    - code
    - ${exampleNode ? exampleNode.childrenToString(1) : ""}
    -
    - subtitle Quick facts about ${languageName}
    -
    - list
    - - ${languageName} has ${nodeTypeFamilyTree.getTopDownArray().length} node types.
    - - ${languageName} has ${Object.keys(cellTypes).length} cell types
    - - The source code for ${languageName} is ${this.getTopDownArray().length} lines long.
    -
    - subtitle Installing
    -
    - code
    - npm install .
    -
    - subtitle Testing
    -
    - code
    - node test.js
    -
    - subtitle Node Types
    -
    - code
    - ${nodeTypeFamilyTree.toString(1)}
    -
    - subtitle Cell Types
    -
    - code
    - ${new TreeNode(Object.keys(cellTypes).join("\n")).toString(1)}
    -
    - subtitle Road Map
    -
    - paragraph Here are the "todos" present in the source code for ${languageName}:
    -
    - list
    - ${this.getTopDownArray()
    - .filter(node => node.getWord(0) === "todo")
    - .map(node => ` - ${node.getLine()}`)
    - .join("\n")}
    -
    - paragraph This readme was auto-generated using the
    - link https://github.com/treenotation/jtree JTree library.`
    - }
    - toBundle() {
    - const files = {}
    - const rootNodeDef = this.getRootNodeTypeDefinitionNode()
    - const languageName = this.getExtensionName()
    - const example = rootNodeDef.getExamples()[0]
    - const sampleCode = example ? example.childrenToString() : ""
    - files[GrammarBundleFiles.package] = JSON.stringify(
    - {
    - name: languageName,
    - private: true,
    - dependencies: {
    - jtree: TreeNode.getVersion()
    - }
    - },
    - null,
    - 2
    - )
    - files[GrammarBundleFiles.readme] = this.toReadMe()
    - const testCode = `const program = new ${languageName}(sampleCode)
    - const errors = program.getAllErrors()
    - console.log("Sample program compiled with " + errors.length + " errors.")
    - if (errors.length)
    - console.log(errors.map(error => error.getMessage()))`
    - const nodePath = `${languageName}.node.js`
    - files[nodePath] = this.toNodeJsJavascript()
    - files[GrammarBundleFiles.indexJs] = `module.exports = require("./${nodePath}")`
    - const browserPath = `${languageName}.browser.js`
    - files[browserPath] = this.toBrowserJavascript()
    - files[GrammarBundleFiles.indexHtml] = `
    -
    - `
    - const samplePath = "sample." + this.getExtensionName()
    - files[samplePath] = sampleCode.toString()
    - files[GrammarBundleFiles.testJs] = `const ${languageName} = require("./index.js")
    - /*keep-line*/ const sampleCode = require("fs").readFileSync("${samplePath}", "utf8")
    - ${testCode}`
    - return files
    - }
    - getTargetExtension() {
    - return this.getRootNodeTypeDefinitionNode().get(GrammarConstants.compilesTo)
    - }
    - getCellTypeDefinitions() {
    - if (!this._cache_cellTypes) this._cache_cellTypes = this._getCellTypeDefinitions()
    - return this._cache_cellTypes
    - }
    - getCellTypeDefinitionById(cellTypeId) {
    - // todo: return unknownCellTypeDefinition? or is that handled somewhere else?
    - return this.getCellTypeDefinitions()[cellTypeId]
    - }
    - getNodeTypeFamilyTree() {
    - const tree = new TreeNode()
    - Object.values(this.getValidConcreteAndAbstractNodeTypeDefinitions()).forEach(node => {
    - const path = node.getAncestorNodeTypeIdsArray().join(" ")
    - tree.touchNode(path)
    - })
    - return tree
    - }
    - _getCellTypeDefinitions() {
    - const types = {}
    - // todo: add built in word types?
    - this.getChildrenByNodeConstructor(cellTypeDefinitionNode).forEach(type => (types[type.getCellTypeId()] = type))
    - return types
    - }
    - getLanguageDefinitionProgram() {
    - return this
    - }
    - getValidConcreteAndAbstractNodeTypeDefinitions() {
    - return this.getChildrenByNodeConstructor(nodeTypeDefinitionNode).filter(node => node._hasValidNodeTypeId())
    - }
    - _getLastRootNodeTypeDefinitionNode() {
    - return this.findLast(def => def instanceof AbstractGrammarDefinitionNode && def.has(GrammarConstants.root) && def._hasValidNodeTypeId())
    - }
    - _initRootNodeTypeDefinitionNode() {
    - if (this._cache_rootNodeTypeNode) return
    - if (!this._cache_rootNodeTypeNode) this._cache_rootNodeTypeNode = this._getLastRootNodeTypeDefinitionNode()
    - // By default, have a very permissive basic root node.
    - // todo: whats the best design pattern to use for this sort of thing?
    - if (!this._cache_rootNodeTypeNode) {
    - this._cache_rootNodeTypeNode = this.concat(`${GrammarConstants.defaultRootNode}
    - ${GrammarConstants.root}
    - ${GrammarConstants.catchAllNodeType} ${GrammarConstants.BlobNode}`)[0]
    - this._addDefaultCatchAllBlobNode()
    - }
    - }
    - getRootNodeTypeDefinitionNode() {
    - this._initRootNodeTypeDefinitionNode()
    - return this._cache_rootNodeTypeNode
    - }
    - // todo: whats the best design pattern to use for this sort of thing?
    - _addDefaultCatchAllBlobNode() {
    - delete this._cache_nodeTypeDefinitions
    - this.concat(`${GrammarConstants.BlobNode}
    - ${GrammarConstants.baseNodeType} ${GrammarConstants.blobNode}`)
    - }
    - getExtensionName() {
    - return this.getGrammarName()
    - }
    - getRootNodeTypeId() {
    - return this.getRootNodeTypeDefinitionNode().getNodeTypeIdFromDefinition()
    - }
    - getGrammarName() {
    - return this.getRootNodeTypeId().replace(HandGrammarProgram.nodeTypeSuffixRegex, "")
    - }
    - _getMyInScopeNodeTypeIds() {
    - const nodeTypesNode = this.getRootNodeTypeDefinitionNode().getNode(GrammarConstants.inScope)
    - return nodeTypesNode ? nodeTypesNode.getWordsFrom(1) : []
    - }
    - _getInScopeNodeTypeIds() {
    - const nodeTypesNode = this.getRootNodeTypeDefinitionNode().getNode(GrammarConstants.inScope)
    - return nodeTypesNode ? nodeTypesNode.getWordsFrom(1) : []
    - }
    - _initProgramNodeTypeDefinitionCache() {
    - if (this._cache_nodeTypeDefinitions) return undefined
    - this._cache_nodeTypeDefinitions = {}
    - this.getChildrenByNodeConstructor(nodeTypeDefinitionNode).forEach(nodeTypeDefinitionNode => {
    - this._cache_nodeTypeDefinitions[nodeTypeDefinitionNode.getNodeTypeIdFromDefinition()] = nodeTypeDefinitionNode
    - })
    - }
    - _getProgramNodeTypeDefinitionCache() {
    - this._initProgramNodeTypeDefinitionCache()
    - return this._cache_nodeTypeDefinitions
    - }
    - compileAndReturnRootConstructor() {
    - if (!this._cache_rootConstructorClass) {
    - const def = this.getRootNodeTypeDefinitionNode()
    - const rootNodeTypeId = def.getNodeTypeIdFromDefinition()
    - this._cache_rootConstructorClass = def.getLanguageDefinitionProgram()._compileAndReturnNodeTypeMap()[rootNodeTypeId]
    - }
    - return this._cache_rootConstructorClass
    - }
    - _getFileExtensions() {
    - return this.getRootNodeTypeDefinitionNode().get(GrammarConstants.extensions)
    - ? this.getRootNodeTypeDefinitionNode()
    - .get(GrammarConstants.extensions)
    - .split(" ")
    - .join(",")
    - : this.getExtensionName()
    - }
    - toNodeJsJavascript(jtreePath = "jtree") {
    - return this._rootNodeDefToJavascriptClass(jtreePath, true).trim()
    - }
    - toBrowserJavascript() {
    - return this._rootNodeDefToJavascriptClass("", false).trim()
    - }
    - _getProperName() {
    - return TreeUtils.ucfirst(this.getExtensionName())
    - }
    - _rootNodeDefToJavascriptClass(jtreePath, forNodeJs = true) {
    - const defs = this.getValidConcreteAndAbstractNodeTypeDefinitions()
    - // todo: throw if there is no root node defined
    - const nodeTypeClasses = defs.map(def => def._nodeDefToJavascriptClass()).join("\n\n")
    - const rootDef = this.getRootNodeTypeDefinitionNode()
    - const rootNodeJsHeader = forNodeJs && rootDef._getConcatBlockStringFromExtended(GrammarConstants._rootNodeJsHeader)
    - const rootName = rootDef._getGeneratedClassName()
    - if (!rootName) throw new Error(`Root Node Type Has No Name`)
    - let exportScript = ""
    - if (forNodeJs) {
    - exportScript = `module.exports = ${rootName};
    - ${rootName}`
    - } else {
    - exportScript = `window.${rootName} = ${rootName}`
    - }
    - // todo: we can expose the previous "constants" export, if needed, via the grammar, which we preserve.
    - return `{
    - ${forNodeJs ? `const {jtree} = require("${jtreePath}")` : ""}
    - ${rootNodeJsHeader ? rootNodeJsHeader : ""}
    - ${nodeTypeClasses}
    -
    - ${exportScript}
    - }
    - `
    - }
    - toSublimeSyntaxFile() {
    - const cellTypeDefs = this.getCellTypeDefinitions()
    - const variables = Object.keys(cellTypeDefs)
    - .map(name => ` ${name}: '${cellTypeDefs[name].getRegexString()}'`)
    - .join("\n")
    - const defs = this.getValidConcreteAndAbstractNodeTypeDefinitions().filter(kw => !kw._isAbstract())
    - const nodeTypeContexts = defs.map(def => def._toSublimeMatchBlock()).join("\n\n")
    - const includes = defs.map(nodeTypeDef => ` - include: '${nodeTypeDef.getNodeTypeIdFromDefinition()}'`).join("\n")
    - return `%YAML 1.2
    - name: ${this.getExtensionName()}
    - file_extensions: [${this._getFileExtensions()}]
    - scope: source.${this.getExtensionName()}
    -
    - variables:
    - ${variables}
    -
    - contexts:
    - main:
    - ${includes}
    -
    - ${nodeTypeContexts}`
    - }
    - }
    - HandGrammarProgram.makeNodeTypeId = str => TreeUtils._replaceNonAlphaNumericCharactersWithCharCodes(str).replace(HandGrammarProgram.nodeTypeSuffixRegex, "") + GrammarConstants.nodeTypeSuffix
    - HandGrammarProgram.makeCellTypeId = str => TreeUtils._replaceNonAlphaNumericCharactersWithCharCodes(str).replace(HandGrammarProgram.cellTypeSuffixRegex, "") + GrammarConstants.cellTypeSuffix
    - HandGrammarProgram.nodeTypeSuffixRegex = new RegExp(GrammarConstants.nodeTypeSuffix + "$")
    - HandGrammarProgram.nodeTypeFullRegex = new RegExp("^[a-zA-Z0-9_]+" + GrammarConstants.nodeTypeSuffix + "$")
    - HandGrammarProgram.cellTypeSuffixRegex = new RegExp(GrammarConstants.cellTypeSuffix + "$")
    - HandGrammarProgram.cellTypeFullRegex = new RegExp("^[a-zA-Z0-9_]+" + GrammarConstants.cellTypeSuffix + "$")
    - HandGrammarProgram._languages = {}
    - HandGrammarProgram._nodeTypes = {}
    - const PreludeKinds = {}
    - PreludeKinds[PreludeCellTypeIds.anyCell] = GrammarAnyCell
    - PreludeKinds[PreludeCellTypeIds.keywordCell] = GrammarKeywordCell
    - PreludeKinds[PreludeCellTypeIds.floatCell] = GrammarFloatCell
    - PreludeKinds[PreludeCellTypeIds.numberCell] = GrammarFloatCell
    - PreludeKinds[PreludeCellTypeIds.bitCell] = GrammarBitCell
    - PreludeKinds[PreludeCellTypeIds.boolCell] = GrammarBoolCell
    - PreludeKinds[PreludeCellTypeIds.intCell] = GrammarIntCell
    - window.GrammarConstants = GrammarConstants
    - window.PreludeCellTypeIds = PreludeCellTypeIds
    - window.HandGrammarProgram = HandGrammarProgram
    - window.GrammarBackedNode = GrammarBackedNode
    - window.UnknownNodeTypeError = UnknownNodeTypeError
    - class Upgrader extends TreeNode {
    - upgradeManyInPlace(globPatterns, fromVersion, toVersion) {
    - this._upgradeMany(globPatterns, fromVersion, toVersion).forEach(file => file.tree.toDisk(file.path))
    - return this
    - }
    - upgradeManyPreview(globPatterns, fromVersion, toVersion) {
    - return this._upgradeMany(globPatterns, fromVersion, toVersion)
    - }
    - _upgradeMany(globPatterns, fromVersion, toVersion) {
    - const glob = this.require("glob")
    - const files = TreeUtils.flatten(globPatterns.map(pattern => glob.sync(pattern)))
    - console.log(`${files.length} files to upgrade`)
    - return files.map(path => {
    - console.log("Upgrading " + path)
    - return {
    - tree: this.upgrade(TreeNode.fromDisk(path), fromVersion, toVersion),
    - path: path
    - }
    - })
    - }
    - upgrade(code, fromVersion, toVersion) {
    - const updateFromMap = this.getUpgradeFromMap()
    - const semver = this.require("semver")
    - let fromMap
    - while ((fromMap = updateFromMap[fromVersion])) {
    - const toNextVersion = Object.keys(fromMap)[0] // todo: currently we just assume 1 step at a time
    - if (semver.lt(toVersion, toNextVersion)) break
    - const fn = Object.values(fromMap)[0]
    - code = fn(code)
    - fromVersion = toNextVersion
    - }
    - return code
    - }
    - }
    - window.Upgrader = Upgrader
    - class UnknownGrammarProgram extends TreeNode {
    - _inferRootNodeForAPrefixLanguage(grammarName) {
    - grammarName = HandGrammarProgram.makeNodeTypeId(grammarName)
    - const rootNode = new TreeNode(`${grammarName}
    - ${GrammarConstants.root}`)
    - // note: right now we assume 1 global cellTypeMap and nodeTypeMap per grammar. But we may have scopes in the future?
    - const rootNodeNames = this.getFirstWords()
    - .filter(identity => identity)
    - .map(word => HandGrammarProgram.makeNodeTypeId(word))
    - rootNode
    - .nodeAt(0)
    - .touchNode(GrammarConstants.inScope)
    - .setWordsFrom(1, Array.from(new Set(rootNodeNames)))
    - return rootNode
    - }
    - _renameIntegerKeywords(clone) {
    - // todo: why are we doing this?
    - for (let node of clone.getTopDownArrayIterator()) {
    - const firstWordIsAnInteger = !!node.getFirstWord().match(/^\d+$/)
    - const parentFirstWord = node.getParent().getFirstWord()
    - if (firstWordIsAnInteger && parentFirstWord) node.setFirstWord(HandGrammarProgram.makeNodeTypeId(parentFirstWord + UnknownGrammarProgram._childSuffix))
    - }
    - }
    - _getKeywordMaps(clone) {
    - const keywordsToChildKeywords = {}
    - const keywordsToNodeInstances = {}
    - for (let node of clone.getTopDownArrayIterator()) {
    - const firstWord = node.getFirstWord()
    - if (!keywordsToChildKeywords[firstWord]) keywordsToChildKeywords[firstWord] = {}
    - if (!keywordsToNodeInstances[firstWord]) keywordsToNodeInstances[firstWord] = []
    - keywordsToNodeInstances[firstWord].push(node)
    - node.forEach(child => {
    - keywordsToChildKeywords[firstWord][child.getFirstWord()] = true
    - })
    - }
    - return { keywordsToChildKeywords: keywordsToChildKeywords, keywordsToNodeInstances: keywordsToNodeInstances }
    - }
    - _inferNodeTypeDef(firstWord, globalCellTypeMap, childFirstWords, instances) {
    - const edgeSymbol = this.getEdgeSymbol()
    - const nodeTypeId = HandGrammarProgram.makeNodeTypeId(firstWord)
    - const nodeDefNode = new TreeNode(nodeTypeId).nodeAt(0)
    - const childNodeTypeIds = childFirstWords.map(word => HandGrammarProgram.makeNodeTypeId(word))
    - if (childNodeTypeIds.length) nodeDefNode.touchNode(GrammarConstants.inScope).setWordsFrom(1, childNodeTypeIds)
    - const cellsForAllInstances = instances
    - .map(line => line.getContent())
    - .filter(identity => identity)
    - .map(line => line.split(edgeSymbol))
    - const instanceCellCounts = new Set(cellsForAllInstances.map(cells => cells.length))
    - const maxCellsOnLine = Math.max(...Array.from(instanceCellCounts))
    - const minCellsOnLine = Math.min(...Array.from(instanceCellCounts))
    - let catchAllCellType
    - let cellTypeIds = []
    - for (let cellIndex = 0; cellIndex < maxCellsOnLine; cellIndex++) {
    - const cellType = this._getBestCellType(firstWord, instances.length, maxCellsOnLine, cellsForAllInstances.map(cells => cells[cellIndex]))
    - if (!globalCellTypeMap.has(cellType.cellTypeId)) globalCellTypeMap.set(cellType.cellTypeId, cellType.cellTypeDefinition)
    - cellTypeIds.push(cellType.cellTypeId)
    - }
    - if (maxCellsOnLine > minCellsOnLine) {
    - //columns = columns.slice(0, min)
    - catchAllCellType = cellTypeIds.pop()
    - while (cellTypeIds[cellTypeIds.length - 1] === catchAllCellType) {
    - cellTypeIds.pop()
    - }
    - }
    - const needsCruxProperty = !firstWord.endsWith(UnknownGrammarProgram._childSuffix + "Node") // todo: cleanup
    - if (needsCruxProperty) nodeDefNode.set(GrammarConstants.crux, firstWord)
    - if (catchAllCellType) nodeDefNode.set(GrammarConstants.catchAllCellType, catchAllCellType)
    - const cellLine = cellTypeIds.slice()
    - cellLine.unshift(PreludeCellTypeIds.keywordCell)
    - if (cellLine.length > 0) nodeDefNode.set(GrammarConstants.cells, cellLine.join(edgeSymbol))
    - //if (!catchAllCellType && cellTypeIds.length === 1) nodeDefNode.set(GrammarConstants.cells, cellTypeIds[0])
    - // Todo: add conditional frequencies
    - return nodeDefNode.getParent().toString()
    - }
    - // inferGrammarFileForAnSSVLanguage(grammarName: string): string {
    - // grammarName = HandGrammarProgram.makeNodeTypeId(grammarName)
    - // const rootNode = new TreeNode(`${grammarName}
    - // ${GrammarConstants.root}`)
    - // // note: right now we assume 1 global cellTypeMap and nodeTypeMap per grammar. But we may have scopes in the future?
    - // const rootNodeNames = this.getFirstWords().map(word => HandGrammarProgram.makeNodeTypeId(word))
    - // rootNode
    - // .nodeAt(0)
    - // .touchNode(GrammarConstants.inScope)
    - // .setWordsFrom(1, Array.from(new Set(rootNodeNames)))
    - // return rootNode
    - // }
    - inferGrammarFileForAKeywordLanguage(grammarName) {
    - const clone = this.clone()
    - this._renameIntegerKeywords(clone)
    - const { keywordsToChildKeywords, keywordsToNodeInstances } = this._getKeywordMaps(clone)
    - const globalCellTypeMap = new Map()
    - globalCellTypeMap.set(PreludeCellTypeIds.keywordCell, undefined)
    - const nodeTypeDefs = Object.keys(keywordsToChildKeywords)
    - .filter(identity => identity)
    - .map(firstWord => this._inferNodeTypeDef(firstWord, globalCellTypeMap, Object.keys(keywordsToChildKeywords[firstWord]), keywordsToNodeInstances[firstWord]))
    - const cellTypeDefs = []
    - globalCellTypeMap.forEach((def, id) => cellTypeDefs.push(def ? def : id))
    - const nodeBreakSymbol = this.getNodeBreakSymbol()
    - return this._formatCode([this._inferRootNodeForAPrefixLanguage(grammarName).toString(), cellTypeDefs.join(nodeBreakSymbol), nodeTypeDefs.join(nodeBreakSymbol)].filter(identity => identity).join("\n"))
    - }
    - _formatCode(code) {
    - // todo: make this run in browser too
    - if (!this.isNodeJs()) return code
    - const grammarProgram = new HandGrammarProgram(TreeNode.fromDisk(__dirname + "/../langs/grammar/grammar.grammar"))
    - const programConstructor = grammarProgram.compileAndReturnRootConstructor()
    - const program = new programConstructor(code)
    - return program.format().toString()
    - }
    - _getBestCellType(firstWord, instanceCount, maxCellsOnLine, allValues) {
    - const asSet = new Set(allValues)
    - const edgeSymbol = this.getEdgeSymbol()
    - const values = Array.from(asSet).filter(identity => identity)
    - const every = fn => {
    - for (let index = 0; index < values.length; index++) {
    - if (!fn(values[index])) return false
    - }
    - return true
    - }
    - if (every(str => str === "0" || str === "1")) return { cellTypeId: PreludeCellTypeIds.bitCell }
    - if (
    - every(str => {
    - const num = parseInt(str)
    - if (isNaN(num)) return false
    - return num.toString() === str
    - })
    - ) {
    - return { cellTypeId: PreludeCellTypeIds.intCell }
    - }
    - if (every(str => str.match(/^-?\d*.?\d+$/))) return { cellTypeId: PreludeCellTypeIds.floatCell }
    - const bools = new Set(["1", "0", "true", "false", "t", "f", "yes", "no"])
    - if (every(str => bools.has(str.toLowerCase()))) return { cellTypeId: PreludeCellTypeIds.boolCell }
    - // todo: cleanup
    - const enumLimit = 30
    - if (instanceCount > 1 && maxCellsOnLine === 1 && allValues.length > asSet.size && asSet.size < enumLimit)
    - return {
    - cellTypeId: HandGrammarProgram.makeCellTypeId(firstWord),
    - cellTypeDefinition: `${HandGrammarProgram.makeCellTypeId(firstWord)}
    - enum ${values.join(edgeSymbol)}`
    - }
    - return { cellTypeId: PreludeCellTypeIds.anyCell }
    - }
    - }
    - UnknownGrammarProgram._childSuffix = "Child"
    - window.UnknownGrammarProgram = UnknownGrammarProgram
    - // Adapted from https://github.com/NeekSandhu/codemirror-textmate/blob/master/src/tmToCm.ts
    - var CmToken
    - ;(function(CmToken) {
    - CmToken["Atom"] = "atom"
    - CmToken["Attribute"] = "attribute"
    - CmToken["Bracket"] = "bracket"
    - CmToken["Builtin"] = "builtin"
    - CmToken["Comment"] = "comment"
    - CmToken["Def"] = "def"
    - CmToken["Error"] = "error"
    - CmToken["Header"] = "header"
    - CmToken["HR"] = "hr"
    - CmToken["Keyword"] = "keyword"
    - CmToken["Link"] = "link"
    - CmToken["Meta"] = "meta"
    - CmToken["Number"] = "number"
    - CmToken["Operator"] = "operator"
    - CmToken["Property"] = "property"
    - CmToken["Qualifier"] = "qualifier"
    - CmToken["Quote"] = "quote"
    - CmToken["String"] = "string"
    - CmToken["String2"] = "string-2"
    - CmToken["Tag"] = "tag"
    - CmToken["Type"] = "type"
    - CmToken["Variable"] = "variable"
    - CmToken["Variable2"] = "variable-2"
    - CmToken["Variable3"] = "variable-3"
    - })(CmToken || (CmToken = {}))
    - const tmToCm = {
    - comment: {
    - $: CmToken.Comment
    - },
    - constant: {
    - // TODO: Revision
    - $: CmToken.Def,
    - character: {
    - escape: {
    - $: CmToken.String2
    - }
    - },
    - language: {
    - $: CmToken.Atom
    - },
    - numeric: {
    - $: CmToken.Number
    - },
    - other: {
    - email: {
    - link: {
    - $: CmToken.Link
    - }
    - },
    - symbol: {
    - // TODO: Revision
    - $: CmToken.Def
    - }
    - }
    - },
    - entity: {
    - name: {
    - class: {
    - $: CmToken.Def
    - },
    - function: {
    - $: CmToken.Def
    - },
    - tag: {
    - $: CmToken.Tag
    - },
    - type: {
    - $: CmToken.Type,
    - class: {
    - $: CmToken.Variable
    - }
    - }
    - },
    - other: {
    - "attribute-name": {
    - $: CmToken.Attribute
    - },
    - "inherited-class": {
    - // TODO: Revision
    - $: CmToken.Def
    - }
    - },
    - support: {
    - function: {
    - // TODO: Revision
    - $: CmToken.Def
    - }
    - }
    - },
    - invalid: {
    - $: CmToken.Error,
    - illegal: { $: CmToken.Error },
    - deprecated: {
    - $: CmToken.Error
    - }
    - },
    - keyword: {
    - $: CmToken.Keyword,
    - operator: {
    - $: CmToken.Operator
    - },
    - other: {
    - "special-method": CmToken.Def
    - }
    - },
    - punctuation: {
    - $: CmToken.Operator,
    - definition: {
    - comment: {
    - $: CmToken.Comment
    - },
    - tag: {
    - $: CmToken.Bracket
    - }
    - // 'template-expression': {
    - // $: CodeMirrorToken.Operator,
    - // },
    - }
    - // terminator: {
    - // $: CodeMirrorToken.Operator,
    - // },
    - },
    - storage: {
    - $: CmToken.Keyword
    - },
    - string: {
    - $: CmToken.String,
    - regexp: {
    - $: CmToken.String2
    - }
    - },
    - support: {
    - class: {
    - $: CmToken.Def
    - },
    - constant: {
    - $: CmToken.Variable2
    - },
    - function: {
    - $: CmToken.Def
    - },
    - type: {
    - $: CmToken.Type
    - },
    - variable: {
    - $: CmToken.Variable2,
    - property: {
    - $: CmToken.Property
    - }
    - }
    - },
    - variable: {
    - $: CmToken.Def,
    - language: {
    - // TODO: Revision
    - $: CmToken.Variable3
    - },
    - other: {
    - object: {
    - $: CmToken.Variable,
    - property: {
    - $: CmToken.Property
    - }
    - },
    - property: {
    - $: CmToken.Property
    - }
    - },
    - parameter: {
    - $: CmToken.Def
    - }
    - }
    - }
    - const textMateScopeToCodeMirrorStyle = (scopeSegments, styleTree = tmToCm) => {
    - const matchingBranch = styleTree[scopeSegments.shift()]
    - return matchingBranch ? textMateScopeToCodeMirrorStyle(scopeSegments, matchingBranch) || matchingBranch.$ || null : null
    - }
    - class TreeNotationCodeMirrorMode {
    - constructor(name, getProgramConstructorFn, getProgramCodeFn, codeMirrorLib = undefined) {
    - this._name = name
    - this._getProgramConstructorFn = getProgramConstructorFn
    - this._getProgramCodeFn = getProgramCodeFn || (instance => (instance ? instance.getValue() : this._originalValue))
    - this._codeMirrorLib = codeMirrorLib
    - }
    - _getParsedProgram() {
    - const source = this._getProgramCodeFn(this._cmInstance) || ""
    - if (!this._cachedProgram || this._cachedSource !== source) {
    - this._cachedSource = source
    - this._cachedProgram = new (this._getProgramConstructorFn())(source)
    - }
    - return this._cachedProgram
    - }
    - _getExcludedIntelliSenseTriggerKeys() {
    - return {
    - "8": "backspace",
    - "9": "tab",
    - "13": "enter",
    - "16": "shift",
    - "17": "ctrl",
    - "18": "alt",
    - "19": "pause",
    - "20": "capslock",
    - "27": "escape",
    - "33": "pageup",
    - "34": "pagedown",
    - "35": "end",
    - "36": "home",
    - "37": "left",
    - "38": "up",
    - "39": "right",
    - "40": "down",
    - "45": "insert",
    - "46": "delete",
    - "91": "left window key",
    - "92": "right window key",
    - "93": "select",
    - "112": "f1",
    - "113": "f2",
    - "114": "f3",
    - "115": "f4",
    - "116": "f5",
    - "117": "f6",
    - "118": "f7",
    - "119": "f8",
    - "120": "f9",
    - "121": "f10",
    - "122": "f11",
    - "123": "f12",
    - "144": "numlock",
    - "145": "scrolllock"
    - }
    - }
    - token(stream, state) {
    - return this._advanceStreamAndReturnTokenType(stream, state)
    - }
    - fromTextAreaWithAutocomplete(area, options) {
    - this._originalValue = area.value
    - const defaultOptions = {
    - lineNumbers: true,
    - mode: this._name,
    - tabSize: 1,
    - indentUnit: 1,
    - hintOptions: {
    - hint: (cmInstance, options) => this.codeMirrorAutocomplete(cmInstance, options)
    - }
    - }
    - Object.assign(defaultOptions, options)
    - this._cmInstance = this._getCodeMirrorLib().fromTextArea(area, defaultOptions)
    - this._enableAutoComplete(this._cmInstance)
    - return this._cmInstance
    - }
    - _enableAutoComplete(cmInstance) {
    - const excludedKeys = this._getExcludedIntelliSenseTriggerKeys()
    - const codeMirrorLib = this._getCodeMirrorLib()
    - cmInstance.on("keyup", (cm, event) => {
    - // https://stackoverflow.com/questions/13744176/codemirror-autocomplete-after-any-keyup
    - if (!cm.state.completionActive && !excludedKeys[event.keyCode.toString()])
    - // Todo: get typings for CM autocomplete
    - codeMirrorLib.commands.autocomplete(cm, null, { completeSingle: false })
    - })
    - }
    - _getCodeMirrorLib() {
    - return this._codeMirrorLib
    - }
    - async codeMirrorAutocomplete(cmInstance, options) {
    - const cursor = cmInstance.getDoc().getCursor()
    - const codeMirrorLib = this._getCodeMirrorLib()
    - const result = await this._getParsedProgram().getAutocompleteResultsAt(cursor.line, cursor.ch)
    - // It seems to be better UX if there's only 1 result, and its the word the user entered, to close autocomplete
    - if (result.matches.length === 1 && result.matches[0].text === result.word) return null
    - return result.matches.length
    - ? {
    - list: result.matches,
    - from: codeMirrorLib.Pos(cursor.line, result.startCharIndex),
    - to: codeMirrorLib.Pos(cursor.line, result.endCharIndex)
    - }
    - : null
    - }
    - register() {
    - const codeMirrorLib = this._getCodeMirrorLib()
    - codeMirrorLib.defineMode(this._name, () => this)
    - codeMirrorLib.defineMIME("text/" + this._name, this._name)
    - return this
    - }
    - _advanceStreamAndReturnTokenType(stream, state) {
    - let nextCharacter = stream.next()
    - const lineNumber = stream.lineOracle.line + 1 // state.lineIndex
    - const WordBreakSymbol = " "
    - const NodeBreakSymbol = "\n"
    - while (typeof nextCharacter === "string") {
    - const peek = stream.peek()
    - if (nextCharacter === WordBreakSymbol) {
    - if (peek === undefined || peek === NodeBreakSymbol) {
    - stream.skipToEnd() // advance string to end
    - this._incrementLine(state)
    - }
    - if (peek === WordBreakSymbol && state.cellIndex) {
    - // If we are missing a cell.
    - // TODO: this is broken for a blank 1st cell. We need to track WordBreakSymbol level.
    - state.cellIndex++
    - }
    - return "bracket"
    - }
    - if (peek === WordBreakSymbol) {
    - state.cellIndex++
    - return this._getCellStyle(lineNumber, state.cellIndex)
    - }
    - nextCharacter = stream.next()
    - }
    - state.cellIndex++
    - const style = this._getCellStyle(lineNumber, state.cellIndex)
    - this._incrementLine(state)
    - return style
    - }
    - _getCellStyle(lineIndex, cellIndex) {
    - const program = this._getParsedProgram()
    - // todo: if the current word is an error, don't show red?
    - if (!program.getCellHighlightScopeAtPosition) console.log(program)
    - const highlightScope = program.getCellHighlightScopeAtPosition(lineIndex, cellIndex)
    - const style = highlightScope ? textMateScopeToCodeMirrorStyle(highlightScope.split(".")) : undefined
    - return style || "noHighlightScopeDefinedInGrammar"
    - }
    - // todo: remove.
    - startState() {
    - return {
    - cellIndex: 0
    - }
    - }
    - _incrementLine(state) {
    - state.cellIndex = 0
    - }
    - }
    - window.TreeNotationCodeMirrorMode = TreeNotationCodeMirrorMode
    - class jtree {}
    - jtree.GrammarBackedNode = GrammarBackedNode
    - jtree.GrammarConstants = GrammarConstants
    - jtree.Utils = TreeUtils
    - jtree.UnknownNodeTypeError = UnknownNodeTypeError
    - jtree.TestRacer = TestRacer
    - jtree.TreeEvents = TreeEvents
    - jtree.TreeNode = TreeNode
    - jtree.ExtendibleTreeNode = ExtendibleTreeNode
    - jtree.HandGrammarProgram = HandGrammarProgram
    - jtree.UnknownGrammarProgram = UnknownGrammarProgram
    - jtree.TreeNotationCodeMirrorMode = TreeNotationCodeMirrorMode
    - jtree.getVersion = () => TreeNode.getVersion()
    - window.jtree = jtree
    - ;
    -
    - //onsave jtree build produce jtable.browser.js
    - //onsave jtree build produce jtable.node.js
    - // todo: create a Tree Language for number formatting
    - // https://github.com/gentooboontoo/js-quantities
    - // https://github.com/moment/moment/issues/2469
    - // todo: ugly. how do we ditch this or test?
    - if (typeof moment !== "undefined")
    - moment.createFromInputFallback = function(momentConfig) {
    - momentConfig._d = new Date(momentConfig._i)
    - }
    - var VegaTypes
    - ;(function(VegaTypes) {
    - VegaTypes["nominal"] = "nominal"
    - VegaTypes["ordinal"] = "ordinal"
    - VegaTypes["geojson"] = "geojson"
    - VegaTypes["quantitative"] = "quantitative"
    - VegaTypes["temporal"] = "temporal"
    - })(VegaTypes || (VegaTypes = {}))
    - var JavascriptNativeTypeNames
    - ;(function(JavascriptNativeTypeNames) {
    - JavascriptNativeTypeNames["number"] = "number"
    - JavascriptNativeTypeNames["string"] = "string"
    - JavascriptNativeTypeNames["Date"] = "Date"
    - JavascriptNativeTypeNames["boolean"] = "boolean"
    - })(JavascriptNativeTypeNames || (JavascriptNativeTypeNames = {}))
    - class AbstractPrimitiveType {
    - constructor(typeName) {
    - this._name = typeName
    - }
    - getPrimitiveTypeName() {
    - return this._name
    - }
    - // Abstract methods:
    - toDisplayString(value, format) {
    - return value
    - }
    - getDefaultFormat(columnName, sample) {
    - return ""
    - }
    - getProbForColumnSpecimen(value) {
    - return 0
    - }
    - isInvalidValue(value) {
    - if (value === undefined || value === "") return true
    - return false
    - }
    - }
    - class BooleanType extends AbstractPrimitiveType {
    - getAsNativeJavascriptType(val) {
    - // todo: handle false, etc
    - return val ? 1 : 0
    - }
    - synthesizeValue(randomNumberFn) {
    - return Math.round(randomNumberFn())
    - }
    - getJavascriptTypeName() {
    - return JavascriptNativeTypeNames.boolean
    - }
    - fromStringToNumeric(val) {
    - return val.toString() === "true" ? 1 : 0
    - }
    - getStringExamples() {
    - return ["true"]
    - }
    - getVegaType() {
    - return VegaTypes.nominal
    - }
    - isNumeric() {
    - return false
    - }
    - isString() {
    - return false
    - }
    - isTemporal() {
    - return false
    - }
    - }
    - class AbstractNumeric extends AbstractPrimitiveType {
    - fromStringToNumeric(value) {
    - return parseFloat(value)
    - }
    - synthesizeValue(randomNumberFn) {
    - // todo: min/max etc
    - return this.getMin() + Math.floor((this.getMax() - this.getMin()) * randomNumberFn())
    - }
    - getMax() {
    - return 100
    - }
    - getMin() {
    - return 0
    - }
    - getAsNativeJavascriptType(val) {
    - if (val === undefined) return NaN
    - const valType = typeof val
    - if (valType === "string") return this.fromStringToNumeric(val)
    - else if (val instanceof Date) return Math.round(val.getDate() / 1000)
    - // Is a number
    - return val
    - }
    - getJavascriptTypeName() {
    - return JavascriptNativeTypeNames.number
    - }
    - getVegaType() {
    - return VegaTypes.quantitative
    - }
    - isString() {
    - return false
    - }
    - isTemporal() {
    - return false
    - }
    - isNumeric() {
    - return true
    - }
    - isInvalidValue(value) {
    - return super.isInvalidValue(value) || isNaN(value)
    - }
    - }
    - class IntType extends AbstractNumeric {
    - fromStringToNumeric(val) {
    - return parseInt(val)
    - }
    - getStringExamples() {
    - return ["30"]
    - }
    - getVegaType() {
    - return VegaTypes.quantitative
    - }
    - isNumeric() {
    - return true
    - }
    - isString() {
    - return false
    - }
    - isTemporal() {
    - return false
    - }
    - }
    - class Feet extends AbstractNumeric {
    - getProbForColumnSpecimen(sample) {
    - return isNaN(Feet.feetToInches(sample)) ? 0 : 1
    - }
    - fromStringToNumeric(val) {
    - return Feet.feetToInches(val)
    - }
    - toDisplayString(value, format) {
    - value = parseFloat(value)
    - const inches = Math.round(value % 12)
    - const feet = Math.floor(value / 12)
    - return `${feet}'${inches}"`
    - }
    - getStringExamples() {
    - return ["5'10\""]
    - }
    - // Return inches given formats like 6'1 6'2"
    - static feetToInches(numStr) {
    - let result = 0
    - const indexOfDelimited = numStr.search(/[^0-9\.]/)
    - if (indexOfDelimited < 1) {
    - result = parseFloat(numStr.replace(/[^0-9\.]/g, ""))
    - return isNaN(result) ? result : result * 12
    - }
    - const feetPart = parseFloat(numStr.substr(0, indexOfDelimited).replace(/[^0-9\.]/g, ""))
    - const inchesPart = parseFloat(numStr.substr(indexOfDelimited).replace(/[^0-9\.]/g, ""))
    - if (!isNaN(feetPart)) result += feetPart * 12
    - if (!isNaN(inchesPart)) result += inchesPart
    - return result
    - }
    - }
    - class AbstractCurrency extends AbstractNumeric {}
    - class USD extends AbstractCurrency {
    - toDisplayString(value, format) {
    - return format ? d3format.format(format)(value) : value
    - }
    - fromStringToNumeric(value) {
    - return parseFloat(value.toString().replace(/[\$\, \%]/g, ""))
    - }
    - getProbForColumnSpecimen(sample) {
    - return sample && sample.match && !!sample.match(/^\$[0-9\.\,]+$/) ? 1 : 0
    - }
    - getDefaultFormat() {
    - return "($.2f"
    - }
    - getStringExamples() {
    - return ["$2.22"]
    - }
    - }
    - class NumberCol extends AbstractNumeric {
    - // https://github.com/d3/d3-format
    - toDisplayString(value, format) {
    - if (format === "percent") return d3format.format("(.2f")(parseFloat(value)) + "%"
    - // Need the isNan bc numeral will throw otherwise
    - if (format && !isNaN(value) && value !== Infinity) return d3format.format(format)(value)
    - return value
    - }
    - getDefaultFormat(columnName, sample) {
    - if (columnName.match(/^(mile|pound|inch|feet)s?$/i)) return "(.1f"
    - if (columnName.match(/^(calorie|steps)s?$/i)) return ","
    - if (sample && !sample.toString().includes(".")) return ","
    - }
    - getStringExamples() {
    - return ["2.22"]
    - }
    - }
    - class NumberString extends AbstractNumeric {
    - toDisplayString(value, format) {
    - return format ? d3format.format(format)(value) : value
    - }
    - getDefaultFormat() {
    - return ","
    - }
    - fromStringToNumeric(str) {
    - return parseFloat(str.toString().replace(/[\$\, \%]/g, ""))
    - }
    - getStringExamples() {
    - return ["2,000"]
    - }
    - }
    - class ObjectType extends AbstractPrimitiveType {
    - getAsNativeJavascriptType(val) {
    - return val === undefined ? "" : val.toString()
    - }
    - // todo: not sure about this.
    - getStringExamples() {
    - return ["{score: 10}"]
    - }
    - synthesizeValue() {
    - return {}
    - }
    - fromStringToNumeric() {
    - return undefined
    - }
    - getJavascriptTypeName() {
    - return JavascriptNativeTypeNames.string
    - }
    - getVegaType() {
    - return VegaTypes.nominal
    - }
    - isNumeric() {
    - return false
    - }
    - isString() {
    - return false
    - }
    - isTemporal() {
    - return false
    - }
    - }
    - class AbstractStringCol extends AbstractPrimitiveType {
    - isString() {
    - return true
    - }
    - isNumeric() {
    - return false
    - }
    - getStringExamples() {
    - return ["Anything"]
    - }
    - getVegaType() {
    - return VegaTypes.nominal
    - }
    - synthesizeValue() {
    - return "randomString"
    - }
    - getJavascriptTypeName() {
    - return JavascriptNativeTypeNames.string
    - }
    - fromStringToNumeric() {
    - return undefined
    - }
    - isTemporal() {
    - return false
    - }
    - getAsNativeJavascriptType(val) {
    - return val === undefined ? "" : val.toString()
    - }
    - }
    - class StringCol extends AbstractStringCol {}
    - class UrlCol extends AbstractStringCol {
    - getStringExamples() {
    - return ["www.foo.com"]
    - }
    - }
    - class TextCol extends AbstractStringCol {}
    - class AbstractCodeCol extends AbstractStringCol {}
    - class CodeCol extends AbstractCodeCol {
    - getStringExamples() {
    - return ["i++"]
    - }
    - }
    - class HTMLCol extends AbstractCodeCol {
    - getStringExamples() {
    - return ["hi"]
    - }
    - }
    - class AbstractPathCol extends AbstractStringCol {}
    - // filepath
    - class PathCol extends AbstractPathCol {}
    - // Directory
    - class DirCol extends AbstractPathCol {}
    - class AbstractTemporal extends AbstractPrimitiveType {
    - _fromStringToDate(value) {
    - return moment(parseInt(value)).toDate()
    - }
    - getAsNativeJavascriptType(val) {
    - if (val === undefined) return undefined
    - const valType = typeof val
    - if (valType === "string") return this._fromStringToDate(val)
    - else if (val instanceof Date) return val
    - return this._fromNumericToDate(val)
    - }
    - fromDateToNumeric(date) {
    - return moment(date).unix()
    - }
    - getJavascriptTypeName() {
    - return JavascriptNativeTypeNames.Date
    - }
    - synthesizeValue() {
    - return new Date()
    - }
    - isNumeric() {
    - return true
    - }
    - isString() {
    - return false
    - }
    - isTemporal() {
    - return true
    - }
    - getVegaType() {
    - return VegaTypes.temporal
    - }
    - getVegaTimeUnit() {
    - return undefined
    - }
    - _fromNumericToDate(value) {
    - return moment(value).toDate()
    - }
    - }
    - class DateCol extends AbstractTemporal {
    - toDisplayString(value, format) {
    - if (!format) format = "MM/DD/YY"
    - if (format === "fromNow") return moment(parseFloat(value)).fromNow()
    - // todo: make sure we are working with numeric values?
    - return moment(value).format(format)
    - }
    - fromStringToNumeric(value) {
    - return DateCol.getDate(value).unix() * 1000
    - }
    - _fromStringToDate(value) {
    - return DateCol.getDate(value).toDate()
    - }
    - getProbForColumnSpecimen(value) {
    - const isValid = DateCol.getDate(value).isValid()
    - return isValid
    - }
    - getStringExamples() {
    - return ["01/01/01"]
    - }
    - static getDateAsUnixUtx(value) {
    - return this.getDate(value, moment.utc).unix()
    - }
    - static getDate(value, momentFn = moment) {
    - let result = momentFn(value)
    - if (result.isValid()) return result
    - if (typeof value === "string" && value.match(/^[0-9]{8}$/)) {
    - const first2 = parseInt(value.substr(0, 2))
    - const second2 = parseInt(value.substr(2, 2))
    - const third2 = parseInt(value.substr(4, 2))
    - const last2 = parseInt(value.substr(6, 2))
    - const first4 = parseInt(value.substr(0, 4))
    - const last4 = parseInt(value.substr(4, 4))
    - const first2couldBeDay = first2 < 32
    - const first2couldBeMonth = first2 < 13
    - const second2couldBeDay = second2 < 32
    - const second2couldBeMonth = second2 < 13
    - const third2couldBeDay = third2 < 32
    - const third2couldBeMonth = third2 < 13
    - const last2couldBeDay = last2 < 32
    - const last2couldBeMonth = last2 < 13
    - const last4looksLikeAYear = last4 > 1000 && last4 < 2100
    - const first4looksLikeAYear = first4 > 1000 && first4 < 2100
    - // MMDDYYYY
    - // YYYYMMDD
    - // Prioritize the above 2 american versions
    - // YYYYDDMM
    - // DDMMYYYY
    - if (first2couldBeMonth && second2couldBeDay && last4looksLikeAYear) result = momentFn(value, "MMDDYYYY")
    - else if (first4looksLikeAYear && third2couldBeMonth && last2couldBeDay) result = momentFn(value, "YYYYMMDD")
    - else if (first4looksLikeAYear && last2couldBeMonth) result = momentFn(value, "YYYYDDMM")
    - else result = momentFn(value, "DDMMYYYY")
    - return result
    - } else if (typeof value === "string" && value.match(/^[0-9]{2}\/[0-9]{4}$/))
    - // MM/YYYY
    - return momentFn(value, "MM/YYYY")
    - // Check if timestamp
    - if (value.match && !value.match(/[^0-9]/)) {
    - const num = parseFloat(value)
    - if (!isNaN(num)) {
    - if (value.length === 10) return momentFn(num * 1000)
    - else return momentFn(num)
    - }
    - }
    - // Okay to return an invalid result if we dont find a match
    - // todo: why??? should we return "" instead ?
    - return result
    - }
    - }
    - // Beginning of day
    - class Day extends AbstractTemporal {
    - toDisplayString(value, format) {
    - return moment(value).format(format || "MM/DD/YYYY")
    - }
    - fromStringToNumeric(value) {
    - return (
    - DateCol.getDate(value)
    - .startOf("day")
    - .unix() * 1000
    - )
    - }
    - getVegaTimeUnit() {
    - return undefined
    - }
    - _fromStringToDate(value) {
    - return DateCol.getDate(value)
    - .startOf("day")
    - .toDate()
    - }
    - fromDateToNumeric(date) {
    - return (
    - moment(date)
    - .startOf("day")
    - .unix() * 1000
    - )
    - }
    - getStringExamples() {
    - return ["01/01/01"]
    - }
    - getProbForColumnSpecimen(sample) {
    - const format = moment.parseFormat ? moment.parseFormat(sample) : parseFormat
    - return format === "MM/DD/YY" || format === "MM/DD/YYYY" || format === "M/D/YYYY" ? 1 : 0
    - }
    - }
    - class HourMinute extends AbstractTemporal {
    - // todo: is this correct? I dont think so.
    - fromStringToNumeric(value) {
    - return parseFloat(DateCol.getDate(value).format("H.m"))
    - }
    - getVegaTimeUnit() {
    - return "hoursminutes"
    - }
    - // todo: is this correct? I dont think so.
    - getStringExamples() {
    - return ["2:30"]
    - }
    - }
    - class Minute extends AbstractTemporal {
    - toDisplayString(value, format) {
    - return moment(value).format("m")
    - }
    - fromStringToNumeric(value) {
    - return (
    - DateCol.getDate(value)
    - .startOf("minute")
    - .unix() * 1000
    - )
    - }
    - getVegaTimeUnit() {
    - return "minutes"
    - }
    - getStringExamples() {
    - return ["30"]
    - }
    - }
    - class AbstractTemporalInt extends AbstractTemporal {
    - fromStringToNumeric(val) {
    - return parseInt(val)
    - }
    - // getAsNativeJavascriptType(val: any): number {
    - // const result = super.getAsNativeJavascriptType(val)
    - // return result === undefined ? undefined : this.fromDateToNumeric(result)
    - // }
    - getStringExamples() {
    - return ["30"]
    - }
    - isNumeric() {
    - return true
    - }
    - isString() {
    - return false
    - }
    - fromDateToNumeric(date) {
    - return moment(date).unix()
    - }
    - _fromStringToDate(val) {
    - return moment(parseFloat(val)).toDate()
    - }
    - _fromNumericToDate(value) {
    - return moment(value).toDate()
    - }
    - getVegaTimeUnit() {
    - return "seconds"
    - }
    - }
    - class Week extends AbstractTemporalInt {
    - toDisplayString(value, format) {
    - return moment(value).format("MM/DD/YYYY - WW")
    - }
    - fromDateToNumeric(date) {
    - return (
    - moment(date)
    - .startOf("week")
    - .unix() * 1000
    - )
    - }
    - getVegaTimeUnit() {
    - return "quartermonth"
    - }
    - }
    - class Month extends AbstractTemporalInt {
    - toDisplayString(value, format) {
    - return moment(value).format(format || "MMMM")
    - }
    - fromDateToNumeric(date) {
    - return (
    - moment(date)
    - .startOf("month")
    - .unix() * 1000
    - )
    - }
    - getVegaTimeUnit() {
    - return "month"
    - }
    - }
    - class MonthDay extends AbstractTemporalInt {
    - toDisplayString(value, format) {
    - return moment(value).format(format || "MMDD")
    - }
    - fromDateToNumeric(date) {
    - return moment(date).unix() * 1000
    - }
    - getVegaTimeUnit() {
    - return "monthdate"
    - }
    - }
    - class Hour extends AbstractTemporalInt {
    - fromDateToNumeric(date) {
    - return parseInt(
    - moment(date)
    - .startOf("hour")
    - .format("H")
    - )
    - }
    - getVegaTimeUnit() {
    - return "hours"
    - }
    - }
    - class Year extends AbstractTemporalInt {
    - fromDateToNumeric(date) {
    - return parseInt(moment(date).format("YYYY"))
    - }
    - _fromStringToDate(val) {
    - return moment(parseFloat(val), "YYYY").toDate()
    - }
    - toDisplayString(value, format) {
    - return moment(value).format(format || "YYYY")
    - }
    - getVegaTimeUnit() {
    - return "year"
    - }
    - _fromNumericToDate(value) {
    - return moment(value, "YYYY").toDate()
    - }
    - isTemporal() {
    - return true
    - }
    - }
    - class AbstractMillisecond extends AbstractTemporalInt {
    - toDisplayString(value, format) {
    - if (format === "fromNow") return moment(parseFloat(value)).fromNow()
    - return value
    - }
    - isTemporal() {
    - return true
    - }
    - getDefaultFormat() {
    - return "fromNow"
    - }
    - }
    - class MilliSecond extends AbstractMillisecond {
    - getVegaTimeUnit() {
    - return "milliseconds"
    - }
    - }
    - class Second extends AbstractMillisecond {
    - fromStringToNumeric(value) {
    - return parseInt(value) * 1000
    - }
    - getVegaTimeUnit() {
    - return "seconds"
    - }
    - _fromNumericToDate(number) {
    - return moment(number * 1000).toDate()
    - }
    - toDisplayString(value, format) {
    - if (format === "fromNow") return moment(parseFloat(value) * 1000).fromNow()
    - return value
    - }
    - }
    - // todo: ADD TYPINGS
    - class Column {
    - constructor(colDef = {}, rawAnyVector) {
    - this._colDefObject = colDef
    - this._rawAnyVectorFromSource = rawAnyVector
    - this._sampleSet = jtree.Utils.sampleWithoutReplacement(rawAnyVector, 30, Date.now())
    - }
    - static _getPrimitiveTypesCollection() {
    - if (!this._colTypes)
    - this._colTypes = {
    - millisecond: new MilliSecond("millisecond"),
    - second: new Second("second"),
    - date: new DateCol("date"),
    - day: new Day("day"),
    - week: new Week("week"),
    - month: new Month("month"),
    - monthDay: new MonthDay("monthDay"),
    - hour: new Hour("hour"),
    - hourMinute: new HourMinute("hourMinute"),
    - minute: new Minute("minute"),
    - year: new Year("year"),
    - feet: new Feet("feet"),
    - usd: new USD("usd"),
    - number: new NumberCol("number"),
    - numberString: new NumberString("numberString"),
    - string: new StringCol("string"),
    - text: new TextCol("text"),
    - path: new PathCol("path"),
    - dir: new DirCol("dir"),
    - code: new CodeCol("code"),
    - html: new HTMLCol("html"),
    - url: new UrlCol("url"),
    - object: new ObjectType("object"),
    - boolean: new BooleanType("boolean"),
    - int: new IntType("int")
    - }
    - return this._colTypes
    - }
    - static getPrimitiveTypeByName(name) {
    - return this._getPrimitiveTypesCollection()[name]
    - }
    - getMathFn() {
    - return this._colDefObject.mathFn
    - }
    - getColumnName() {
    - return this._getColDefObject().name
    - }
    - _getSourceColumnName() {
    - return this._colDefObject.source
    - }
    - isInvalidValue(value) {
    - return this.getPrimitiveTypeObj().isInvalidValue(value)
    - }
    - _getFirstNonEmptyValueFromSampleSet() {
    - if (this._sample === undefined) {
    - const sampleSet = this._getSampleSet()
    - this._sample = sampleSet.length ? sampleSet.find(value => !jtree.Utils.isValueEmpty(value)) : ""
    - }
    - return this._sample
    - }
    - _getColDefObject() {
    - return this._colDefObject
    - }
    - getPrimitiveTypeObj() {
    - if (!this._type) this._type = this._inferType()
    - return this._type
    - }
    - synthesizeValue(randomNumberFn) {
    - return this.getPrimitiveTypeObj().synthesizeValue(randomNumberFn)
    - }
    - isTemporal() {
    - return this.getPrimitiveTypeObj().isTemporal()
    - }
    - toDisplayString(value) {
    - return this.getPrimitiveTypeObj().toDisplayString(value, this.getFormat())
    - }
    - isString() {
    - return this.getPrimitiveTypeObj().isString()
    - }
    - isNumeric() {
    - return this.getPrimitiveTypeObj().isNumeric()
    - }
    - isHash() {
    - return this.isString() && false // todo: make this work. identify random hashes, et cetera.
    - }
    - // todo: isEnum/isSet
    - // todo: isUniqueTimestamp
    - getEntropy() {
    - if (this._entropy !== undefined) return this._entropy
    - const possibilities = {}
    - let bits = 1
    - const name = this.getColumnName()
    - this._getSampleSet().forEach(val => {
    - if (possibilities[val]) return
    - bits++
    - possibilities[val] = true
    - })
    - this._entropy = bits
    - return this._entropy
    - }
    - isLink() {
    - if (this._isLink !== undefined) return this._isLink
    - const sample = this._getFirstNonEmptyValueFromSampleSet()
    - if (!this.isString() || !sample || !sample.match) this._isLink = false
    - else this._isLink = sample.match(/^(https?\:|\/)/) ? true : false
    - return this._isLink
    - }
    - _getSampleSet() {
    - return this._sampleSet
    - }
    - isUnique() {
    - return this.getEntropy() - 1 === this._getSampleSet().length
    - }
    - getTitlePotential() {
    - if (this._getColDefObject().title) return 1
    - if (this._titlePotential !== undefined) return this._titlePotential
    - const titleCols = {
    - title: 0.99,
    - name: 0.98,
    - label: 0.97,
    - category: 0.96
    - }
    - const lowerCaseName = this.getColumnName().toLowerCase()
    - if (titleCols[lowerCaseName]) this._titlePotential = titleCols[lowerCaseName]
    - else if (this.getEstimatedTextLength() > 150) this._titlePotential = 0.01
    - else if (this.isString() && !this.isLink() && this.isUnique() && !this.isHash()) this._titlePotential = 0.75
    - else this._titlePotential = 0
    - return this._titlePotential
    - }
    - getVegaType() {
    - return this.getPrimitiveTypeObj().getVegaType()
    - }
    - getVegaTimeUnit() {
    - const type = this.getPrimitiveTypeObj()
    - return type.getVegaTimeUnit ? type.getVegaTimeUnit() : undefined
    - }
    - getEstimatedTextLength() {
    - if (!this.isString()) return 0
    - if (this._estimatedTextLength !== undefined) return this._estimatedTextLength
    - const name = this.getColumnName()
    - const sampleSet = this._getSampleSet()
    - const sum = sampleSet.map(val => val && val.length).reduce((rowLength, cumulative) => rowLength + cumulative, 0)
    - this._estimatedTextLength = Math.floor(sum / sampleSet.length)
    - return this._estimatedTextLength
    - }
    - getFormat() {
    - if (this._getColDefObject().format) return this._getColDefObject().format
    - return this.getPrimitiveTypeObj().getDefaultFormat(this.getColumnName(), this._getFirstNonEmptyValueFromSampleSet())
    - }
    - getBlankPercentage() {
    - let blankCount = 0
    - let mistypedCount = 0 // todo.
    - const colName = this.getColumnName()
    - const sampleSet = this._getSampleSet()
    - sampleSet.forEach(value => {
    - if (value === undefined || value === "") blankCount++
    - // todo: add mistyped data
    - })
    - return blankCount / (sampleSet.length || 1)
    - }
    - getMap() {
    - const map = this._map
    - if (map) return map
    - this._map = this._getSummaryVector().map
    - return this._map
    - }
    - getValues() {
    - return this._getSummaryVector().values
    - }
    - _getSummaryVector() {
    - if (!this._summaryVector) this._summaryVector = this._createSummaryVector()
    - return this._summaryVector
    - }
    - _getRawAnyVectorFromSource() {
    - return this._rawAnyVectorFromSource
    - }
    - _createSummaryVector() {
    - const values = []
    - const map = new Map()
    - let incompleteCount = 0
    - let uniques = 0
    - let index = 0
    - let rawVector = this._getRawAnyVectorFromSource()
    - // If needs conversion.
    - // todo: add tests
    - const primitiveType = this.getPrimitiveTypeObj()
    - if (primitiveType.isNumeric() && typeof rawVector[0] === "string") rawVector = rawVector.map(primitiveType.fromStringToNumeric)
    - rawVector.forEach(val => {
    - if (this.isInvalidValue(val)) {
    - incompleteCount++
    - return true
    - }
    - if (!map.has(val)) {
    - map.set(val, { count: 0, index: index })
    - uniques++
    - } else map.get(val).count++
    - values.push(val)
    - })
    - return {
    - map: map,
    - values: values,
    - incompleteCount: incompleteCount,
    - uniqueValues: uniques
    - }
    - }
    - getQuins() {
    - const deciles = this.getReductions().deciles
    - return [20, 40, 60, 80, 100].map(decile => {
    - return {
    - value: deciles[decile],
    - percent: decile / 100
    - }
    - })
    - }
    - getPrimitiveTypeName() {
    - return this.getPrimitiveTypeObj().getPrimitiveTypeName()
    - }
    - toObject() {
    - return {
    - name: this.getColumnName(),
    - type: this.getPrimitiveTypeName(),
    - vegaType: this.getVegaType(),
    - vegaTimeUnit: this.getVegaTimeUnit(),
    - reduction: this._getColDefObject().reduction,
    - titlePotential: this.getTitlePotential(),
    - isString: this.isString(),
    - isTemporal: this.isTemporal(),
    - isLink: this.isLink(),
    - estimatedTextLength: this.getEstimatedTextLength()
    - }
    - }
    - getReductions() {
    - if (!this._reductions) this._reductions = this._getReductionResult(this._getSummaryVector(), this)
    - return this._reductions
    - }
    - getMax() {
    - return this.getReductions().max
    - }
    - getMin() {
    - return this.getReductions().min
    - }
    - getMean() {
    - return this.getReductions().mean
    - }
    - _getReductionResult(valuesObj, col) {
    - const values = valuesObj.values
    - const count = values.length
    - const reductionResult = {}
    - reductionResult.incompleteCount = valuesObj.incompleteCount
    - reductionResult.uniqueValues = valuesObj.uniqueValues
    - if (!count) return reductionResult
    - const numericCompare = (av, bv) => (av > bv ? 1 : av < bv ? -1 : 0)
    - const arr = values.slice()
    - col.isString() ? arr.sort() : arr.sort(numericCompare)
    - let min = arr[0]
    - let max = arr[0]
    - let sum = 0
    - let mode = undefined
    - let modeSize = 0
    - let currentBucketValue = undefined
    - let currentBucketSize = 0
    - for (let index = 0; index < count; index++) {
    - let value = arr[index]
    - sum += value
    - if (value > max) max = value
    - if (value < min) min = value
    - if (value === currentBucketValue) currentBucketSize++
    - else {
    - currentBucketValue = value
    - currentBucketSize = 1
    - }
    - if (currentBucketSize > modeSize) {
    - modeSize = currentBucketSize
    - mode = currentBucketValue
    - }
    - }
    - const medianIndex = Math.floor(count / 2)
    - reductionResult.count = count
    - reductionResult.sum = sum
    - reductionResult.median = arredianIndex]
    - reductionResult.mean = sum / count
    - reductionResult.min = min
    - reductionResult.max = max
    - reductionResult.range = max - min
    - reductionResult.mode = mode
    - reductionResult.modeSize = modeSize
    - if (col.isString()) {
    - reductionResult.sum = undefined
    - reductionResult.mean = undefined
    - } else if (col.isTemporal()) reductionResult.sum = undefined
    - reductionResult.deciles = {}
    - const deciles = [10, 20, 30, 40, 50, 60, 70, 80, 90, 99, 100]
    - deciles.forEach(decile => {
    - let index = Math.floor(count * (decile / 100))
    - index = index === count ? index - 1 : index
    - reductionResult.deciles[decile] = arr[index]
    - })
    - return reductionResult
    - }
    - static _getColumnProbabilities(name, sample) {
    - // Assume data is trimmed.
    - const sampleType = typeof sample
    - const sampleStringLength = sample !== undefined ? sample.toString().length : 0
    - const guesses = {}
    - guesses.number = 0.5
    - guesses.date = 0.25
    - guesses.string = 0.75
    - guesses.feet = 0.01 // 5'11"
    - guesses.object = 0.1
    - guesses.boolean = 0.02
    - const isDate = sample instanceof Date
    - const isNumber = !isNaN(parseFloat(sample)) || Column.getPrimitiveTypeByName("usd").getProbForColumnSpecimen(sample)
    - if (sampleType === "object") guesses.object = 0.9
    - if (sample === true || sample === false) guesses.boolean = 0.96
    - if (name.match(/(team|name|link|image|description|permalink|title|label|status|thumb|ip|useragent)/i)) guesses.string = 0.95
    - if (name.match(/(gender|region|category|group|section|sector|field)/i)) guesses.string = 0.95
    - if (name.match(/(height|length)/i)) {
    - if (sample.toString().match(/[0-9]+(\'|\-)[0-9\.]+/) && Column.getPrimitiveTypeByName("feet").getProbForColumnSpecimen(sample)) guesses.feet = 0.97
    - }
    - if (isNumber) guesses.number = 0.8
    - else guesses.number = 0.1
    - const usdGuess = Column.getPrimitiveTypeByName("usd").getProbForColumnSpecimen(sample)
    - if (usdGuess || (!isNaN(sample) && name.match(/^(price|income|cost|revenue|budget|profit|amount|balance)$/i))) guesses.usd = 0.99
    - if (isNumber && name.match(/(year|born)/i) && sampleStringLength === 4) guesses.year = 0.99
    - if (isDate && name.match(/(year|born)/i)) guesses.year = 0.99
    - if (isNumber && name.match(/(time|second|created|edited)/i) && sampleStringLength === 10) guesses.second = 0.99
    - if (isNumber && name.match(/(time|second)/i) && sampleStringLength === 13) guesses.millisecond = 0.99
    - const isValidDate = Column.getPrimitiveTypeByName("date").getProbForColumnSpecimen(sample)
    - if (name.match(/(year|date|dob|birthday|day|month|time|birthdate|utc)/i) && isValidDate) guesses.date = 0.98
    - else if (isValidDate && sampleType === "string" && sample.includes("/")) guesses.date = 0.81
    - if (sampleType === "string" && sampleStringLength > 100) guesses.string = 0.98
    - return guesses
    - }
    - _inferType() {
    - const columnObj = this._getColDefObject()
    - const sample = this._getFirstNonEmptyValueFromSampleSet()
    - if (columnObj && columnObj.type && Column.getPrimitiveTypeByName(columnObj.type)) return Column.getPrimitiveTypeByName(columnObj.type)
    - const guesses = Column._getColumnProbabilities(this.getColumnName(), this._getFirstNonEmptyValueFromSampleSet())
    - let max = 0
    - let bestGuess = null
    - for (let typeScore in guesses) {
    - if (guesses[typeScore] > max) {
    - max = guesses[typeScore]
    - bestGuess = typeScore
    - }
    - }
    - if (bestGuess === "number" && typeof sample === "string") {
    - if (sample.match(",")) bestGuess = "numberString"
    - }
    - if (bestGuess === "date" && typeof sample === "string") {
    - if (Column.getPrimitiveTypeByName("day").getProbForColumnSpecimen(sample)) bestGuess = "day"
    - }
    - return Column.getPrimitiveTypeByName(bestGuess)
    - }
    - // Note: If it returns a string removes spaces
    - static convertValueToNumeric(value, sourceType, destinationType, mathFn) {
    - const destType = this.getPrimitiveTypeByName(destinationType)
    - if (value === undefined || !destType || value === "") return ""
    - const conversionFn = this._getConversionFn(sourceType, destinationType, value)
    - const res = conversionFn(value)
    - if (mathFn) return mathFn(res)
    - return res
    - }
    - static _getConversionFn(sourceType, destinationType, value) {
    - const sourceCol = this.getPrimitiveTypeByName(sourceType)
    - const destinationCol = this.getPrimitiveTypeByName(destinationType)
    - if (!sourceCol || !destinationCol) return destinationCol.fromStringToNumeric
    - if (destinationCol.isTemporal() && sourceCol.isTemporal()) return val => destinationCol.fromDateToNumeric(sourceCol._fromStringToDate(val))
    - return destinationCol.fromStringToNumeric
    - }
    - }
    - const PrimitiveTypes = {
    - AbstractPrimitiveType,
    - BooleanType,
    - ObjectType,
    - USD,
    - NumberCol,
    - NumberString,
    - Feet,
    - IntType,
    - UrlCol,
    - HTMLCol,
    - DirCol,
    - PathCol,
    - TextCol,
    - StringCol,
    - AbstractTemporal,
    - MilliSecond,
    - Second,
    - DateCol,
    - Day,
    - Month,
    - MonthDay,
    - Week,
    - Hour,
    - Minute,
    - Year,
    - HourMinute,
    - CodeCol
    - }
    - window.Column = Column
    - window.PrimitiveTypes = PrimitiveTypes
    - //onsave jtree build produce jtable.browser.js
    - //onsave jtree build produce jtable.node.js
    - class Row {
    - constructor(sourceObject = {}, table) {
    - this._puid = this._getUniqueId()
    - this._sourceObject = sourceObject
    - this._table = table
    - }
    - _getUniqueId() {
    - Row._uniqueId++
    - return Row._uniqueId
    - }
    - destroy() {}
    - async destroyRow() {}
    - getAsArray(headerRow) {
    - const obj = this.rowToObjectWithOnlyNativeJavascriptTypes()
    - return headerRow.map(col => obj[col])
    - }
    - getRowSourceObject() {
    - return this._sourceObject
    - }
    - toVector() {
    - return Object.values(this.rowToObjectWithOnlyNativeJavascriptTypes())
    - }
    - // todo: rowToObjectWithOnlyNativeJavascriptTypes method? Its numerics where we need and strings where we need.
    - _parseIntoObjectWithOnlyNativeJavascriptTypes() {
    - const columns = this._table.getColumnsMap()
    - const typedNode = {}
    - Object.keys(columns).forEach(colName => {
    - typedNode[colName] = this._getRowValueFromSourceColOrOriginalCol(colName)
    - })
    - return typedNode
    - }
    - // why from source col? if we always copy, we shouldnt need that, correct? perhaps have an audit array of all operations on a row?
    - _getRowValueFromSourceColOrOriginalCol(colName) {
    - const columns = this._table.getColumnsMap()
    - const destColumn = columns[colName]
    - const sourceColName = destColumn._getSourceColumnName()
    - const sourceCol = columns[sourceColName]
    - // only use source if we still have access to it
    - const val = sourceColName && sourceCol ? this._getRowValueFromOriginalOrSource(sourceColName, sourceCol.getPrimitiveTypeName(), destColumn.getPrimitiveTypeName()) : this.getRowOriginalValue(colName)
    - const res = destColumn.getPrimitiveTypeObj().getAsNativeJavascriptType(val)
    - const mathFn = destColumn.getMathFn()
    - if (mathFn) return mathFn(res)
    - return res
    - }
    - _getRowValueFromOriginalOrSource(sourceColName, sourceColType, destType) {
    - return Column.convertValueToNumeric(this.getRowOriginalValue(sourceColName), sourceColType, destType)
    - }
    - rowToObjectWithOnlyNativeJavascriptTypes() {
    - if (!this._objectWithOnlyNativeJavascriptTypes) this._objectWithOnlyNativeJavascriptTypes = this._parseIntoObjectWithOnlyNativeJavascriptTypes()
    - return this._objectWithOnlyNativeJavascriptTypes
    - }
    - getRowKeys() {
    - return Object.keys(this.getRowSourceObject())
    - }
    - getFirstValue() {
    - return this.getRowOriginalValue(this.getRowKeys()[0])
    - }
    - // todo: get values from source/virtual columns
    - getRowOriginalValue(column) {
    - const value = this.getRowSourceObject()[column]
    - return value === null ? "" : value
    - }
    - getRowHtmlSafeValue(columnName) {
    - const val = this.getRowOriginalValue(columnName)
    - return val === undefined ? "" : jtree.Utils.stripHtml(val.toString()).toString() // todo: cache this?
    - }
    - getHoverTitle() {
    - return encodeURIComponent(this.rowToString().replace(/\n/g, " "))
    - }
    - getPuid() {
    - return this._puid
    - }
    - rowToString() {
    - return JSON.stringify(this.getRowSourceObject(), null, 2)
    - }
    - }
    - Row._uniqueId = 0
    - window.Row = Row
    - //onsave jtree build produce jtable.browser.js
    - //onsave jtree build produce jtable.node.js
    - var TableParserIds
    - ;(function(TableParserIds) {
    - TableParserIds["csv"] = "csv"
    - TableParserIds["ssv"] = "ssv"
    - TableParserIds["psv"] = "psv"
    - TableParserIds["tsv"] = "tsv"
    - TableParserIds["xml"] = "xml"
    - TableParserIds["html"] = "html"
    - TableParserIds["spaced"] = "spaced"
    - TableParserIds["tree"] = "tree"
    - TableParserIds["treeRows"] = "treeRows"
    - TableParserIds["sections"] = "sections"
    - TableParserIds["txt"] = "txt"
    - TableParserIds["list"] = "list"
    - TableParserIds["text"] = "text"
    - TableParserIds["jsonVector"] = "jsonVector"
    - TableParserIds["json"] = "json"
    - TableParserIds["jsonDataTableWithHeader"] = "jsonDataTableWithHeader"
    - TableParserIds["jsonMap"] = "jsonMap"
    - TableParserIds["jsonCounts"] = "jsonCounts"
    - })(TableParserIds || (TableParserIds = {}))
    - // todo: detect mixed format, like a csv file with a header. and then suggest ignore that part, or splitting it out?
    - // maybe we could split a string into sections, and say "we've detected 3 sections, which one do you want to use"?
    - // todo: split csv into normal csv and advanced delimited.
    - // todo: allow for metadata like filename and filetype header
    - class RowStringSpecimen {
    - constructor(str) {
    - const trimmedStr = str.trim()
    - const lines = trimmedStr.split(/\n/g)
    - const firstLine = lines[0]
    - const strCount = (str, reg) => (str.match(reg) || []).length
    - // todo: do these things lazily.
    - this.trimmedStr = trimmedStr
    - this.lines = lines
    - this.firstLine = firstLine
    - this.lineCount = lines.length
    - this.indentedLineCount = strCount(trimmedStr, /\n /g)
    - this.blankLineCount = strCount(trimmedStr, /\n\n/g)
    - this.commaCount = strCount(trimmedStr, /\,/g)
    - this.tabCount = strCount(trimmedStr, /\t/g)
    - this.verticalBarCount = strCount(trimmedStr, /\|/g)
    - this.firstLineCommaCount = strCount(firstLine, /\,/g)
    - this.firstLineTabCount = strCount(firstLine, /\t/g)
    - this.firstLineSpaceCount = strCount(firstLine, / /g)
    - this.firstLineVerticalBarCount = strCount(firstLine, /\|/g)
    - }
    - getParsedJsonAttemptResult() {
    - if (this._parsedJsonObject) return this._parsedJsonObject
    - try {
    - this._parsedJsonObject = { ok: true, result: JSON.parse(this.trimmedStr) }
    - } catch (err) {
    - this._parsedJsonObject = { ok: false }
    - }
    - return this._parsedJsonObject
    - }
    - }
    - class AbstractTableParser {
    - isNodeJs() {
    - return typeof exports !== "undefined"
    - }
    - }
    - class AbstractJsonParser extends AbstractTableParser {
    - getParserId() {
    - return TableParserIds.json
    - }
    - getProbForRowSpecimen(specimen) {
    - return 0
    - }
    - getExample() {
    - return JSON.stringify([{ name: "joe", age: 2 }, { name: "mike", age: 4 }])
    - }
    - _parseTableInputsFromString(str) {
    - const obj = JSON.parse(str)
    - return { rows: obj instanceof Array ? obj : [obj] }
    - }
    - }
    - class JsonParser extends AbstractJsonParser {}
    - class AbstractJsonArrayParser extends AbstractJsonParser {
    - getExample() {
    - return JSON.stringify([{ name: "jane", age: 33 }, { name: "bill", age: 25 }])
    - }
    - getProbForRowSpecimen(specimen) {
    - const str = specimen.trimmedStr
    - if (str.match(/^\s*\[/) && str.match(/\]\s*$/)) return 0.98
    - return 0
    - }
    - }
    - class JsonArrayParser extends AbstractJsonArrayParser {}
    - class JsonDataTableWithHeaderParser extends AbstractJsonArrayParser {
    - getExample() {
    - return JSON.stringify([["country", "income", "health", "population"], ["Afghanistan", 1925, "57.63", 32526562], ["Albania", 10620, "76", 2896679]])
    - }
    - _parseTableInputsFromString(str) {
    - return { rows: jtree.Utils.javascriptTableWithHeaderRowToObjects(JSON.parse(str)) }
    - }
    - getParserId() {
    - return TableParserIds.jsonDataTableWithHeader
    - }
    - getProbForRowSpecimen(specimen) {
    - const result = specimen.getParsedJsonAttemptResult()
    - if (!result.ok) return 0
    - if (JsonDataTableWithHeaderParser.isJavaScriptDataTable(result.result)) return 0.99
    - return 0.001
    - }
    - static isJavaScriptDataTable(obj) {
    - const isAnArray = obj instanceof Array
    - if (!isAnArray) return false
    - const isAnArrayOfArrays = obj.every(row => row instanceof Array)
    - if (!isAnArrayOfArrays) return false
    - if (obj.length < 3) return false
    - const firstRowTypes = obj[0].map(item => typeof item === "string").join(" ")
    - const secondRowTypes = obj[1].map(item => typeof item === "string").join(" ")
    - const thirdRowTypes = obj[2].map(item => typeof item === "string").join(" ")
    - const firstRowIsJustStrings = !firstRowTypes.replace(/true/g, "").trim()
    - if (secondRowTypes === thirdRowTypes && secondRowTypes !== firstRowTypes && firstRowIsJustStrings) return true
    - return false
    - }
    - }
    - class AbstractJsonObjectParser extends AbstractJsonParser {
    - getProbForRowSpecimen(specimen) {
    - const str = specimen.trimmedStr
    - if (str.match(/^\s*\{/) && str.match(/\}\s*$/)) return 0.99
    - return 0
    - }
    - }
    - class JsonObjectParser extends AbstractJsonObjectParser {}
    - // formerley flatobject
    - class JsonMapParser extends AbstractJsonObjectParser {
    - getExample() {
    - return JSON.stringify({ person1: { name: "joe", age: 2 }, person2: { name: "mike", age: 4 } })
    - }
    - getParserId() {
    - return TableParserIds.jsonMap
    - }
    - _parseTableInputsFromString(str) {
    - // todo: should we preserve keys?
    - return { rows: Object.values(JSON.parse(str)) }
    - }
    - }
    - // formerly flatarray
    - class JsonVectorParser extends AbstractJsonArrayParser {
    - getExample() {
    - return JSON.stringify([23, 32, 41])
    - }
    - getParserId() {
    - return TableParserIds.jsonVector
    - }
    - getProbForRowSpecimen(specimen) {
    - const result = specimen.getParsedJsonAttemptResult()
    - if (!result.ok) return 0
    - if (!(result.result instanceof Array)) return 0
    - return result.result.filter(item => item && typeof item === "object" && item.hasOwnProperty).length === 0 ? 1 : 0
    - return 0
    - }
    - _parseTableInputsFromString(str) {
    - return {
    - rows: JSON.parse(str).map(num => {
    - return { value: num }
    - })
    - }
    - }
    - }
    - class JsonCountMapParser extends AbstractJsonObjectParser {
    - getParserId() {
    - return TableParserIds.jsonCounts
    - }
    - getProbForRowSpecimen(specimen) {
    - const result = specimen.getParsedJsonAttemptResult()
    - if (!result.ok) return 0
    - const keys = Object.keys(result.result)
    - if (keys.length < 2) return 0
    - return !keys.some(key => typeof result.result[key] !== "number") ? 1 : 0
    - return 0
    - }
    - getExample() {
    - return JSON.stringify({ h1: 10, h2: 5, h3: 2 })
    - }
    - _parseTableInputsFromString(str) {
    - const obj = JSON.parse(str)
    - return {
    - rows: Object.keys(obj).map(key => {
    - return {
    - name: key,
    - count: obj[key]
    - }
    - })
    - }
    - }
    - }
    - // todo: remove?
    - class AbstractJTreeTableParser extends AbstractTableParser {
    - _parseTableInputsFromString(str) {
    - return {
    - rows: this._parseTrees(str)
    - .filter(node => node.length)
    - .map(node => node.toObject())
    - }
    - }
    - _parseTrees(str) {
    - return []
    - }
    - }
    - class CsvParser extends AbstractJTreeTableParser {
    - getExample() {
    - return `name,age,height
    - john,12,50`
    - }
    - _parseTrees(str) {
    - return jtree.TreeNode.fromCsv(str)
    - }
    - getProbForRowSpecimen(specimen) {
    - if (!specimen.firstLineCommaCount) return 0
    - if (specimen.blankLineCount) return 0.05
    - return 0.49
    - }
    - getParserId() {
    - return TableParserIds.csv
    - }
    - }
    - class TsvParser extends AbstractJTreeTableParser {
    - getExample() {
    - return `name\tage\theight
    - john\t12\t50`
    - }
    - _parseTrees(str) {
    - return jtree.TreeNode.fromTsv(str)
    - }
    - getProbForRowSpecimen(specimen) {
    - if (!specimen.firstLineTabCount) return 0
    - else if (specimen.tabCount > 5) return 0.9
    - return 0.25
    - }
    - getParserId() {
    - return TableParserIds.tsv
    - }
    - }
    - class PsvParser extends AbstractJTreeTableParser {
    - getParserId() {
    - return TableParserIds.psv
    - }
    - getExample() {
    - return `name|age
    - mike|33`
    - }
    - _parseTrees(str) {
    - return jtree.TreeNode.fromDelimited(str, "|", '"')
    - }
    - getProbForRowSpecimen(specimen) {
    - // vertical bar separated file
    - if (!specimen.firstLineVerticalBarCount) return 0
    - else if (specimen.verticalBarCount >= specimen.lineCount) return 0.8
    - return 0.01
    - }
    - }
    - class SsvParser extends AbstractJTreeTableParser {
    - getExample() {
    - return `name age height
    - john 12 50`
    - }
    - getParserId() {
    - return TableParserIds.ssv
    - }
    - _parseTrees(str) {
    - return jtree.TreeNode.fromSsv(str)
    - }
    - getProbForRowSpecimen(specimen) {
    - if (!specimen.firstLineSpaceCount) return 0
    - if (specimen.blankLineCount) return 0.05
    - return 0.11
    - }
    - }
    - class XmlParser extends AbstractJTreeTableParser {
    - getProbForRowSpecimen(specimen) {
    - return specimen.trimmedStr.match(/^ *\
    - }
    - getExample() {
    - return `
    - bob32`
    - }
    - getParserId() {
    - return TableParserIds.xml
    - }
    - _parseTrees(str) {
    - // todo: fix this! Create an XML Tree Language
    - if (this.isNodeJs()) return new jtree.TreeNode(str)
    - return jtree.TreeNode.fromXml(str)
    - }
    - }
    - class HtmlParser extends AbstractJTreeTableParser {
    - getProbForRowSpecimen(specimen) {
    - return specimen.trimmedStr.match(/^(\<\!doctype html\>|\
    - }
    - getExample() {
    - return `
    -
    - bam`
    - }
    - getParserId() {
    - return TableParserIds.html
    - }
    - _parseTrees(str) {
    - if (this.isNodeJs()) return new jtree.TreeNode(str)
    - return jtree.TreeNode.fromXml(str)
    - }
    - }
    - class TreeRowsParser extends AbstractJTreeTableParser {
    - getExample() {
    - return `person
    - name john
    - age 12
    - height 50`
    - }
    - _parseTableInputsFromString(str) {
    - // todo: get columns on first pass.
    - const rows = new jtree.TreeNode(str)
    - return {
    - rows: rows.map(node => node.toObject()),
    - columnDefinitions: rows.getColumnNames().map(name => {
    - return { name: name }
    - })
    - }
    - }
    - getProbForRowSpecimen(specimen) {
    - if (specimen.indentedLineCount < 1) return 0
    - return 0.1
    - }
    - getParserId() {
    - return TableParserIds.treeRows
    - }
    - }
    - class TreeParser extends AbstractJTreeTableParser {
    - getExample() {
    - return `country
    - name USA
    - state
    - name MA
    - city
    - name Brockton`
    - }
    - _parseTrees(str) {
    - // todo: add tests. Detected value(s) or undefined subtrees, treating as object.
    - const newTree = new jtree.TreeNode()
    - newTree.pushContentAndChildren(undefined, str instanceof jtree.TreeNode ? str : new jtree.TreeNode(str))
    - return newTree
    - }
    - getProbForRowSpecimen(specimen) {
    - return 0
    - }
    - getParserId() {
    - return TableParserIds.tree
    - }
    - }
    - class SpacedParser extends AbstractTableParser {
    - getExample() {
    - return `name john
    - age 12
    -
    - name mary
    - age 20`
    - }
    - getParserId() {
    - return TableParserIds.spaced
    - }
    - getProbForRowSpecimen(specimen) {
    - if (specimen.blankLineCount > 10) return 0.95
    - return 0.05
    - }
    - _parseTableInputsFromString(str) {
    - // todo: clean this up. it looks like this is just trees, but not indented, with a newline as a delimiter.
    - const headerBreak = str.indexOf("\n\n")
    - const header = str.substr(0, headerBreak)
    - let names = header.split(/\n/g)
    - const rest = str
    - .substr(headerBreak + 2)
    - .replace(/\n\n/g, "\n")
    - .trim()
    - .split("\n")
    - const nodeCount = names.length
    - const lineCount = rest.length
    - const rows = []
    - // todo: should we do this here?
    - names = names.map(name => name.replace(/ /g, ""))
    - for (let lineNumber = 0; lineNumber < lineCount; lineNumber = lineNumber + nodeCount) {
    - const obj = {}
    - names.forEach((col, index) => {
    - obj[col] = rest[lineNumber + index].trim()
    - })
    - rows.push(obj)
    - }
    - return { rows: rows }
    - }
    - }
    - class SectionsParser extends AbstractTableParser {
    - getExample() {
    - return `name
    - age
    -
    - john
    - 12
    -
    - mary
    - 20`
    - }
    - getProbForRowSpecimen() {
    - return 0
    - }
    - getParserId() {
    - return TableParserIds.sections
    - }
    - _parseTableInputsFromString(str) {
    - const firstDoubleNewline = str.indexOf("\n\n")
    - const tiles = [str.slice(0, firstDoubleNewline), str.slice(firstDoubleNewline + 1)]
    - const header = tiles.shift()
    - const names = header.split(/\n/g)
    - const length = names.length
    - const lines = tiles[0].trim().split(/\n/g)
    - const lineCount = lines.length
    - const rowCount = lineCount / length
    - const rows = []
    - for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
    - const startLine = rowIndex * length
    - const values = lines.slice(startLine, startLine + length)
    - const obj = {}
    - names.forEach((name, colIndex) => (obj[name] = values[colIndex]))
    - rows.push(obj)
    - }
    - return { rows: rows }
    - }
    - }
    - class ListParser extends AbstractTableParser {
    - getExample() {
    - return `john doe
    - frank jones`
    - }
    - getProbForRowSpecimen() {
    - return 0
    - }
    - getParserId() {
    - return TableParserIds.list
    - }
    - _parseTableInputsFromString(str) {
    - return {
    - rows: str.split(/\n/g).map((line, index) => {
    - return {
    - index: index,
    - name: line
    - }
    - })
    - }
    - }
    - }
    - class TextListParser extends ListParser {
    - getParserId() {
    - return TableParserIds.txt
    - }
    - }
    - class TextParser extends AbstractTableParser {
    - getParserId() {
    - return TableParserIds.text
    - }
    - getExample() {
    - return "hello world"
    - }
    - getProbForRowSpecimen(specimen) {
    - if (specimen.blankLineCount) return 0.12
    - return 0.05
    - }
    - _parseTableInputsFromString(str) {
    - return { rows: [{ text: str }] }
    - }
    - }
    - class TableParser {
    - constructor() {
    - this._parsers = [
    - new CsvParser(),
    - new TsvParser(),
    - new SsvParser(),
    - new PsvParser(),
    - new TreeRowsParser(),
    - new TreeParser(),
    - new XmlParser(),
    - new HtmlParser(),
    - new TextParser(),
    - new SectionsParser(),
    - new SpacedParser(),
    - new ListParser(),
    - new TextListParser(),
    - new JsonParser(),
    - new JsonArrayParser(),
    - new JsonDataTableWithHeaderParser(),
    - new JsonVectorParser(),
    - new JsonMapParser(),
    - new JsonCountMapParser()
    - ]
    - this._parserMap = {}
    - this._parsers.forEach(parser => {
    - const name = parser.getParserId()
    - if (!name) return // only allow leafs to be used as names?
    - this._parserMap[name] = parser
    - })
    - }
    - getAllParsers() {
    - return this._getParsersArray()
    - }
    - getAllTableParserIds() {
    - return Object.keys(this._getParserMap())
    - }
    - getExample(parserId) {
    - return this._getParser(parserId).getExample()
    - }
    - _getParser(parserId) {
    - const options = this._getParserMap()
    - return options[parserId] || options.text // todo: surface an error.
    - }
    - _getParserMap() {
    - return this._parserMap
    - }
    - _getParsersArray() {
    - return this._parsers
    - }
    - // todo: remove this?
    - parseTableInputsFromObject(data, parserId) {
    - if (data instanceof Array) {
    - if (JsonDataTableWithHeaderParser.isJavaScriptDataTable(data)) return { rows: jtree.Utils.javascriptTableWithHeaderRowToObjects(data) }
    - // test to see if it's primitives
    - if (typeof data[0] === "object") return { rows: data }
    - return { rows: data.map(row => (typeof row === "object" ? row : { value: row })) }
    - } else if (parserId === TableParserIds.jsonMap) return { rows: Object.values(data) }
    - return { rows: [data] }
    - }
    - // todo: should this be inferAndParse? or 2 methods? parse and inferAndParse?
    - parseTableInputsFromString(str = "", parserId) {
    - str = str.trim() // Remove empty lines at end of string, which seem to be common.
    - if (!str) return { rows: [] }
    - parserId = parserId || this.guessTableParserId(str)
    - try {
    - return this._getParser(parserId)._parseTableInputsFromString(str)
    - } catch (err) {
    - console.error(err)
    - const snippet = str.substr(0, 30).replace(/[\n\r]/g, " ")
    - throw new Error(`Failed parsing string '${snippet}...' using parser '${parserId}'`)
    - }
    - }
    - guessProbabilitiesForAllTableParsers(str) {
    - const parsers = this._getParsersArray()
    - const length = parsers.length
    - const probabilities = {}
    - const specimen = new RowStringSpecimen(str)
    - for (let index = 0; index < parsers.length; index++) {
    - const parser = parsers[index]
    - const probability = parser.getProbForRowSpecimen(specimen)
    - const name = parser.getParserId()
    - if (probability === 1) {
    - const exact = {}
    - exact[name] = 1
    - return exact
    - }
    - probabilities[name] = probability
    - }
    - return probabilities
    - }
    - guessTableParserId(str) {
    - const probabilities = this.guessProbabilitiesForAllTableParsers(str)
    - let maxScore = 0
    - let bestGuess = null
    - for (let option in probabilities) {
    - if (probabilities[option] > maxScore) {
    - maxScore = probabilities[option]
    - bestGuess = option
    - }
    - }
    - return bestGuess
    - }
    - }
    - window.TableParser = TableParser
    - const DummyDataSets = {
    - flowPrograms: [
    - ["filename", "bytes", "link"],
    - [
    - "hello.flow",
    - `samples.iris
    - tables.basic`,
    - ""
    - ]
    - ],
    - amazonPurchases: [
    - ["OrderDate", "Title", "Category", "ItemTotal"],
    - [1329386400000, "3D Math Primer for Graphics and Game Development (Wordware Game Math Library)", "Paperback", "26.2"],
    - [1261735200000, "A Mathematician Reads the Newspaper", "Paperback", "1.19"],
    - [1447840800000, "A Most Incomprehensible Thing: Notes Towards a Very Gentle Introduction to the Mathematics of Relativity", "Paperback", "14.63"],
    - [1464429600000, "From Mathematics to Generic Programming", "Paperback", "34.37"],
    - [1268215200000, "Innumeracy: Mathematical Illiteracy and Its Consequences", "Paperback", "9.89"],
    - [1268215200000, "Irreligion: A Mathematician Explains Why the Arguments for God Just Don't Add Up", "Paperback", "9.89"],
    - [1379844000000, "Mathematics and the Imagination", "Paperback", "5.3"],
    - [1410688800000, "Medical Math (Laminated Reference Guide; Quick Study Academic)", "Pamphlet", "3.78"],
    - [1268215200000, "Once Upon A Number: The Hidden Mathematical Logic Of Stories", "Paperback", "14.35"],
    - [1408528800000, "The Language of Mathematics: Making the Invisible Visible", "Paperback", "18.37"]
    - ],
    - waterBill: [
    - ["Amount", "PaidOn", "Gallons"],
    - ["$64.86", "1/10/2018", 2087],
    - ["$73.32", "1/28/2018", 2451],
    - ["$62.65", "2/26/2018", 1968],
    - ["$71.51", "3/25/2018", 2365],
    - ["$65.03", "4/23/2018", 2075],
    - ["$81.39", "5/15/2018", 2757],
    - ["$65.01", "6/15/2018", 2047],
    - ["$93.09", "7/10/2018", 3051],
    - ["$196.58", "8/25/2018", 7309],
    - ["$130.68", "9/10/2018", 4597],
    - ["$55.03", "10/14/2018", 1484],
    - ["$63.44", "11/7/2018", 1967],
    - ["$71.88", "12/12/2018", 2335],
    - ["$53.18", "2/3/2019", 1483],
    - ["$52.05", "3/8/2019", 1429],
    - ["$54.73", "4/28/2019", 1544]
    - ],
    - gapMinder: [
    - ["country", "income", "health", "population"],
    - ["Afghanistan", 1925, "57.63", 32526562],
    - ["Albania", 10620, "76", 2896679],
    - ["Algeria", 13434, "76.5", 39666519],
    - ["Andorra", 46577, "84.1", 70473],
    - ["Angola", 7615, "61", 25021974],
    - ["Antigua and Barbuda", 21049, "75.2", 91818],
    - ["Argentina", 17344, "76.2", 43416755],
    - ["Armenia", 7763, "74.4", 3017712],
    - ["Australia", 44056, "81.8", 23968973],
    - ["Austria", 44401, "81", 8544586],
    - ["Azerbaijan", 16986, "72.9", 9753968],
    - ["Bahamas", 22818, "72.3", 388019],
    - ["Bahrain", 44138, "79.2", 1377237],
    - ["Bangladesh", 3161, "70.1", 160995642],
    - ["Barbados", 12984, "75.8", 284215],
    - ["Belarus", 17415, "70.4", 9495826],
    - ["Belgium", 41240, "80.4", 11299192],
    - ["Belize", 8501, "70", 359287],
    - ["Benin", 1830, "65.5", 10879829],
    - ["Bhutan", 7983, "70.2", 774830],
    - ["Bolivia", 6295, "72.3", 10724705],
    - ["Bosnia and Herzegovina", 9833, "77.9", 3810416],
    - ["Botswana", 17196, "66.4", 2262485],
    - ["Brazil", 15441, "75.6", 207847528],
    - ["Brunei", 73003, "78.7", 423188],
    - ["Bulgaria", 16371, "74.9", 7149787],
    - ["Burkina Faso", 1654, "62.8", 18105570],
    - ["Burundi", 777, "60.4", 11178921],
    - ["Cambodia", 3267, "68.4", 15577899],
    - ["Cameroon", 2897, "59.5", 23344179],
    - ["Canada", 43294, "81.7", 35939927],
    - ["Cape Verde", 6514, "74.6", 520502],
    - ["Central African Republic", 599, "53.8", 4900274],
    - ["Chad", 2191, "57.7", 14037472],
    - ["Chile", 22465, "79.3", 17948141],
    - ["China", 13334, "76.9", 1376048943],
    - ["Colombia", 12761, "75.8", 48228704],
    - ["Comoros", 1472, "64.1", 788474],
    - ["Congo, Dem. Rep.", 809, "58.3", 77266814],
    - ["Congo, Rep.", 6220, "61.9", 4620330],
    - ["Costa Rica", 14132, "80", 4807850],
    - ["Cote d'Ivoire", 3491, "60.33", 22701556],
    - ["Croatia", 20260, "78", 4240317],
    - ["Cuba", 21291, "78.5", 11389562],
    - ["Cyprus", 29797, "82.6", 1165300],
    - ["Czech Republic", 29437, "78.6", 10543186],
    - ["Denmark", 43495, "80.1", 5669081],
    - ["Djibouti", 3139, "64.63", 887861],
    - ["Dominica", 10503, "74.6", 72680],
    - ["Dominican Republic", 12837, "73.8", 10528391],
    - ["Ecuador", 10996, "75.2", 16144363],
    - ["Egypt", 11031, "71.3", 91508084],
    - ["El Salvador", 7776, "74.1", 6126583],
    - ["Equatorial Guinea", 31087, "60.63", 845060],
    - ["Eritrea", 1129, "62.9", 5227791],
    - ["Estonia", 26812, "76.8", 1312558],
    - ["Ethiopia", 1520, "63.6", 99390750],
    - ["Fiji", 7925, "66.3", 892145],
    - ["Finland", 38923, "80.8", 5503457],
    - ["France", 37599, "81.9", 64395345],
    - ["Gabon", 18627, "60.53", 1725292],
    - ["Gambia", 1644, "65.1", 1990924],
    - ["Georgia", 7474, "73.3", 3999812],
    - ["Germany", 44053, "81.1", 80688545],
    - ["Ghana", 4099, "65.5", 27409893],
    - ["Greece", 25430, "79.8", 10954617],
    - ["Grenada", 11593, "71.7", 106825],
    - ["Guatemala", 7279, "73.1", 16342897],
    - ["Guinea", 1225, "60.8", 12608590],
    - ["Guinea-Bissau", 1386, "53.4", 1844325],
    - ["Guyana", 6816, "64.4", 767085],
    - ["Haiti", 1710, "65.3", 10711067],
    - ["Honduras", 4270, "72.4", 8075060],
    - ["Hungary", 24200, "76.2", 9855023],
    - ["Iceland", 42182, "82.8", 329425],
    - ["India", 5903, "66.8", 1311050527],
    - ["Indonesia", 10504, "70.9", 257563815],
    - ["Iran", 15573, "78.5", 79109272],
    - ["Iraq", 14646, "72.1", 36423395],
    - ["Ireland", 47758, "80.4", 4688465],
    - ["Israel", 31590, "82.4", 8064036],
    - ["Italy", 33297, "82.1", 59797685],
    - ["Jamaica", 8606, "75.5", 2793335],
    - ["Japan", 36162, "83.5", 126573481],
    - ["Jordan", 11752, "78.3", 7594547],
    - ["Kazakhstan", 23468, "68.2", 17625226],
    - ["Kenya", 2898, "66.63", 46050302],
    - ["Kiribati", 1824, "62.4", 112423],
    - ["Kuwait", 82633, "80.7", 3892115],
    - ["Kyrgyz Republic", 3245, "69", 5939962],
    - ["Lao", 5212, "66.4", 6802023],
    - ["Latvia", 23282, "75.7", 1970503],
    - ["Lebanon", 17050, "78.5", 5850743],
    - ["Lesotho", 2598, "48.5", 2135022],
    - ["Liberia", 958, "63.9", 4503438],
    - ["Libya", 17261, "76.2", 6278438],
    - ["Lithuania", 26665, "75.4", 2878405],
    - ["Luxembourg", 88314, "81.1", 567110],
    - ["Macedonia, FYR", 12547, "77", 2078453],
    - ["Madagascar", 1400, "64.7", 24235390],
    - ["Malawi", 799, "60.22", 17215232],
    - ["Malaysia", 24320, "75.1", 30331007],
    - ["Maldives", 14408, "79.5", 363657],
    - ["Mali", 1684, "57.6", 17599694],
    - ["Malta", 30265, "82.1", 418670],
    - ["Marshall Islands", 3661, "65.1", 52993],
    - ["Mauritania", 3877, "65.7", 4067564],
    - ["Mauritius", 18350, "73.9", 1273212],
    - ["Mexico", 16850, "74.5", 127017224],
    - ["Micronesia, Fed. Sts.", 3510, "67", 104460],
    - ["Moldova", 4896, "72.7", 4068897],
    - ["Mongolia", 11819, "65.3", 2959134],
    - ["Montenegro", 14833, "75.8", 625781],
    - ["Morocco", 7319, "74.7", 34377511],
    - ["Mozambique", 1176, "56.4", 27977863],
    - ["Myanmar", 4012, "67.9", 53897154],
    - ["Namibia", 10040, "61", 2458830],
    - ["Nepal", 2352, "71.2", 28513700],
    - ["Netherlands", 45784, "80.6", 16924929],
    - ["New Zealand", 34186, "80.6", 4528526],
    - ["Nicaragua", 4712, "76.8", 6082032],
    - ["Niger", 943, "62.2", 19899120],
    - ["Nigeria", 5727, "61.33", 182201962],
    - ["North Korea", 1390, "71.4", 25155317],
    - ["Norway", 64304, "81.6", 5210967],
    - ["Oman", 48226, "75.7", 4490541],
    - ["Pakistan", 4743, "66.5", 188924874],
    - ["Panama", 20485, "78.2", 3929141],
    - ["Papua New Guinea", 2529, "60.6", 7619321],
    - ["Paraguay", 8219, "73.9", 6639123],
    - ["Peru", 11903, "77.5", 31376670],
    - ["Philippines", 6876, "70.2", 100699395],
    - ["Poland", 24787, "77.3", 38611794],
    - ["Portugal", 26437, "79.8", 10349803],
    - ["Qatar", 132877, "82", 2235355],
    - ["Romania", 19203, "76.8", 19511324],
    - ["Russia", 23038, "73.13", 143456918],
    - ["Rwanda", 1549, "66.53", 11609666],
    - ["Samoa", 5558, "72.2", 193228],
    - ["Sao Tome and Principe", 3003, "68.8", 190344],
    - ["Saudi Arabia", 52469, "78.1", 31540372],
    - ["Senegal", 2251, "66.1", 15129273],
    - ["Serbia", 12908, "78.1", 8850975],
    - ["Seychelles", 25684, "73.7", 96471],
    - ["Sierra Leone", 2085, "58.5", 6453184],
    - ["Singapore", 80794, "82.1", 5603740],
    - ["Slovak Republic", 27204, "76.4", 5426258],
    - ["Slovenia", 28550, "80.2", 2067526],
    - ["Solomon Islands", 2047, "64.1", 583591],
    - ["Somalia", 624, "58.7", 10787104],
    - ["South Africa", 12509, "63.72", 54490406],
    - ["South Korea", 34644, "80.7", 50293439],
    - ["South Sudan", 3047, "58", 12339812],
    - ["Spain", 32979, "81.7", 46121699],
    - ["Sri Lanka", 10624, "76.5", 20715010],
    - ["St. Lucia", 9997, "74.5", 184999],
    - ["St. Vincent and the Grenadines", 10435, "72.9", 109462],
    - ["Sudan", 3975, "69.5", 40234882],
    - ["Suriname", 17125, "70.5", 542975],
    - ["Swaziland", 6095, "51.5", 1286970],
    - ["Sweden", 44892, "82", 9779426],
    - ["Switzerland", 56118, "82.9", 8298663],
    - ["Syria", 4637, "70.26", 18502413],
    - ["Tajikistan", 2582, "71", 8481855],
    - ["Tanzania", 2571, "63.43", 53470420],
    - ["Thailand", 14512, "75.1", 67959359],
    - ["Timor-Leste", 2086, "72.4", 1184765],
    - ["Togo", 1433, "64.23", 7304578],
    - ["Tonga", 5069, "70.5", 106170],
    - ["Trinidad and Tobago", 30113, "71.4", 1360088],
    - ["Tunisia", 11126, "77.3", 11253554],
    - ["Turkey", 19360, "76.5", 78665830],
    - ["Turkmenistan", 15865, "67.9", 5373502],
    - ["Uganda", 1680, "60.8", 39032383],
    - ["Ukraine", 8449, "72.1", 44823765],
    - ["United Arab Emirates", 60749, "76.6", 9156963],
    - ["United Kingdom", 38225, "81.4", 64715810],
    - ["United States", 53354, "79.1", 321773631],
    - ["Uruguay", 20438, "77.3", 3431555],
    - ["Uzbekistan", 5598, "70.1", 29893488],
    - ["Vanuatu", 2912, "65", 264652],
    - ["Venezuela", 15753, "75.8", 31108083],
    - ["Vietnam", 5623, "76.5", 93447601],
    - ["West Bank and Gaza", 4319, "75.2", 4668466],
    - ["Yemen", 3887, "67.6", 26832215],
    - ["Zambia", 4034, "58.96", 16211767],
    - ["Zimbabwe", 1801, "60.01", 15602751]
    - ],
    - emojis: [["animal", "count"], ["🐄", 9], ["🐖", 12], ["🐏", 3]],
    - telescopes: [
    - ["Name", "Type", "Url", "Location", "OperatedBy", "FundedBy"],
    - ["Hubble Space Telescope", "Space Telescope", "https://en.wikipedia.org/wiki/Hubble_Space_Telescope", "Space", "NASA", "NASA"],
    - ["LIGO Hanford", "Gravity Wave Observatory", "https://www.ligo.caltech.edu/WA", "Richland, WA, USA", "Caltech", "National Science Foundation"],
    - ["LIGO Livingston", "Gravity Wave Observatory", "https://www.ligo.caltech.edu/LA", "Livingston, LA, USA", "MIT", "National Science Foundation"],
    - [
    - "Gran Telescopio Canarias (GTC)",
    - "Astronomical Observatory",
    - "http://www.gtc.iac.es/gtc/gtc.php",
    - "La Palma, Garafía, Spain ",
    - "IAC",
    - "Observatorio Astronómico de Canarias, National Autonomous University of Mexico, University of Florida Edit this on Wikidata"
    - ],
    - [
    - "Hobby–Eberly Telescope",
    - "Astronomical Observatory",
    - "http://mcdonaldobservatory.org/research/telescopes/HET",
    - "Davis Mountains, Texas, US",
    - "Stanford University & Ludwig Maximilians University of Munich and Georg August University of Göttingen",
    - "YarCom Inc. and the Lott family "
    - ]
    - ],
    - markdown: [
    - ["text"],
    - [
    - `# My header
    - ## My subheader
    - Hello world`
    - ]
    - ],
    - webPages: [["name", "url"]],
    - outerSpace: [
    - ["text"],
    - [
    - `universe
    - galaxies
    - milkyWay
    - solarSystems
    - solarSystem
    - stars
    - sun
    - planets
    - mercury
    - venus
    - earth
    - moons
    - moon
    - mars
    - jupiter
    - saturn
    - uranus
    - neptune
    - pluto`
    - ]
    - ],
    - wordCounts: [
    - ["word", "count"],
    - ["Two", 2],
    - ["roads", 2],
    - ["diverged", 2],
    - ["in", 3],
    - ["a", 3],
    - ["yellow", 1],
    - ["wood", 2],
    - ["And", 6],
    - ["sorry", 1],
    - ["I", 9],
    - ["could", 2],
    - ["not", 1],
    - ["travel", 1],
    - ["both", 2],
    - ["be", 2],
    - ["one", 3],
    - ["traveler", 1],
    - ["long", 1],
    - ["stood", 1],
    - ["looked", 1]
    - ],
    - treeProgram: [
    - ["source"],
    - [
    - `samples.iris
    - group.by Species
    - tables.basic
    - columns.first 3`
    - ]
    - ],
    - poem: [
    - ["text"],
    - [
    - `Two roads diverged in a yellow wood,
    - And sorry I could not travel both
    - And be one traveler, long I stood
    - And looked down one as far as I could
    - To where it bent in the undergrowth;
    -
    - Then took the other, as just as fair,
    - And having perhaps the better claim,
    - Because it was grassy and wanted wear;
    - Though as for that the passing there
    - Had worn them really about the same,
    -
    - And both that morning equally lay
    - In leaves no step had trodden black.
    - Oh, I kept the first for another day!
    - Yet knowing how way leads on to way,
    - I doubted if I should ever come back.
    -
    - I shall be telling this with a sigh
    - Somewhere ages and ages hence:
    - Two roads diverged in a wood, and I—
    - I took the one less traveled by,
    - And that has made all the difference.`
    - ]
    - ],
    - playerGoals: [["PlayerGoals", "Goals"], ["Player1", 11], ["Player2", 2], ["Player3", 2], ["Player4", 2], ["Player5", 7]],
    - patients: [["Patient", "Gender", "Weight"], ["Patient1", "Girl", "3.31"], ["Patient2", "Male", "2.8"], ["Patient3", "Male", "3.7"], ["Patient4", "Girl", "2.5"], ["Patient5", "Girl", "2.8"]],
    - regionalMarkets: [
    - ["Location", "Parent", "Market trade volume (size)", "Market increase/decrease (color)"],
    - ["Global", null, 0, 0],
    - ["America", "Global", 0, 0],
    - ["Europe", "Global", 0, 0],
    - ["Asia", "Global", 0, 0],
    - ["Australia", "Global", 0, 0],
    - ["Africa", "Global", 0, 0],
    - ["Brazil", "America", 11, 10],
    - ["USA", "America", 52, 31],
    - ["Mexico", "America", 24, 12],
    - ["Canada", "America", 16, -23],
    - ["France", "Europe", 42, -11],
    - ["Germany", "Europe", 31, -2],
    - ["Sweden", "Europe", 22, -13],
    - ["Italy", "Europe", 17, 4],
    - ["UK", "Europe", 21, -5],
    - ["China", "Asia", 36, 4],
    - ["Japan", "Asia", 20, -12],
    - ["India", "Asia", 40, 63],
    - ["Laos", "Asia", 4, 34],
    - ["Mongolia", "Asia", 1, -5],
    - ["Israel", "Asia", 12, 24],
    - ["Iran", "Asia", 18, 13],
    - ["Pakistan", "Asia", 11, -52],
    - ["Egypt", "Africa", 21, 0],
    - ["S. Africa", "Africa", 30, 43],
    - ["Sudan", "Africa", 12, 2],
    - ["Congo", "Africa", 10, 12],
    - ["Zaire", "Africa", 8, 10]
    - ],
    - stockPrice: [
    - ["Step", "Price"],
    - [0, 0],
    - [1, 10],
    - [2, 23],
    - [3, 17],
    - [4, 18],
    - [5, 9],
    - [6, 11],
    - [7, 27],
    - [8, 33],
    - [9, 40],
    - [10, 32],
    - [11, 35],
    - [12, 30],
    - [13, 40],
    - [14, 42],
    - [15, 47],
    - [16, 44],
    - [17, 48],
    - [18, 52],
    - [19, 54],
    - [20, 42],
    - [21, 55],
    - [22, 56],
    - [23, 57],
    - [24, 60],
    - [25, 50],
    - [26, 52],
    - [27, 51],
    - [28, 49],
    - [29, 53],
    - [30, 55],
    - [31, 60],
    - [32, 61],
    - [33, 59],
    - [34, 62],
    - [35, 65],
    - [36, 62],
    - [37, 58],
    - [38, 55],
    - [39, 61],
    - [40, 64],
    - [41, 65],
    - [42, 63],
    - [43, 66],
    - [44, 67],
    - [45, 69],
    - [46, 69],
    - [47, 70],
    - [48, 72],
    - [49, 68],
    - [50, 66],
    - [51, 65],
    - [52, 67],
    - [53, 70],
    - [54, 71],
    - [55, 72],
    - [56, 73],
    - [57, 75],
    - [58, 70],
    - [59, 68],
    - [60, 64],
    - [61, 60],
    - [62, 65],
    - [63, 67],
    - [64, 68],
    - [65, 69],
    - [66, 70],
    - [67, 72],
    - [68, 75],
    - [69, 80]
    - ]
    - }
    - window.DummyDataSets = DummyDataSets
    - //onsave jtree build produce jtable.browser.js
    - //onsave jtree build produce jtable.node.js
    - class PivotTable {
    - constructor(rows, inputColumns, outputColumns) {
    - this._columns = {}
    - this._rows = rows
    - inputColumns.forEach(col => (this._columns[col.name] = col))
    - outputColumns.forEach(col => (this._columns[col.name] = col))
    - }
    - _getGroups(allRows, groupByColNames) {
    - const rowsInGroups = new Map()
    - allRows.forEach(row => {
    - const groupKey = groupByColNames.map(col => row[col].toString().replace(/ /g, "")).join(" ")
    - if (!rowsInGroups.has(groupKey)) rowsInGroups.set(groupKey, [])
    - rowsInGroups.get(groupKey).push(row)
    - })
    - return rowsInGroups
    - }
    - getNewRows(groupByCols) {
    - // make new trees
    - const rowsInGroups = this._getGroups(this._rows, groupByCols)
    - // Any column in the group should be reused by the children
    - const columns = [
    - {
    - name: "count",
    - type: "number",
    - min: 0
    - }
    - ]
    - groupByCols.forEach(colName => columns.push(this._columns[colName]))
    - const colsToReduce = Object.values(this._columns).filter(col => !!col.reduction)
    - colsToReduce.forEach(col => columns.push(col))
    - // for each group
    - const newRows = []
    - const totalGroups = rowsInGroups.size
    - for (let [groupId, group] of rowsInGroups) {
    - const firstRow = group[0]
    - const newRow = {}
    - groupByCols.forEach(col => {
    - newRow[col] = firstRow ? firstRow[col] : 0
    - })
    - newRow.count = group.length
    - // todo: add more reductions? count, stddev, median, variance.
    - colsToReduce.forEach(col => {
    - const sourceColName = col.source
    - const values = group.map(row => row[sourceColName]).filter(val => typeof val === "number" && !isNaN(val))
    - const reduction = col.reduction
    - let reducedValue = firstRow[sourceColName]
    - if (reduction === "sum") reducedValue = values.reduce((prev, current) => prev + current, 0)
    - if (reduction === "max") reducedValue = Math.max(...values)
    - if (reduction === "min") reducedValue = Math.min(...values)
    - if (reduction === "mean") reducedValue = values.reduce((prev, current) => prev + current, 0) / values.length
    - newRow[col.name] = reducedValue
    - })
    - newRows.push(newRow)
    - }
    - // todo: add tests. figure out this api better.
    - Object.values(columns).forEach(col => {
    - // For pivot columns, remove the source and reduction info for now. Treat things as immutable.
    - delete col.source
    - delete col.reduction
    - })
    - return {
    - rows: newRows,
    - columns
    - }
    - }
    - }
    - var ComparisonOperators
    - ;(function(ComparisonOperators) {
    - ComparisonOperators["lessThan"] = "<"
    - ComparisonOperators["greaterThan"] = ">"
    - ComparisonOperators["lessThanOrEqual"] = "<="
    - ComparisonOperators["greaterThanOrEqual"] = ">="
    - ComparisonOperators["equal"] = "="
    - ComparisonOperators["notEqual"] = "!="
    - })(ComparisonOperators || (ComparisonOperators = {}))
    - // todo: remove detectAndAddParam?
    - // todo: remove rowclass param?
    - class Table {
    - constructor(rowsArray = [], columnsArrayOrMap = [], rowClass = Row, detectAndAddColumns = true, samplingSeed = Date.now()) {
    - this._columnsMap = {}
    - this._ctime = new jtree.TreeNode()._getProcessTimeInMilliseconds()
    - this._tableId = this._getUniqueId()
    - this._samplingSeed = samplingSeed
    - // if this is ALREADY CARDS, should we be a view?
    - this._rows = rowsArray.map(source => (source instanceof Row ? source : new rowClass(source, this)))
    - // Add detected columns first, so they can be overwritten
    - if (detectAndAddColumns) this._getDetectedColumnNames().forEach(col => this._registerColumn({ name: col }))
    - if (Array.isArray(columnsArrayOrMap)) columnsArrayOrMap.forEach(col => this._registerColumn(col))
    - else if (columnsArrayOrMap) this._columnsMap = columnsArrayOrMap
    - }
    - _getUniqueId() {
    - Table._uniqueId++
    - return Table._uniqueId
    - }
    - _registerColumn(col) {
    - this._columnsMap[col.name] = new Column(col, this._getColumnValuesFromSourceAsAnyVector(col.source || col.name))
    - return this
    - }
    - _getColumnValuesFromSourceAsAnyVector(columnName) {
    - return this.getRows().map(row => row.getRowOriginalValue(columnName))
    - }
    - // todo: ADD TYPINGS
    - _predictColumns(predictionHints, propertyNameToColumnNameMap = {}) {
    - // todo: use the available input table column names, coupled with column setting we are trying to predict.
    - // ie: "gender" should use "gender" col, if available
    - // check all the columns for one that matches all tests. if found, return it.
    - const columnsArray = this.getColumnsArray()
    - const tests = predictionHints.split(",")
    - const filterTests = tests.filter(test => test.includes("=")).map(test => test.split("="))
    - const filterFn = col => filterTests.every(test => col[test[0]] !== undefined && col[test[0]]().toString() === test[1])
    - let colsThatPassed = columnsArray.filter(col => filterFn(col))
    - const notIn = {}
    - const notEqualTests = tests
    - .filter(test => test.startsWith("!"))
    - .map(test => propertyNameToColumnNameMap[test.substr(1)])
    - .filter(identity => identity)
    - .forEach(name => {
    - notIn[name] = true
    - })
    - colsThatPassed = colsThatPassed.filter(col => !notIn[col.getColumnName()])
    - // for now just 1 prop ranking.
    - const rankColumn = tests.find(test => !test.includes("=") && !test.includes("!"))
    - let potentialCols = colsThatPassed
    - if (rankColumn) potentialCols = potentialCols.sort(jtree.Utils.makeSortByFn(col => col[rankColumn]())).reverse()
    - return potentialCols
    - }
    - getRows() {
    - return this._rows
    - }
    - getFirstColumnAsString() {
    - return this.getRows()
    - .map(row => row.getFirstValue())
    - .join("")
    - }
    - isBlankTable() {
    - return this.getRowCount() === 0 && this.getColumnCount() === 0
    - }
    - getRowCount() {
    - return this.getRows().length
    - }
    - getColumnCount() {
    - return this.getColumnNames().length
    - }
    - getColumnNames() {
    - return Object.keys(this.getColumnsMap())
    - }
    - getColumnsMap() {
    - return this._columnsMap
    - }
    - getColumnByName(name) {
    - return this.getColumnsMap()[name]
    - }
    - _getLowerCaseColumnsMap() {
    - const map = {}
    - Object.keys(this._columnsMap).forEach(key => (map[key.toLowerCase()] = key))
    - return map
    - }
    - getTableCTime() {
    - return this._ctime
    - }
    - filterClonedRowsByScalar(columnName, comparisonOperator, scalarValueAsString) {
    - const column = this.getColumnByName(columnName)
    - let typedScalarValue = column.getPrimitiveTypeObj().getAsNativeJavascriptType(scalarValueAsString)
    - if (typedScalarValue instanceof Date) typedScalarValue = typedScalarValue.getTime() // todo: do I need this?
    - return new Table(
    - this.cloneNativeJavascriptTypedRows().filter(row => {
    - let rowTypedValue = row[columnName]
    - if (rowTypedValue instanceof Date) rowTypedValue = rowTypedValue.getTime() // todo: do I need this?
    - if (comparisonOperator === ComparisonOperators.equal) return rowTypedValue == typedScalarValue
    - if (comparisonOperator === ComparisonOperators.notEqual) return rowTypedValue != typedScalarValue
    - if (comparisonOperator === ComparisonOperators.greaterThan) return rowTypedValue > typedScalarValue
    - if (comparisonOperator === ComparisonOperators.lessThan) return rowTypedValue < typedScalarValue
    - if (comparisonOperator === ComparisonOperators.lessThanOrEqual) return rowTypedValue <= typedScalarValue
    - if (comparisonOperator === ComparisonOperators.greaterThanOrEqual) return rowTypedValue >= typedScalarValue
    - }),
    - this.getColumnsArrayOfObjects(),
    - undefined,
    - false
    - )
    - }
    - getColumnsArray() {
    - return Object.values(this.getColumnsMap())
    - }
    - getColumnsArrayOfObjects() {
    - return this.getColumnsArray().map(col => col.toObject())
    - }
    - getJavascriptNativeTypedValues() {
    - return this.getRows().map(row => row.rowToObjectWithOnlyNativeJavascriptTypes())
    - }
    - toMatrix() {
    - return this.getRows().map(row => row.toVector())
    - }
    - toNumericMatrix() {
    - // todo: right now it drops them. should we 1 hot them?
    - const numericNames = this.getColumnsArray()
    - .filter(col => col.isNumeric())
    - .map(col => col.getColumnName())
    - return this.getRows().map(row => {
    - const obj = row.rowToObjectWithOnlyNativeJavascriptTypes()
    - return numericNames.map(name => obj[name])
    - })
    - }
    - clone() {
    - return new Table(this.cloneNativeJavascriptTypedRows())
    - }
    - cloneNativeJavascriptTypedRows() {
    - return this.getRows()
    - .map(row => row.rowToObjectWithOnlyNativeJavascriptTypes())
    - .map(obj => Object.assign({}, obj))
    - }
    - fillMissing(columnName, value) {
    - const filled = this.cloneNativeJavascriptTypedRows().map(row => {
    - if (jtree.Utils.isValueEmpty(row[columnName])) row[columnName] = value
    - return row
    - })
    - return new Table(filled, this.getColumnsArrayOfObjects())
    - }
    - getTableColumnByName(name) {
    - return this.getColumnsMap()[name]
    - }
    - _getUnionSample(sampleSet) {
    - const sample = {}
    - sampleSet.forEach(row => {
    - row.getRowKeys().forEach(key => {
    - if (!key) return
    - const currentVal = sample[key]
    - if (currentVal !== undefined && currentVal !== "") return
    - sample[key] = row.getRowOriginalValue(key)
    - })
    - })
    - return sample
    - }
    - _getSampleSet() {
    - const SAMPLE_SET_SIZE = 30 // todo: fix.
    - if (!this._sampleSet) this._sampleSet = jtree.Utils.sampleWithoutReplacement(this.getRows(), SAMPLE_SET_SIZE, this._samplingSeed)
    - return this._sampleSet
    - }
    - _getDetectedColumnNames() {
    - const columns = this.getColumnsMap()
    - // This is run AFTER we have all user definied columns, and AFTER we have all data.
    - // detect columns that appear in records
    - // todo: this is broken. if you only pull 30, and its a tree or other type with varying columsn, you
    - // will often miss columns.
    - return Object.keys(this._getUnionSample(this._getSampleSet()))
    - .map(columnName => columnName.trim()) // todo: why do we filter empties?
    - .filter(identity => identity)
    - .filter(col => !columns[col]) // do not overwrite any custom columns
    - }
    - toTypeScriptInterface() {
    - const cols = this.getColumnsArray()
    - .map(col => ` ${col.getColumnName()}: ${col.getPrimitiveTypeName()};`)
    - .join("\n")
    - return `interface Row {
    - ${cols}
    - }`
    - }
    - getColumnNamesAndTypes() {
    - return this._getColumnNamesAndTypes()
    - }
    - getColumnNamesAndTypesAndReductions() {
    - return this._getColumnNamesAndTypes(true)
    - }
    - _getColumnNamesAndTypes(withReductions = false) {
    - const columns = this.getColumnsMap()
    - return this.getColumnNames().map(name => {
    - const column = columns[name]
    - const obj = {
    - Column: name,
    - JTableType: column.getPrimitiveTypeName(),
    - JavascriptType: column.getPrimitiveTypeObj().getJavascriptTypeName()
    - }
    - if (withReductions) Object.assign(obj, column.getReductions())
    - return obj
    - })
    - }
    - getPredictionsForAPropertyNameToColumnNameMapGivenHintsNode(hintsNode, propertyNameToColumnNameMap) {
    - const results = {}
    - hintsNode
    - .map(columnHintNode => this.getColumnNamePredictionsForProperty(columnHintNode.getFirstWord(), columnHintNode.getContent(), propertyNameToColumnNameMap))
    - .filter(pred => pred.length)
    - .forEach(predictions => {
    - const topPrediction = predictions[0]
    - results[topPrediction.propertyName] = topPrediction.columnName
    - })
    - return results
    - }
    - getColumnNamePredictionsForProperty(propertyName, predictionHints, propertyNameToColumnNameMap) {
    - const userDefinedColumnName = propertyNameToColumnNameMap[propertyName]
    - if (this.getColumnsMap()[userDefinedColumnName]) return [{ propertyName: propertyName, columnName: userDefinedColumnName }] // Table has a column named this, return okay.
    - // Table has a lowercase column named this. Return okay. Todo: do we want to do this?
    - if (userDefinedColumnName && this._getLowerCaseColumnsMap()[userDefinedColumnName.toLowerCase()]) return [this._getLowerCaseColumnsMap()[userDefinedColumnName.toLowerCase()]]
    - if (predictionHints) {
    - const potentialCols = this._predictColumns(predictionHints, propertyNameToColumnNameMap)
    - if (potentialCols.length) return [{ propertyName: propertyName, columnName: potentialCols[0].getColumnName() }]
    - }
    - const cols = this.getColumnsByImportance()
    - const name = cols.length && cols[0].getColumnName()
    - if (name) return [{ propertyName: propertyName, columnName: name }]
    - return []
    - }
    - toTree() {
    - return new jtree.TreeNode(this.getRows().map(row => row.getRowSourceObject()))
    - }
    - filterRowsByFn(fn) {
    - return new Table(this.cloneNativeJavascriptTypedRows().filter((inputRow, index) => fn(inputRow, index)))
    - }
    - // todo: make more efficient?
    - // todo: preserve columns
    - addColumns(columnsToAdd) {
    - const inputColDefs = this.getColumnsMap()
    - return new Table(
    - this.cloneNativeJavascriptTypedRows().map(inputRow => {
    - columnsToAdd.forEach(newCol => {
    - let newValue
    - if (newCol.accessorFn) newValue = newCol.accessorFn(inputRow)
    - else newValue = Column.convertValueToNumeric(inputRow[newCol.source], inputColDefs[newCol.source].getPrimitiveTypeName(), newCol.type, newCol.mathFn)
    - inputRow[newCol.name] = newValue
    - })
    - return inputRow
    - })
    - )
    - }
    - // todo: can be made more effcicent
    - changeColumnType(columnName, newType) {
    - const cols = this.getColumnsArrayOfObjects()
    - cols.forEach(col => {
    - if (col.name === columnName) col.type = newType
    - })
    - return new Table(this.cloneNativeJavascriptTypedRows(), cols, undefined, false)
    - }
    - renameColumns(nameMap) {
    - const rows = this.getRows()
    - .map(row => row.rowToObjectWithOnlyNativeJavascriptTypes())
    - .map(obj => {
    - Object.keys(nameMap).forEach(oldName => {
    - const newName = nameMap[oldName]
    - if (newName === oldName) return
    - obj[newName] = obj[oldName]
    - delete obj[oldName]
    - })
    - return obj
    - })
    - const cols = this.getColumnsArrayOfObjects()
    - cols.forEach(col => {
    - if (nameMap[col.name]) col.name = nameMap[col.name]
    - })
    - return new Table(rows, cols, undefined, false)
    - }
    - cloneWithCleanColumnNames() {
    - const nameMap = {}
    - const cols = this.getColumnsArrayOfObjects()
    - cols.forEach(col => {
    - nameMap[col.name] = col.name.replace(/[^a-z0-9]/gi, "")
    - })
    - return this.renameColumns(nameMap)
    - }
    - // todo: can be made more effcicent
    - dropAllColumnsExcept(columnsToKeep) {
    - return new Table(
    - this.cloneNativeJavascriptTypedRows().map((inputRow, rowIndex) => {
    - const result = {}
    - columnsToKeep.forEach(name => {
    - result[name] = inputRow[name]
    - })
    - return result
    - }),
    - columnsToKeep.map(colName => this.getColumnByName(colName).toObject())
    - )
    - }
    - // todo: we don't need any cloning here--just create a new row, new rows array, new and add the pointers
    - // to same rows
    - addRow(rowWords) {
    - const rows = this.cloneNativeJavascriptTypedRows()
    - const newRow = {}
    - Object.keys(rows[0] || {}).forEach((key, index) => {
    - // todo: handle typings
    - newRow[key] = rowWords[index]
    - })
    - rows.push(newRow)
    - return new Table(rows, this.getColumnsMap())
    - }
    - _synthesizeRow(randomNumberFn) {
    - const row = {}
    - this.getColumnsArray().forEach(column => {
    - row[column.getColumnName()] = column.synthesizeValue(randomNumberFn)
    - })
    - return row
    - }
    - synthesizeTable(rowcount, seed) {
    - const randomNumberFn = jtree.Utils.makeSemiRandomFn(seed)
    - const rows = []
    - while (rowcount) {
    - rows.push(this._synthesizeRow(randomNumberFn))
    - rowcount--
    - }
    - return new Table(rows, this.getColumnsArray().map(col => col.toObject()))
    - }
    - // todo: we don't need any cloning here--here create a new sorted array with poitners
    - // to same rows
    - shuffleRows() {
    - // todo: add seed!
    - // cellType randomSeed int
    - // description An integer to seed the random number generator with.
    - return new Table(jtree.Utils.shuffleInPlace(this.getRows().slice(0)), this.getColumnsMap())
    - }
    - reverseRows() {
    - const rows = this.getRows().slice(0)
    - rows.reverse()
    - return new Table(rows, this.getColumnsMap())
    - }
    - // Pivot is shorthand for group and reduce?
    - makePivotTable(groupByColumnNames, newCols) {
    - const inputColumns = this.getColumnsArrayOfObjects()
    - const colMap = {}
    - inputColumns.forEach(col => (colMap[col.name] = true))
    - const groupByCols = groupByColumnNames.filter(col => colMap[col])
    - const pivotTable = new PivotTable(this.getJavascriptNativeTypedValues(), inputColumns, newCols).getNewRows(groupByCols)
    - return new Table(pivotTable.rows, pivotTable.columns)
    - }
    - sortBy(colNames) {
    - const colAccessorFns = colNames.map(colName => row => row.rowToObjectWithOnlyNativeJavascriptTypes()[colName])
    - const rows = this.getRows().sort(jtree.Utils.makeSortByFn(colAccessorFns))
    - return new Table(rows, this.getColumnsMap())
    - }
    - toDelimited(delimiter) {
    - return this.toTree().toDelimited(delimiter, this.getColumnNames())
    - }
    - toSimpleSchema() {
    - return this.getColumnsArray()
    - .map(col => `${col.getColumnName()} ${col.getPrimitiveTypeName()}`)
    - .join("\n")
    - }
    - // todo: toProtoBuf, toSqlLite, toJsonSchema, toJsonLd, toCapnProto, toApacheArrow, toFlatBuffers
    - // guess which are the more important/informative/interesting columns
    - getColumnsByImportance() {
    - const columnsMap = this.getColumnsMap()
    - const aIsMoreImportant = -1
    - const bIsMoreImportant = 1
    - const cols = Object.keys(columnsMap).map(columnName => columnsMap[columnName])
    - cols.sort((colA, colB) => {
    - if (colA.getTitlePotential() > colB.getTitlePotential()) return aIsMoreImportant
    - if (colB.getTitlePotential() > colA.getTitlePotential()) return bIsMoreImportant
    - if (colA.getBlankPercentage() > 0.5 || colB.getBlankPercentage() > 0.5) {
    - if (colA.getBlankPercentage() > colB.getBlankPercentage()) return bIsMoreImportant
    - else if (colB.getBlankPercentage() > colA.getBlankPercentage()) return aIsMoreImportant
    - }
    - if (colA.isTemporal() && !colB.isTemporal()) return aIsMoreImportant
    - if (!colA.isTemporal() && colB.isTemporal()) return bIsMoreImportant
    - if (colA.isLink() && !colB.isLink()) return bIsMoreImportant
    - else if (!colA.isLink() && colB.isLink()) return aIsMoreImportant
    - if (colA.isString() && !colB.isString()) return bIsMoreImportant
    - else if (!colA.isString() && colB.isString()) return aIsMoreImportant
    - if (colA.isString() && colB.isString()) {
    - if (colA.getEntropy() > 4 && colA.getEntropy() < 8 && colA.getEntropy() > colB.getEntropy()) return aIsMoreImportant
    - if (colA.getEstimatedTextLength() > colB.getEstimatedTextLength()) return bIsMoreImportant
    - else return aIsMoreImportant
    - }
    - return 0
    - })
    - return cols
    - }
    - }
    - Table._uniqueId = 0
    - window.Table = Table
    - window.ComparisonOperators = ComparisonOperators
    - ;
    -
    - {
    - class stumpNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - errorNode,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    - blockquote: htmlTagNode,
    - colgroup: htmlTagNode,
    - datalist: htmlTagNode,
    - fieldset: htmlTagNode,
    - menuitem: htmlTagNode,
    - noscript: htmlTagNode,
    - optgroup: htmlTagNode,
    - progress: htmlTagNode,
    - styleTag: htmlTagNode,
    - template: htmlTagNode,
    - textarea: htmlTagNode,
    - titleTag: htmlTagNode,
    - address: htmlTagNode,
    - article: htmlTagNode,
    - caption: htmlTagNode,
    - details: htmlTagNode,
    - section: htmlTagNode,
    - summary: htmlTagNode,
    - button: htmlTagNode,
    - canvas: htmlTagNode,
    - dialog: htmlTagNode,
    - figure: htmlTagNode,
    - footer: htmlTagNode,
    - header: htmlTagNode,
    - hgroup: htmlTagNode,
    - iframe: htmlTagNode,
    - keygen: htmlTagNode,
    - legend: htmlTagNode,
    - object: htmlTagNode,
    - option: htmlTagNode,
    - output: htmlTagNode,
    - script: htmlTagNode,
    - select: htmlTagNode,
    - source: htmlTagNode,
    - strong: htmlTagNode,
    - aside: htmlTagNode,
    - embed: htmlTagNode,
    - input: htmlTagNode,
    - label: htmlTagNode,
    - meter: htmlTagNode,
    - param: htmlTagNode,
    - small: htmlTagNode,
    - table: htmlTagNode,
    - tbody: htmlTagNode,
    - tfoot: htmlTagNode,
    - thead: htmlTagNode,
    - track: htmlTagNode,
    - video: htmlTagNode,
    - abbr: htmlTagNode,
    - area: htmlTagNode,
    - base: htmlTagNode,
    - body: htmlTagNode,
    - code: htmlTagNode,
    - form: htmlTagNode,
    - head: htmlTagNode,
    - html: htmlTagNode,
    - link: htmlTagNode,
    - main: htmlTagNode,
    - mark: htmlTagNode,
    - menu: htmlTagNode,
    - meta: htmlTagNode,
    - ruby: htmlTagNode,
    - samp: htmlTagNode,
    - span: htmlTagNode,
    - time: htmlTagNode,
    - bdi: htmlTagNode,
    - bdo: htmlTagNode,
    - col: htmlTagNode,
    - del: htmlTagNode,
    - dfn: htmlTagNode,
    - div: htmlTagNode,
    - img: htmlTagNode,
    - ins: htmlTagNode,
    - kbd: htmlTagNode,
    - map: htmlTagNode,
    - nav: htmlTagNode,
    - pre: htmlTagNode,
    - rtc: htmlTagNode,
    - sub: htmlTagNode,
    - sup: htmlTagNode,
    - var: htmlTagNode,
    - wbr: htmlTagNode,
    - br: htmlTagNode,
    - dd: htmlTagNode,
    - dl: htmlTagNode,
    - dt: htmlTagNode,
    - em: htmlTagNode,
    - h1: htmlTagNode,
    - h2: htmlTagNode,
    - h3: htmlTagNode,
    - h4: htmlTagNode,
    - h5: htmlTagNode,
    - h6: htmlTagNode,
    - hr: htmlTagNode,
    - li: htmlTagNode,
    - ol: htmlTagNode,
    - rb: htmlTagNode,
    - rp: htmlTagNode,
    - rt: htmlTagNode,
    - td: htmlTagNode,
    - th: htmlTagNode,
    - tr: htmlTagNode,
    - ul: htmlTagNode,
    - a: htmlTagNode,
    - b: htmlTagNode,
    - i: htmlTagNode,
    - p: htmlTagNode,
    - q: htmlTagNode,
    - s: htmlTagNode,
    - u: htmlTagNode
    - }),
    - [{ regex: /^$/, nodeConstructor: blankLineNode }]
    - )
    - }
    - compile() {
    - return this.toHtml()
    - }
    - _getHtmlJoinByCharacter() {
    - return ""
    - }
    - getHandGrammarProgram() {
    - if (!this._cachedHandGrammarProgramRoot)
    - this._cachedHandGrammarProgramRoot = new jtree.HandGrammarProgram(`tooling onsave jtree build produceLang stump
    - anyCell
    - keywordCell
    - emptyCell
    - extraCell
    - highlightScope invalid
    - anyHtmlContentCell
    - highlightScope string
    - attributeValueCell
    - highlightScope constant.language
    - htmlTagNameCell
    - highlightScope variable.function
    - extends keywordCell
    - enum a abbr address area article aside b base bdi bdo blockquote body br button canvas caption code col colgroup datalist dd del details dfn dialog div dl dt em embed fieldset figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins kbd keygen label legend li link main map mark menu menuitem meta meter nav noscript object ol optgroup option output p param pre progress q rb rp rt rtc ruby s samp script section select small source span strong styleTag sub summary sup table tbody td template textarea tfoot th thead time titleTag tr track u ul var video wbr
    - htmlAttributeNameCell
    - highlightScope entity.name.type
    - extends keywordCell
    - enum accept accept-charset accesskey action align alt async autocomplete autofocus autoplay bgcolor border charset checked class color cols colspan content contenteditable controls coords datetime default defer dir dirname disabled download draggable dropzone enctype for formaction headers height hidden high href hreflang http-equiv id ismap kind lang list loop low max maxlength media method min multiple muted name novalidate onabort onafterprint onbeforeprint onbeforeunload onblur oncanplay oncanplaythrough onchange onclick oncontextmenu oncopy oncuechange oncut ondblclick ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop ondurationchange onemptied onended onerror onfocus onhashchange oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart onmousedown onmousemove onmouseout onmouseover onmouseup onmousewheel onoffline ononline onpagehide onpageshow onpaste onpause onplay onplaying onpopstate onprogress onratechange onreset onresize onscroll onsearch onseeked onseeking onselect onstalled onstorage onsubmit onsuspend ontimeupdate ontoggle onunload onvolumechange onwaiting onwheel open optimum pattern placeholder poster preload readonly rel required reversed rows rowspan sandbox scope selected shape size sizes spellcheck src srcdoc srclang srcset start step style tabindex target title translate type usemap value width wrap
    - bernKeywordCell
    - enum bern
    - extends keywordCell
    - stumpNode
    - root
    - description A prefix Tree Language that compiles to HTML.
    - catchAllNodeType errorNode
    - inScope htmlTagNode blankLineNode
    - example
    - div
    - h1 hello world
    - compilesTo html
    - javascript
    - compile() {
    - return this.toHtml()
    - }
    - _getHtmlJoinByCharacter() {
    - return ""
    - }
    - blankLineNode
    - pattern ^$
    - tags doNotSynthesize
    - cells emptyCell
    - javascript
    - _toHtml() {
    - return ""
    - }
    - getTextContent() {return ""}
    - htmlTagNode
    - inScope bernNode htmlTagNode htmlAttributeNode blankLineNode
    - catchAllCellType anyHtmlContentCell
    - cells htmlTagNameCell
    - javascript
    - getTag() {
    - // we need to remove the "Tag" bit to handle the style and title attribute/tag conflict.
    - const firstWord = this.getFirstWord()
    - const map = {
    - titleTag: "title",
    - styleTag: "style"
    - }
    - return map[firstWord] || firstWord
    - }
    - _getHtmlJoinByCharacter() {
    - return ""
    - }
    - toHtmlWithSuids() {
    - return this._toHtml(undefined, true)
    - }
    - _getOneLiner() {
    - const oneLinerWords = this.getWordsFrom(1)
    - return oneLinerWords.length ? oneLinerWords.join(" ") : ""
    - }
    - getTextContent() {
    - return this._getOneLiner()
    - }
    - shouldCollapse() {
    - return this.has("collapse")
    - }
    - _toHtml(indentCount, withSuid) {
    - const tag = this.getTag()
    - const children = this.map(child => child._toHtml(indentCount + 1, withSuid)).join("")
    - const attributesStr = this.filter(node => node.isAttributeNode)
    - .map(child => child.getAttribute())
    - .join("")
    - const indent = " ".repeat(indentCount)
    - const collapse = this.shouldCollapse()
    - const indentForChildNodes = !collapse && this.getChildInstancesOfNodeTypeId("htmlTagNode").length > 0
    - const suid = withSuid ? \` stumpUid="\${this._getUid()}"\` : ""
    - const oneLiner = this._getOneLiner()
    - return \`\${!collapse ? indent : ""}<\${tag}\${attributesStr}\${suid}>\${oneLiner}\${indentForChildNodes ? "\\n" : ""}\${children}\${collapse ? "" : "\\n"}\`
    - }
    - removeCssStumpNode() {
    - return this.removeStumpNode()
    - }
    - removeStumpNode() {
    - this.getShadow().removeShadow()
    - return this.destroy()
    - }
    - getNodeByGuid(guid) {
    - return this.getTopDownArray().find(node => node._getUid() === guid)
    - }
    - addClassToStumpNode(className) {
    - const classNode = this.touchNode("class")
    - const words = classNode.getWordsFrom(1)
    - // note: we call add on shadow regardless, because at the moment stump may have gotten out of
    - // sync with shadow, if things modified the dom. todo: cleanup.
    - this.getShadow().addClassToShadow(className)
    - if (words.includes(className)) return this
    - words.push(className)
    - classNode.setContent(words.join(this.getWordBreakSymbol()))
    - return this
    - }
    - removeClassFromStumpNode(className) {
    - const classNode = this.getNode("class")
    - if (!classNode) return this
    - const newClasses = classNode.getWords().filter(word => word !== className)
    - if (!newClasses.length) classNode.destroy()
    - else classNode.setContent(newClasses.join(" "))
    - this.getShadow().removeClassFromShadow(className)
    - return this
    - }
    - stumpNodeHasClass(className) {
    - const classNode = this.getNode("class")
    - return classNode && classNode.getWords().includes(className) ? true : false
    - }
    - isStumpNodeCheckbox() {
    - return this.get("type") === "checkbox"
    - }
    - getShadow() {
    - if (!this._shadow) {
    - const shadowClass = this.getShadowClass()
    - this._shadow = new shadowClass(this)
    - }
    - return this._shadow
    - }
    - insertCssChildNode(text, index) {
    - return this.insertChildNode(text, index)
    - }
    - insertChildNode(text, index) {
    - const singleNode = new jtree.TreeNode(text).getChildren()[0]
    - const newNode = this.insertLineAndChildren(singleNode.getLine(), singleNode.childrenToString(), index)
    - const stumpNodeIndex = this.getChildInstancesOfNodeTypeId("htmlTagNode").indexOf(newNode)
    - this.getShadow().insertHtmlNode(newNode, stumpNodeIndex)
    - return newNode
    - }
    - isInputType() {
    - return ["input", "textarea"].includes(this.getTag()) || this.get("contenteditable") === "true"
    - }
    - findStumpNodeByChild(line) {
    - return this.findStumpNodesByChild(line)[0]
    - }
    - findStumpNodeByChildString(line) {
    - return this.getTopDownArray().find(node =>
    - node
    - .map(child => child.getLine())
    - .join("\\n")
    - .includes(line)
    - )
    - }
    - findStumpNodeByFirstWord(firstWord) {
    - return this._findStumpNodesByBase(firstWord)[0]
    - }
    - _findStumpNodesByBase(firstWord) {
    - return this.getTopDownArray().filter(node => node.doesExtend("htmlTagNode") && node.getFirstWord() === firstWord)
    - }
    - hasLine(line) {
    - return this.getChildren().some(node => node.getLine() === line)
    - }
    - findStumpNodesByChild(line) {
    - return this.getTopDownArray().filter(node => node.doesExtend("htmlTagNode") && node.hasLine(line))
    - }
    - findStumpNodesWithClass(className) {
    - return this.getTopDownArray().filter(
    - node =>
    - node.doesExtend("htmlTagNode") &&
    - node.has("class") &&
    - node
    - .getNode("class")
    - .getWords()
    - .includes(className)
    - )
    - }
    - getShadowClass() {
    - return this.getParent().getShadowClass()
    - }
    - // todo: should not be here
    - getStumpNodeTreeComponent() {
    - return this._treeComponent || this.getParent().getStumpNodeTreeComponent()
    - }
    - // todo: should not be here
    - setStumpNodeTreeComponent(treeComponent) {
    - this._treeComponent = treeComponent
    - return this
    - }
    - setStumpNodeCss(css) {
    - this.getShadow().setShadowCss(css)
    - return this
    - }
    - getStumpNodeCss(prop) {
    - return this.getShadow().getShadowCss(prop)
    - }
    - getStumpNodeAttr(key) {
    - return this.get(key)
    - }
    - setStumpNodeAttr(key, value) {
    - // todo
    - return this
    - }
    - toHtml() {
    - return this._toHtml()
    - }
    - errorNode
    - baseNodeType errorNode
    - htmlAttributeNode
    - javascript
    - _toHtml() {
    - return ""
    - }
    - getTextContent() {return ""}
    - getAttribute() {
    - return \` \${this.getFirstWord()}="\${this.getContent()}"\`
    - }
    - boolean isAttributeNode true
    - boolean isTileAttribute true
    - catchAllNodeType errorNode
    - catchAllCellType attributeValueCell
    - cells htmlAttributeNameCell
    - stumpExtendedAttributeNameCell
    - extends htmlAttributeNameCell
    - enum collapse blurCommand changeCommand clickCommand contextMenuCommand doubleClickCommand lineClickCommand lineShiftClickCommand shiftClickCommand
    - stumpExtendedAttributeNode
    - description Node types not present in HTML but included in stump.
    - extends htmlAttributeNode
    - cells stumpExtendedAttributeNameCell
    - lineOfHtmlContentNode
    - boolean isTileAttribute true
    - catchAllNodeType lineOfHtmlContentNode
    - catchAllCellType anyHtmlContentCell
    - javascript
    - getTextContent() {return this.getLine()}
    - bernNode
    - boolean isTileAttribute true
    - todo Rename this node type
    - description This is a node where you can put any HTML content. It is called "bern" until someone comes up with a better name.
    - catchAllNodeType lineOfHtmlContentNode
    - javascript
    - _toHtml() {
    - return this.childrenToString()
    - }
    - getTextContent() {return ""}
    - cells bernKeywordCell`)
    - return this._cachedHandGrammarProgramRoot
    - }
    - static getNodeTypeMap() {
    - return {
    - stumpNode: stumpNode,
    - blankLineNode: blankLineNode,
    - htmlTagNode: htmlTagNode,
    - errorNode: errorNode,
    - htmlAttributeNode: htmlAttributeNode,
    - stumpExtendedAttributeNode: stumpExtendedAttributeNode,
    - lineOfHtmlContentNode: lineOfHtmlContentNode,
    - bernNode: bernNode
    - }
    - }
    - }
    -
    - class blankLineNode extends jtree.GrammarBackedNode {
    - get emptyCell() {
    - return this.getWord(0)
    - }
    - _toHtml() {
    - return ""
    - }
    - getTextContent() {
    - return ""
    - }
    - }
    -
    - class htmlTagNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    - blockquote: htmlTagNode,
    - colgroup: htmlTagNode,
    - datalist: htmlTagNode,
    - fieldset: htmlTagNode,
    - menuitem: htmlTagNode,
    - noscript: htmlTagNode,
    - optgroup: htmlTagNode,
    - progress: htmlTagNode,
    - styleTag: htmlTagNode,
    - template: htmlTagNode,
    - textarea: htmlTagNode,
    - titleTag: htmlTagNode,
    - address: htmlTagNode,
    - article: htmlTagNode,
    - caption: htmlTagNode,
    - details: htmlTagNode,
    - section: htmlTagNode,
    - summary: htmlTagNode,
    - button: htmlTagNode,
    - canvas: htmlTagNode,
    - dialog: htmlTagNode,
    - figure: htmlTagNode,
    - footer: htmlTagNode,
    - header: htmlTagNode,
    - hgroup: htmlTagNode,
    - iframe: htmlTagNode,
    - keygen: htmlTagNode,
    - legend: htmlTagNode,
    - object: htmlTagNode,
    - option: htmlTagNode,
    - output: htmlTagNode,
    - script: htmlTagNode,
    - select: htmlTagNode,
    - source: htmlTagNode,
    - strong: htmlTagNode,
    - aside: htmlTagNode,
    - embed: htmlTagNode,
    - input: htmlTagNode,
    - label: htmlTagNode,
    - meter: htmlTagNode,
    - param: htmlTagNode,
    - small: htmlTagNode,
    - table: htmlTagNode,
    - tbody: htmlTagNode,
    - tfoot: htmlTagNode,
    - thead: htmlTagNode,
    - track: htmlTagNode,
    - video: htmlTagNode,
    - abbr: htmlTagNode,
    - area: htmlTagNode,
    - base: htmlTagNode,
    - body: htmlTagNode,
    - code: htmlTagNode,
    - form: htmlTagNode,
    - head: htmlTagNode,
    - html: htmlTagNode,
    - link: htmlTagNode,
    - main: htmlTagNode,
    - mark: htmlTagNode,
    - menu: htmlTagNode,
    - meta: htmlTagNode,
    - ruby: htmlTagNode,
    - samp: htmlTagNode,
    - span: htmlTagNode,
    - time: htmlTagNode,
    - bdi: htmlTagNode,
    - bdo: htmlTagNode,
    - col: htmlTagNode,
    - del: htmlTagNode,
    - dfn: htmlTagNode,
    - div: htmlTagNode,
    - img: htmlTagNode,
    - ins: htmlTagNode,
    - kbd: htmlTagNode,
    - map: htmlTagNode,
    - nav: htmlTagNode,
    - pre: htmlTagNode,
    - rtc: htmlTagNode,
    - sub: htmlTagNode,
    - sup: htmlTagNode,
    - var: htmlTagNode,
    - wbr: htmlTagNode,
    - br: htmlTagNode,
    - dd: htmlTagNode,
    - dl: htmlTagNode,
    - dt: htmlTagNode,
    - em: htmlTagNode,
    - h1: htmlTagNode,
    - h2: htmlTagNode,
    - h3: htmlTagNode,
    - h4: htmlTagNode,
    - h5: htmlTagNode,
    - h6: htmlTagNode,
    - hr: htmlTagNode,
    - li: htmlTagNode,
    - ol: htmlTagNode,
    - rb: htmlTagNode,
    - rp: htmlTagNode,
    - rt: htmlTagNode,
    - td: htmlTagNode,
    - th: htmlTagNode,
    - tr: htmlTagNode,
    - ul: htmlTagNode,
    - a: htmlTagNode,
    - b: htmlTagNode,
    - i: htmlTagNode,
    - p: htmlTagNode,
    - q: htmlTagNode,
    - s: htmlTagNode,
    - u: htmlTagNode,
    - oncanplaythrough: htmlAttributeNode,
    - ondurationchange: htmlAttributeNode,
    - onloadedmetadata: htmlAttributeNode,
    - contenteditable: htmlAttributeNode,
    - "accept-charset": htmlAttributeNode,
    - onbeforeunload: htmlAttributeNode,
    - onvolumechange: htmlAttributeNode,
    - onbeforeprint: htmlAttributeNode,
    - oncontextmenu: htmlAttributeNode,
    - autocomplete: htmlAttributeNode,
    - onafterprint: htmlAttributeNode,
    - onhashchange: htmlAttributeNode,
    - onloadeddata: htmlAttributeNode,
    - onmousewheel: htmlAttributeNode,
    - onratechange: htmlAttributeNode,
    - ontimeupdate: htmlAttributeNode,
    - oncuechange: htmlAttributeNode,
    - ondragenter: htmlAttributeNode,
    - ondragleave: htmlAttributeNode,
    - ondragstart: htmlAttributeNode,
    - onloadstart: htmlAttributeNode,
    - onmousedown: htmlAttributeNode,
    - onmousemove: htmlAttributeNode,
    - onmouseover: htmlAttributeNode,
    - placeholder: htmlAttributeNode,
    - formaction: htmlAttributeNode,
    - "http-equiv": htmlAttributeNode,
    - novalidate: htmlAttributeNode,
    - ondblclick: htmlAttributeNode,
    - ondragover: htmlAttributeNode,
    - onkeypress: htmlAttributeNode,
    - onmouseout: htmlAttributeNode,
    - onpagehide: htmlAttributeNode,
    - onpageshow: htmlAttributeNode,
    - onpopstate: htmlAttributeNode,
    - onprogress: htmlAttributeNode,
    - spellcheck: htmlAttributeNode,
    - accesskey: htmlAttributeNode,
    - autofocus: htmlAttributeNode,
    - draggable: htmlAttributeNode,
    - maxlength: htmlAttributeNode,
    - oncanplay: htmlAttributeNode,
    - ondragend: htmlAttributeNode,
    - onemptied: htmlAttributeNode,
    - oninvalid: htmlAttributeNode,
    - onkeydown: htmlAttributeNode,
    - onmouseup: htmlAttributeNode,
    - onoffline: htmlAttributeNode,
    - onplaying: htmlAttributeNode,
    - onseeking: htmlAttributeNode,
    - onstalled: htmlAttributeNode,
    - onstorage: htmlAttributeNode,
    - onsuspend: htmlAttributeNode,
    - onwaiting: htmlAttributeNode,
    - translate: htmlAttributeNode,
    - autoplay: htmlAttributeNode,
    - controls: htmlAttributeNode,
    - datetime: htmlAttributeNode,
    - disabled: htmlAttributeNode,
    - download: htmlAttributeNode,
    - dropzone: htmlAttributeNode,
    - hreflang: htmlAttributeNode,
    - multiple: htmlAttributeNode,
    - onchange: htmlAttributeNode,
    - ononline: htmlAttributeNode,
    - onresize: htmlAttributeNode,
    - onscroll: htmlAttributeNode,
    - onsearch: htmlAttributeNode,
    - onseeked: htmlAttributeNode,
    - onselect: htmlAttributeNode,
    - onsubmit: htmlAttributeNode,
    - ontoggle: htmlAttributeNode,
    - onunload: htmlAttributeNode,
    - readonly: htmlAttributeNode,
    - required: htmlAttributeNode,
    - reversed: htmlAttributeNode,
    - selected: htmlAttributeNode,
    - tabindex: htmlAttributeNode,
    - bgcolor: htmlAttributeNode,
    - charset: htmlAttributeNode,
    - checked: htmlAttributeNode,
    - colspan: htmlAttributeNode,
    - content: htmlAttributeNode,
    - default: htmlAttributeNode,
    - dirname: htmlAttributeNode,
    - enctype: htmlAttributeNode,
    - headers: htmlAttributeNode,
    - onabort: htmlAttributeNode,
    - onclick: htmlAttributeNode,
    - onended: htmlAttributeNode,
    - onerror: htmlAttributeNode,
    - onfocus: htmlAttributeNode,
    - oninput: htmlAttributeNode,
    - onkeyup: htmlAttributeNode,
    - onpaste: htmlAttributeNode,
    - onpause: htmlAttributeNode,
    - onreset: htmlAttributeNode,
    - onwheel: htmlAttributeNode,
    - optimum: htmlAttributeNode,
    - pattern: htmlAttributeNode,
    - preload: htmlAttributeNode,
    - rowspan: htmlAttributeNode,
    - sandbox: htmlAttributeNode,
    - srclang: htmlAttributeNode,
    - accept: htmlAttributeNode,
    - action: htmlAttributeNode,
    - border: htmlAttributeNode,
    - coords: htmlAttributeNode,
    - height: htmlAttributeNode,
    - hidden: htmlAttributeNode,
    - method: htmlAttributeNode,
    - onblur: htmlAttributeNode,
    - oncopy: htmlAttributeNode,
    - ondrag: htmlAttributeNode,
    - ondrop: htmlAttributeNode,
    - onload: htmlAttributeNode,
    - onplay: htmlAttributeNode,
    - poster: htmlAttributeNode,
    - srcdoc: htmlAttributeNode,
    - srcset: htmlAttributeNode,
    - target: htmlAttributeNode,
    - usemap: htmlAttributeNode,
    - align: htmlAttributeNode,
    - async: htmlAttributeNode,
    - class: htmlAttributeNode,
    - color: htmlAttributeNode,
    - defer: htmlAttributeNode,
    - ismap: htmlAttributeNode,
    - media: htmlAttributeNode,
    - muted: htmlAttributeNode,
    - oncut: htmlAttributeNode,
    - scope: htmlAttributeNode,
    - shape: htmlAttributeNode,
    - sizes: htmlAttributeNode,
    - start: htmlAttributeNode,
    - style: htmlAttributeNode,
    - title: htmlAttributeNode,
    - value: htmlAttributeNode,
    - width: htmlAttributeNode,
    - cols: htmlAttributeNode,
    - high: htmlAttributeNode,
    - href: htmlAttributeNode,
    - kind: htmlAttributeNode,
    - lang: htmlAttributeNode,
    - list: htmlAttributeNode,
    - loop: htmlAttributeNode,
    - name: htmlAttributeNode,
    - open: htmlAttributeNode,
    - rows: htmlAttributeNode,
    - size: htmlAttributeNode,
    - step: htmlAttributeNode,
    - type: htmlAttributeNode,
    - wrap: htmlAttributeNode,
    - alt: htmlAttributeNode,
    - dir: htmlAttributeNode,
    - for: htmlAttributeNode,
    - low: htmlAttributeNode,
    - max: htmlAttributeNode,
    - min: htmlAttributeNode,
    - rel: htmlAttributeNode,
    - src: htmlAttributeNode,
    - id: htmlAttributeNode,
    - lineShiftClickCommand: stumpExtendedAttributeNode,
    - contextMenuCommand: stumpExtendedAttributeNode,
    - doubleClickCommand: stumpExtendedAttributeNode,
    - shiftClickCommand: stumpExtendedAttributeNode,
    - lineClickCommand: stumpExtendedAttributeNode,
    - changeCommand: stumpExtendedAttributeNode,
    - clickCommand: stumpExtendedAttributeNode,
    - blurCommand: stumpExtendedAttributeNode,
    - collapse: stumpExtendedAttributeNode,
    - bern: bernNode
    - }),
    - [{ regex: /^$/, nodeConstructor: blankLineNode }]
    - )
    - }
    - get htmlTagNameCell() {
    - return this.getWord(0)
    - }
    - get anyHtmlContentCell() {
    - return this.getWordsFrom(1)
    - }
    - getTag() {
    - // we need to remove the "Tag" bit to handle the style and title attribute/tag conflict.
    - const firstWord = this.getFirstWord()
    - const map = {
    - titleTag: "title",
    - styleTag: "style"
    - }
    - return map[firstWord] || firstWord
    - }
    - _getHtmlJoinByCharacter() {
    - return ""
    - }
    - toHtmlWithSuids() {
    - return this._toHtml(undefined, true)
    - }
    - _getOneLiner() {
    - const oneLinerWords = this.getWordsFrom(1)
    - return oneLinerWords.length ? oneLinerWords.join(" ") : ""
    - }
    - getTextContent() {
    - return this._getOneLiner()
    - }
    - shouldCollapse() {
    - return this.has("collapse")
    - }
    - _toHtml(indentCount, withSuid) {
    - const tag = this.getTag()
    - const children = this.map(child => child._toHtml(indentCount + 1, withSuid)).join("")
    - const attributesStr = this.filter(node => node.isAttributeNode)
    - .map(child => child.getAttribute())
    - .join("")
    - const indent = " ".repeat(indentCount)
    - const collapse = this.shouldCollapse()
    - const indentForChildNodes = !collapse && this.getChildInstancesOfNodeTypeId("htmlTagNode").length > 0
    - const suid = withSuid ? ` stumpUid="${this._getUid()}"` : ""
    - const oneLiner = this._getOneLiner()
    - return `${!collapse ? indent : ""}<${tag}${attributesStr}${suid}>${oneLiner}${indentForChildNodes ? "\n" : ""}${children}${collapse ? "" : "\n"}`
    - }
    - removeCssStumpNode() {
    - return this.removeStumpNode()
    - }
    - removeStumpNode() {
    - this.getShadow().removeShadow()
    - return this.destroy()
    - }
    - getNodeByGuid(guid) {
    - return this.getTopDownArray().find(node => node._getUid() === guid)
    - }
    - addClassToStumpNode(className) {
    - const classNode = this.touchNode("class")
    - const words = classNode.getWordsFrom(1)
    - // note: we call add on shadow regardless, because at the moment stump may have gotten out of
    - // sync with shadow, if things modified the dom. todo: cleanup.
    - this.getShadow().addClassToShadow(className)
    - if (words.includes(className)) return this
    - words.push(className)
    - classNode.setContent(words.join(this.getWordBreakSymbol()))
    - return this
    - }
    - removeClassFromStumpNode(className) {
    - const classNode = this.getNode("class")
    - if (!classNode) return this
    - const newClasses = classNode.getWords().filter(word => word !== className)
    - if (!newClasses.length) classNode.destroy()
    - else classNode.setContent(newClasses.join(" "))
    - this.getShadow().removeClassFromShadow(className)
    - return this
    - }
    - stumpNodeHasClass(className) {
    - const classNode = this.getNode("class")
    - return classNode && classNode.getWords().includes(className) ? true : false
    - }
    - isStumpNodeCheckbox() {
    - return this.get("type") === "checkbox"
    - }
    - getShadow() {
    - if (!this._shadow) {
    - const shadowClass = this.getShadowClass()
    - this._shadow = new shadowClass(this)
    - }
    - return this._shadow
    - }
    - insertCssChildNode(text, index) {
    - return this.insertChildNode(text, index)
    - }
    - insertChildNode(text, index) {
    - const singleNode = new jtree.TreeNode(text).getChildren()[0]
    - const newNode = this.insertLineAndChildren(singleNode.getLine(), singleNode.childrenToString(), index)
    - const stumpNodeIndex = this.getChildInstancesOfNodeTypeId("htmlTagNode").indexOf(newNode)
    - this.getShadow().insertHtmlNode(newNode, stumpNodeIndex)
    - return newNode
    - }
    - isInputType() {
    - return ["input", "textarea"].includes(this.getTag()) || this.get("contenteditable") === "true"
    - }
    - findStumpNodeByChild(line) {
    - return this.findStumpNodesByChild(line)[0]
    - }
    - findStumpNodeByChildString(line) {
    - return this.getTopDownArray().find(node =>
    - node
    - .map(child => child.getLine())
    - .join("\n")
    - .includes(line)
    - )
    - }
    - findStumpNodeByFirstWord(firstWord) {
    - return this._findStumpNodesByBase(firstWord)[0]
    - }
    - _findStumpNodesByBase(firstWord) {
    - return this.getTopDownArray().filter(node => node.doesExtend("htmlTagNode") && node.getFirstWord() === firstWord)
    - }
    - hasLine(line) {
    - return this.getChildren().some(node => node.getLine() === line)
    - }
    - findStumpNodesByChild(line) {
    - return this.getTopDownArray().filter(node => node.doesExtend("htmlTagNode") && node.hasLine(line))
    - }
    - findStumpNodesWithClass(className) {
    - return this.getTopDownArray().filter(
    - node =>
    - node.doesExtend("htmlTagNode") &&
    - node.has("class") &&
    - node
    - .getNode("class")
    - .getWords()
    - .includes(className)
    - )
    - }
    - getShadowClass() {
    - return this.getParent().getShadowClass()
    - }
    - // todo: should not be here
    - getStumpNodeTreeComponent() {
    - return this._treeComponent || this.getParent().getStumpNodeTreeComponent()
    - }
    - // todo: should not be here
    - setStumpNodeTreeComponent(treeComponent) {
    - this._treeComponent = treeComponent
    - return this
    - }
    - setStumpNodeCss(css) {
    - this.getShadow().setShadowCss(css)
    - return this
    - }
    - getStumpNodeCss(prop) {
    - return this.getShadow().getShadowCss(prop)
    - }
    - getStumpNodeAttr(key) {
    - return this.get(key)
    - }
    - setStumpNodeAttr(key, value) {
    - // todo
    - return this
    - }
    - toHtml() {
    - return this._toHtml()
    - }
    - }
    -
    - class errorNode extends jtree.GrammarBackedNode {
    - getErrors() {
    - return this._getErrorNodeErrors()
    - }
    - }
    -
    - class htmlAttributeNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(errorNode, undefined, undefined)
    - }
    - get htmlAttributeNameCell() {
    - return this.getWord(0)
    - }
    - get attributeValueCell() {
    - return this.getWordsFrom(1)
    - }
    - get isTileAttribute() {
    - return true
    - }
    - get isAttributeNode() {
    - return true
    - }
    - _toHtml() {
    - return ""
    - }
    - getTextContent() {
    - return ""
    - }
    - getAttribute() {
    - return ` ${this.getFirstWord()}="${this.getContent()}"`
    - }
    - }
    -
    - class stumpExtendedAttributeNode extends htmlAttributeNode {
    - get stumpExtendedAttributeNameCell() {
    - return this.getWord(0)
    - }
    - }
    -
    - class lineOfHtmlContentNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(lineOfHtmlContentNode, undefined, undefined)
    - }
    - get anyHtmlContentCell() {
    - return this.getWordsFrom(0)
    - }
    - get isTileAttribute() {
    - return true
    - }
    - getTextContent() {
    - return this.getLine()
    - }
    - }
    -
    - class bernNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(lineOfHtmlContentNode, undefined, undefined)
    - }
    - get bernKeywordCell() {
    - return this.getWord(0)
    - }
    - get isTileAttribute() {
    - return true
    - }
    - _toHtml() {
    - return this.childrenToString()
    - }
    - getTextContent() {
    - return ""
    - }
    - }
    -
    - window.stumpNode = stumpNode
    - }
    - ;
    -
    - {
    - class fireNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - errorNode,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    - block: blockNode,
    - function: functionNode,
    - if: ifNode,
    - while: whileNode,
    - divide: divideNode,
    - modulo: moduloNode,
    - multiply: multiplyNode,
    - substract: substractNode,
    - add: addNode,
    - greaterThan: greaterThanNode,
    - greaterThanOrEqual: greaterThanOrEqualNode,
    - lessThan: lessThanNode,
    - lessThanOrEqual: lessThanOrEqualNode,
    - sum: sumNode,
    - boolean: booleanNode,
    - callFunctionAndSet: callFunctionAndSetNode,
    - callMethodAndSet: callMethodAndSetNode,
    - join: joinNode,
    - mutableNumber: mutableNumberNode,
    - number: numberNode,
    - numbers: numbersNode,
    - string: stringNode,
    - callFunction: callFunctionNode,
    - decrement: decrementNode,
    - dumpIdentifier: dumpIdentifierNode,
    - export: exportNode,
    - increment: incrementNode,
    - printNumber: printNumberNode,
    - printString: printStringNode,
    - require: requireNode,
    - return: returnNode,
    - "#!": hashbangNode
    - }),
    - undefined
    - )
    - }
    - async execute() {
    - let outputLines = []
    - const _originalConsoleLog = console.log
    - const tempConsoleLog = (...params) => outputLines.push(params)
    - console.log = tempConsoleLog
    - const compiled = this.compile("js")
    - eval(compiled)
    - console.log = _originalConsoleLog
    - console.log(outputLines.join("\n"))
    - return outputLines
    - }
    - getHandGrammarProgram() {
    - if (!this._cachedHandGrammarProgramRoot)
    - this._cachedHandGrammarProgramRoot = new jtree.HandGrammarProgram(`tooling onsave jtree build produceLang fire
    - todo Explore best ways to add polymorphism
    - anyCell
    - booleanCell
    - enum false true
    - filepathCell
    - identifierCell
    - regex [$A-Za-z_][0-9a-zA-Z_$]*
    - highlightScope variable
    - examples myVarA someVarB
    - numberCell
    - regex \\-?[0-9]*\\.?[0-9]*
    - highlightScope constant.numeric
    - numberIdentifierCell
    - extends identifierCell
    - hashBangCell
    - highlightScope comment
    - hashBangKeywordCell
    - highlightScope comment
    - stringCell
    - highlightScope string
    - booleanIdentifierCell
    - extends identifierCell
    - functionIdentifierCell
    - extends identifierCell
    - identifiersCell
    - extends identifierCell
    - instanceIdentifierCell
    - extends identifierCell
    - methodIdentifierCell
    - extends identifierCell
    - resultIdentifierCell
    - extends identifierCell
    - keywordCell
    - highlightScope keyword
    - stringIdentifierCell
    - extends identifierCell
    - stringCellsCell
    - extends stringCell
    - leftNumberCell
    - extends numberCell
    - leftAnyCell
    - extends anyCell
    - fireNode
    - root
    - description A useless prefix Tree Language that compiles to Javascript for testing Tree Notation features.
    - compilesTo js
    - inScope hashbangNode abstractTerminalNode abstractNonTerminalNode
    - catchAllNodeType errorNode
    - javascript
    - async execute() {
    - let outputLines = []
    - const _originalConsoleLog = console.log
    - const tempConsoleLog = (...params) => outputLines.push(params)
    - console.log = tempConsoleLog
    - const compiled = this.compile("js")
    - eval(compiled)
    - console.log = _originalConsoleLog
    - console.log(outputLines.join("\\n"))
    - return outputLines
    - }
    - abstractNonTerminalNode
    - inScope abstractTerminalNode abstractNonTerminalNode
    - abstract
    - cells keywordCell
    - abstractJsblockNode
    - compiler
    - openChildren {
    - closeChildren }
    - extends abstractNonTerminalNode
    - abstract
    - blockNode
    - description block of code
    - frequency .2
    - compiler
    - stringTemplate /* {identifierCell} */
    - extends abstractJsblockNode
    - crux block
    - functionNode
    - crux function
    - description Function Assignment
    - cells keywordCell functionIdentifierCell
    - catchAllCellType anyCell
    - compiler
    - stringTemplate const {functionIdentifierCell} = ({anyCell}) =>
    - catchAllCellDelimiter ,
    - frequency .1
    - extends abstractJsblockNode
    - ifNode
    - crux if
    - description If tile
    - cells keywordCell identifierCell
    - frequency .2
    - compiler
    - stringTemplate if ({identifierCell})
    - extends abstractJsblockNode
    - whileNode
    - crux while
    - description While tile
    - cells keywordCell identifierCell
    - frequency .1
    - compiler
    - stringTemplate while ({identifierCell})
    - extends abstractJsblockNode
    - abstractTerminalNode
    - abstract
    - cells keywordCell
    - abstractAssignmentNode
    - extends abstractTerminalNode
    - abstract
    - abstractArithmeticNode
    - cells keywordCell identifierCell
    - catchAllCellType anyCell
    - compiler
    - stringTemplate const {identifierCell} = {anyCell}
    - frequency .2
    - extends abstractAssignmentNode
    - abstract
    - divideNode
    - description Divide Numbers
    - compiler
    - catchAllCellDelimiter /
    - extends abstractArithmeticNode
    - crux divide
    - moduloNode
    - description Modulo Numbers
    - compiler
    - catchAllCellDelimiter %
    - extends abstractArithmeticNode
    - crux modulo
    - multiplyNode
    - description Multiply Numbers
    - compiler
    - catchAllCellDelimiter *
    - extends abstractArithmeticNode
    - crux multiply
    - substractNode
    - description Subtract Numbers
    - compiler
    - catchAllCellDelimiter -
    - extends abstractArithmeticNode
    - crux substract
    - addNode
    - crux add
    - example
    - add ten 2 3 5
    - description Add numbers and store result
    - compiler
    - catchAllCellDelimiter +
    - extends abstractArithmeticNode
    - abstractBooleanOperatorNode
    - description Runs a boolean test and saves result.
    - extends abstractAssignmentNode
    - abstract
    - greaterThanNode
    - description Greater than test
    - cells keywordCell identifierCell leftNumberCell numberCell
    - compiler
    - stringTemplate const {identifierCell} = {leftNumberCell} > {numberCell}
    - frequency .1
    - extends abstractBooleanOperatorNode
    - crux greaterThan
    - greaterThanOrEqualNode
    - description Greater than or equal to test
    - cells keywordCell identifierCell leftNumberCell numberCell
    - compiler
    - stringTemplate const {identifierCell} = {leftNumberCell} >= {numberCell}
    - frequency .1
    - extends abstractBooleanOperatorNode
    - crux greaterThanOrEqual
    - lessThanNode
    - description Less than test
    - cells keywordCell identifierCell leftAnyCell anyCell
    - compiler
    - stringTemplate const {identifierCell} = {leftAnyCell} < {anyCell}
    - frequency .1
    - extends abstractBooleanOperatorNode
    - crux lessThan
    - lessThanOrEqualNode
    - crux lessThanOrEqual
    - description Less than or equal to test
    - cells keywordCell identifierCell leftAnyCell anyCell
    - compiler
    - stringTemplate const {identifierCell} = {leftAnyCell} <= {anyCell}
    - frequency .1
    - extends abstractBooleanOperatorNode
    - sumNode
    - crux sum
    - description Add numbers and store result
    - cells keywordCell numberIdentifierCell
    - catchAllCellType numberCell
    - compiler
    - stringTemplate const {numberIdentifierCell} = [{numberCell}].reduce((sum, num) => sum + num)
    - catchAllCellDelimiter ,
    - frequency .1
    - extends abstractAssignmentNode
    - booleanNode
    - crux boolean
    - description Boolean Assignment
    - cells keywordCell booleanIdentifierCell booleanCell
    - compiler
    - stringTemplate const {booleanIdentifierCell} = {booleanCell}
    - extends abstractAssignmentNode
    - callFunctionAndSetNode
    - crux callFunctionAndSet
    - description Function Call
    - frequency .5
    - cells keywordCell resultIdentifierCell functionIdentifierCell
    - catchAllCellType anyCell
    - compiler
    - stringTemplate const {resultIdentifierCell} = {functionIdentifierCell}({anyCell})
    - catchAllCellDelimiter ,
    - extends abstractAssignmentNode
    - callMethodAndSetNode
    - crux callMethodAndSet
    - description Method Call
    - frequency .5
    - cells keywordCell resultIdentifierCell instanceIdentifierCell methodIdentifierCell
    - catchAllCellType anyCell
    - compiler
    - stringTemplate const {resultIdentifierCell} = {instanceIdentifierCell}.{methodIdentifierCell}({anyCell})
    - catchAllCellDelimiter ,
    - extends abstractAssignmentNode
    - joinNode
    - crux join
    - description Join strings to form new string
    - cells keywordCell identifierCell
    - catchAllCellType identifiersCell
    - compiler
    - stringTemplate const {identifierCell} = [{identifiersCell}].join("")
    - catchAllCellDelimiter ,
    - frequency .2
    - extends abstractAssignmentNode
    - mutableNumberNode
    - crux mutableNumber
    - description Mutable Number Assignment
    - cells keywordCell identifierCell numberCell
    - compiler
    - stringTemplate let {identifierCell} = {numberCell}
    - extends abstractAssignmentNode
    - numberNode
    - crux number
    - description Number Assignment
    - cells keywordCell identifierCell numberCell
    - compiler
    - stringTemplate const {identifierCell} = {numberCell}
    - frequency .3
    - extends abstractAssignmentNode
    - numbersNode
    - crux numbers
    - description Number Array Assignment
    - cells keywordCell identifierCell
    - catchAllCellType numberCell
    - frequency .4
    - compiler
    - stringTemplate const {identifierCell} = [{numberCell}]
    - catchAllCellDelimiter ,
    - extends abstractAssignmentNode
    - stringNode
    - crux string
    - description String Assignment
    - cells keywordCell stringIdentifierCell
    - catchAllCellType anyCell
    - compiler
    - stringTemplate const {stringIdentifierCell} = "{anyCell}"
    - frequency .2
    - extends abstractAssignmentNode
    - callFunctionNode
    - crux callFunction
    - description Function call ignore result.
    - frequency .1
    - cells keywordCell functionIdentifierCell
    - catchAllCellType anyCell
    - compiler
    - stringTemplate {functionIdentifierCell}({anyCell})
    - catchAllCellDelimiter ,
    - extends abstractTerminalNode
    - decrementNode
    - crux decrement
    - description Decrement
    - cells keywordCell numberIdentifierCell
    - compiler
    - stringTemplate {numberIdentifierCell}--
    - frequency .1
    - extends abstractTerminalNode
    - dumpIdentifierNode
    - crux dumpIdentifier
    - description Dump variable(s) to console
    - catchAllCellType identifierCell
    - compiler
    - stringTemplate console.log({identifierCell})
    - catchAllCellDelimiter ,
    - frequency .5
    - extends abstractTerminalNode
    - exportNode
    - crux export
    - description Export This
    - cells keywordCell identifierCell
    - compiler
    - stringTemplate module.exports = {identifierCell}
    - frequency .1
    - extends abstractTerminalNode
    - incrementNode
    - crux increment
    - description Increment
    - frequency .3
    - cells keywordCell numberIdentifierCell
    - compiler
    - stringTemplate {numberIdentifierCell}++
    - extends abstractTerminalNode
    - printNumberNode
    - crux printNumber
    - extends abstractTerminalNode
    - catchAllCellType numberIdentifierCell
    - compiler
    - stringTemplate console.log({numberIdentifierCell})
    - printStringNode
    - crux printString
    - todo Allow printing of multiline strings
    - extends abstractTerminalNode
    - catchAllCellType stringCellsCell
    - compiler
    - stringTemplate console.log("{stringCells}")
    - requireNode
    - crux require
    - description Require Something
    - cells keywordCell identifierCell filepathCell
    - compiler
    - stringTemplate const {identifierCell} = require("{filepathCell}")
    - frequency .1
    - extends abstractTerminalNode
    - returnNode
    - crux return
    - cells keywordCell anyCell
    - compiler
    - stringTemplate return {anyCell}
    - frequency .1
    - extends abstractTerminalNode
    - hashbangNode
    - crux #!
    - description Standard bash hashbang line.
    - catchAllCellType hashBangCell
    - compiler
    - stringTemplate // #! {hashBangCell}
    - cells hashBangKeywordCell
    - errorNode
    - baseNodeType errorNode
    - compiler
    - stringTemplate // error`)
    - return this._cachedHandGrammarProgramRoot
    - }
    - static getNodeTypeMap() {
    - return {
    - fireNode: fireNode,
    - abstractNonTerminalNode: abstractNonTerminalNode,
    - abstractJsblockNode: abstractJsblockNode,
    - blockNode: blockNode,
    - functionNode: functionNode,
    - ifNode: ifNode,
    - whileNode: whileNode,
    - abstractTerminalNode: abstractTerminalNode,
    - abstractAssignmentNode: abstractAssignmentNode,
    - abstractArithmeticNode: abstractArithmeticNode,
    - divideNode: divideNode,
    - moduloNode: moduloNode,
    - multiplyNode: multiplyNode,
    - substractNode: substractNode,
    - addNode: addNode,
    - abstractBooleanOperatorNode: abstractBooleanOperatorNode,
    - greaterThanNode: greaterThanNode,
    - greaterThanOrEqualNode: greaterThanOrEqualNode,
    - lessThanNode: lessThanNode,
    - lessThanOrEqualNode: lessThanOrEqualNode,
    - sumNode: sumNode,
    - booleanNode: booleanNode,
    - callFunctionAndSetNode: callFunctionAndSetNode,
    - callMethodAndSetNode: callMethodAndSetNode,
    - joinNode: joinNode,
    - mutableNumberNode: mutableNumberNode,
    - numberNode: numberNode,
    - numbersNode: numbersNode,
    - stringNode: stringNode,
    - callFunctionNode: callFunctionNode,
    - decrementNode: decrementNode,
    - dumpIdentifierNode: dumpIdentifierNode,
    - exportNode: exportNode,
    - incrementNode: incrementNode,
    - printNumberNode: printNumberNode,
    - printStringNode: printStringNode,
    - requireNode: requireNode,
    - returnNode: returnNode,
    - hashbangNode: hashbangNode,
    - errorNode: errorNode
    - }
    - }
    - }
    -
    - class abstractNonTerminalNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    - block: blockNode,
    - function: functionNode,
    - if: ifNode,
    - while: whileNode,
    - divide: divideNode,
    - modulo: moduloNode,
    - multiply: multiplyNode,
    - substract: substractNode,
    - add: addNode,
    - greaterThan: greaterThanNode,
    - greaterThanOrEqual: greaterThanOrEqualNode,
    - lessThan: lessThanNode,
    - lessThanOrEqual: lessThanOrEqualNode,
    - sum: sumNode,
    - boolean: booleanNode,
    - callFunctionAndSet: callFunctionAndSetNode,
    - callMethodAndSet: callMethodAndSetNode,
    - join: joinNode,
    - mutableNumber: mutableNumberNode,
    - number: numberNode,
    - numbers: numbersNode,
    - string: stringNode,
    - callFunction: callFunctionNode,
    - decrement: decrementNode,
    - dumpIdentifier: dumpIdentifierNode,
    - export: exportNode,
    - increment: incrementNode,
    - printNumber: printNumberNode,
    - printString: printStringNode,
    - require: requireNode,
    - return: returnNode
    - }),
    - undefined
    - )
    - }
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - }
    -
    - class abstractJsblockNode extends abstractNonTerminalNode {}
    -
    - class blockNode extends abstractJsblockNode {}
    -
    - class functionNode extends abstractJsblockNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get functionIdentifierCell() {
    - return this.getWord(1)
    - }
    - get anyCell() {
    - return this.getWordsFrom(2)
    - }
    - }
    -
    - class ifNode extends abstractJsblockNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get identifierCell() {
    - return this.getWord(1)
    - }
    - }
    -
    - class whileNode extends abstractJsblockNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get identifierCell() {
    - return this.getWord(1)
    - }
    - }
    -
    - class abstractTerminalNode extends jtree.GrammarBackedNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - }
    -
    - class abstractAssignmentNode extends abstractTerminalNode {}
    -
    - class abstractArithmeticNode extends abstractAssignmentNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get identifierCell() {
    - return this.getWord(1)
    - }
    - get anyCell() {
    - return this.getWordsFrom(2)
    - }
    - }
    -
    - class divideNode extends abstractArithmeticNode {}
    -
    - class moduloNode extends abstractArithmeticNode {}
    -
    - class multiplyNode extends abstractArithmeticNode {}
    -
    - class substractNode extends abstractArithmeticNode {}
    -
    - class addNode extends abstractArithmeticNode {}
    -
    - class abstractBooleanOperatorNode extends abstractAssignmentNode {}
    -
    - class greaterThanNode extends abstractBooleanOperatorNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get identifierCell() {
    - return this.getWord(1)
    - }
    - get leftNumberCell() {
    - return parseFloat(this.getWord(2))
    - }
    - get numberCell() {
    - return parseFloat(this.getWord(3))
    - }
    - }
    -
    - class greaterThanOrEqualNode extends abstractBooleanOperatorNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get identifierCell() {
    - return this.getWord(1)
    - }
    - get leftNumberCell() {
    - return parseFloat(this.getWord(2))
    - }
    - get numberCell() {
    - return parseFloat(this.getWord(3))
    - }
    - }
    -
    - class lessThanNode extends abstractBooleanOperatorNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get identifierCell() {
    - return this.getWord(1)
    - }
    - get leftAnyCell() {
    - return this.getWord(2)
    - }
    - get anyCell() {
    - return this.getWord(3)
    - }
    - }
    -
    - class lessThanOrEqualNode extends abstractBooleanOperatorNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get identifierCell() {
    - return this.getWord(1)
    - }
    - get leftAnyCell() {
    - return this.getWord(2)
    - }
    - get anyCell() {
    - return this.getWord(3)
    - }
    - }
    -
    - class sumNode extends abstractAssignmentNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get numberIdentifierCell() {
    - return this.getWord(1)
    - }
    - get numberCell() {
    - return this.getWordsFrom(2).map(val => parseFloat(val))
    - }
    - }
    -
    - class booleanNode extends abstractAssignmentNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get booleanIdentifierCell() {
    - return this.getWord(1)
    - }
    - get booleanCell() {
    - return this.getWord(2)
    - }
    - }
    -
    - class callFunctionAndSetNode extends abstractAssignmentNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get resultIdentifierCell() {
    - return this.getWord(1)
    - }
    - get functionIdentifierCell() {
    - return this.getWord(2)
    - }
    - get anyCell() {
    - return this.getWordsFrom(3)
    - }
    - }
    -
    - class callMethodAndSetNode extends abstractAssignmentNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get resultIdentifierCell() {
    - return this.getWord(1)
    - }
    - get instanceIdentifierCell() {
    - return this.getWord(2)
    - }
    - get methodIdentifierCell() {
    - return this.getWord(3)
    - }
    - get anyCell() {
    - return this.getWordsFrom(4)
    - }
    - }
    -
    - class joinNode extends abstractAssignmentNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get identifierCell() {
    - return this.getWord(1)
    - }
    - get identifiersCell() {
    - return this.getWordsFrom(2)
    - }
    - }
    -
    - class mutableNumberNode extends abstractAssignmentNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get identifierCell() {
    - return this.getWord(1)
    - }
    - get numberCell() {
    - return parseFloat(this.getWord(2))
    - }
    - }
    -
    - class numberNode extends abstractAssignmentNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get identifierCell() {
    - return this.getWord(1)
    - }
    - get numberCell() {
    - return parseFloat(this.getWord(2))
    - }
    - }
    -
    - class numbersNode extends abstractAssignmentNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get identifierCell() {
    - return this.getWord(1)
    - }
    - get numberCell() {
    - return this.getWordsFrom(2).map(val => parseFloat(val))
    - }
    - }
    -
    - class stringNode extends abstractAssignmentNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get stringIdentifierCell() {
    - return this.getWord(1)
    - }
    - get anyCell() {
    - return this.getWordsFrom(2)
    - }
    - }
    -
    - class callFunctionNode extends abstractTerminalNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get functionIdentifierCell() {
    - return this.getWord(1)
    - }
    - get anyCell() {
    - return this.getWordsFrom(2)
    - }
    - }
    -
    - class decrementNode extends abstractTerminalNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get numberIdentifierCell() {
    - return this.getWord(1)
    - }
    - }
    -
    - class dumpIdentifierNode extends abstractTerminalNode {
    - get identifierCell() {
    - return this.getWordsFrom(0)
    - }
    - }
    -
    - class exportNode extends abstractTerminalNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get identifierCell() {
    - return this.getWord(1)
    - }
    - }
    -
    - class incrementNode extends abstractTerminalNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get numberIdentifierCell() {
    - return this.getWord(1)
    - }
    - }
    -
    - class printNumberNode extends abstractTerminalNode {
    - get numberIdentifierCell() {
    - return this.getWordsFrom(0)
    - }
    - }
    -
    - class printStringNode extends abstractTerminalNode {
    - get stringCellsCell() {
    - return this.getWordsFrom(0)
    - }
    - }
    -
    - class requireNode extends abstractTerminalNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get identifierCell() {
    - return this.getWord(1)
    - }
    - get filepathCell() {
    - return this.getWord(2)
    - }
    - }
    -
    - class returnNode extends abstractTerminalNode {
    - get keywordCell() {
    - return this.getWord(0)
    - }
    - get anyCell() {
    - return this.getWord(1)
    - }
    - }
    -
    - class hashbangNode extends jtree.GrammarBackedNode {
    - get hashBangKeywordCell() {
    - return this.getWord(0)
    - }
    - get hashBangCell() {
    - return this.getWordsFrom(1)
    - }
    - }
    -
    - class errorNode extends jtree.GrammarBackedNode {
    - getErrors() {
    - return this._getErrorNodeErrors()
    - }
    - }
    -
    - window.fireNode = fireNode
    - }
    - ;
    -
    - {
    - class hakonNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - selectorNode,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { comment: commentNode }),
    - undefined
    - )
    - }
    - getSelector() {
    - return ""
    - }
    - compile() {
    - return this.getTopDownArray()
    - .filter(node => node.isSelectorNode)
    - .map(child => child.compile())
    - .join("")
    - }
    - getHandGrammarProgram() {
    - if (!this._cachedHandGrammarProgramRoot)
    - this._cachedHandGrammarProgramRoot = new jtree.HandGrammarProgram(`tooling onsave jtree build produceLang hakon
    - anyCell
    - keywordCell
    - commentKeywordCell
    - extends keywordCell
    - highlightScope comment
    - enum comment
    - extraCell
    - highlightScope invalid
    - cssValueCell
    - highlightScope constant.numeric
    - selectorCell
    - highlightScope keyword.control
    - examples body h1
    - todo add html tags, css and ids selector regexes, etc
    - propertyKeywordCell
    - highlightScope variable.function
    - extends keywordCell
    - enum align-content align-items align-self all animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function backface-visibility background background-attachment background-blend-mode background-clip background-color background-image background-origin background-position background-repeat background-size border border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom box-shadow box-sizing caption-side clear clip color column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns content counter-increment counter-reset cursor direction display empty-cells fill filter flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float font @font-face font-family font-size font-size-adjust font-stretch font-style font-variant font-weight hanging-punctuation height justify-content @keyframes left letter-spacing line-height list-style list-style-image list-style-position list-style-type margin margin-bottom margin-left margin-right margin-top max-height max-width @media min-height min-width nav-down nav-index nav-left nav-right nav-up opacity order outline outline-color outline-offset outline-style outline-width overflow overflow-x overflow-y padding padding-bottom padding-left padding-right padding-top page-break-after page-break-before page-break-inside perspective perspective-origin position quotes resize right tab-size table-layout text-align text-align-last text-decoration text-decoration-color text-decoration-line text-decoration-style text-indent text-justify text-overflow text-shadow text-transform top transform transform-origin transform-style transition transition-delay transition-duration transition-property transition-timing-function unicode-bidi vertical-align visibility white-space width word-break word-spacing word-wrap z-index overscroll-behavior-x user-select -ms-touch-action -webkit-user-select -webkit-touch-callout -moz-user-select touch-action -ms-user-select -khtml-user-select
    - errorCell
    - highlightScope invalid
    - commentCell
    - highlightScope comment
    - hakonNode
    - root
    - todo Add variables?
    - description A prefix Tree Language that compiles to CSS
    - compilesTo css
    - inScope commentNode
    - catchAllNodeType selectorNode
    - javascript
    - getSelector() {
    - return ""
    - }
    - compile() {
    - return this.getTopDownArray()
    - .filter(node => node.isSelectorNode)
    - .map(child => child.compile())
    - .join("")
    - }
    - example A basic example
    - body
    - font-size 12px
    - h1,h2
    - color red
    - a
    - &:hover
    - color blue
    - font-size 17px
    - propertyNode
    - catchAllCellType cssValueCell
    - catchAllNodeType errorNode
    - javascript
    - compile(spaces) {
    - return \`\${spaces}\${this.getFirstWord()}: \${this.getContent()};\`
    - }
    - cells propertyKeywordCell
    - variableNode
    - extends propertyNode
    - pattern --
    - errorNode
    - catchAllNodeType errorNode
    - catchAllCellType errorCell
    - baseNodeType errorNode
    - commentNode
    - cells commentKeywordCell
    - catchAllCellType commentCell
    - catchAllNodeType commentNode
    - selectorNode
    - inScope propertyNode variableNode commentNode
    - catchAllNodeType selectorNode
    - boolean isSelectorNode true
    - javascript
    - getSelector() {
    - const parentSelector = this.getParent().getSelector()
    - return this.getFirstWord()
    - .split(",")
    - .map(part => {
    - if (part.startsWith("&")) return parentSelector + part.substr(1)
    - return parentSelector ? parentSelector + " " + part : part
    - })
    - .join(",")
    - }
    - compile() {
    - const propertyNodes = this.getChildren().filter(node => node.doesExtend("propertyNode"))
    - if (!propertyNodes.length) return ""
    - const spaces = " "
    - return \`\${this.getSelector()} {
    - \${propertyNodes.map(child => child.compile(spaces)).join("\\n")}
    - }\\n\`
    - }
    - cells selectorCell`)
    - return this._cachedHandGrammarProgramRoot
    - }
    - static getNodeTypeMap() {
    - return {
    - hakonNode: hakonNode,
    - propertyNode: propertyNode,
    - variableNode: variableNode,
    - errorNode: errorNode,
    - commentNode: commentNode,
    - selectorNode: selectorNode
    - }
    - }
    - }
    -
    - class propertyNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(errorNode, undefined, undefined)
    - }
    - get propertyKeywordCell() {
    - return this.getWord(0)
    - }
    - get cssValueCell() {
    - return this.getWordsFrom(1)
    - }
    - compile(spaces) {
    - return `${spaces}${this.getFirstWord()}: ${this.getContent()};`
    - }
    - }
    -
    - class variableNode extends propertyNode {}
    -
    - class errorNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(errorNode, undefined, undefined)
    - }
    - getErrors() {
    - return this._getErrorNodeErrors()
    - }
    - get errorCell() {
    - return this.getWordsFrom(0)
    - }
    - }
    -
    - class commentNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(commentNode, undefined, undefined)
    - }
    - get commentKeywordCell() {
    - return this.getWord(0)
    - }
    - get commentCell() {
    - return this.getWordsFrom(1)
    - }
    - }
    -
    - class selectorNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - selectorNode,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    - "border-bottom-right-radius": propertyNode,
    - "transition-timing-function": propertyNode,
    - "animation-iteration-count": propertyNode,
    - "animation-timing-function": propertyNode,
    - "border-bottom-left-radius": propertyNode,
    - "border-top-right-radius": propertyNode,
    - "border-top-left-radius": propertyNode,
    - "background-attachment": propertyNode,
    - "background-blend-mode": propertyNode,
    - "text-decoration-color": propertyNode,
    - "text-decoration-style": propertyNode,
    - "overscroll-behavior-x": propertyNode,
    - "-webkit-touch-callout": propertyNode,
    - "animation-play-state": propertyNode,
    - "text-decoration-line": propertyNode,
    - "animation-direction": propertyNode,
    - "animation-fill-mode": propertyNode,
    - "backface-visibility": propertyNode,
    - "background-position": propertyNode,
    - "border-bottom-color": propertyNode,
    - "border-bottom-style": propertyNode,
    - "border-bottom-width": propertyNode,
    - "border-image-outset": propertyNode,
    - "border-image-repeat": propertyNode,
    - "border-image-source": propertyNode,
    - "hanging-punctuation": propertyNode,
    - "list-style-position": propertyNode,
    - "transition-duration": propertyNode,
    - "transition-property": propertyNode,
    - "-webkit-user-select": propertyNode,
    - "animation-duration": propertyNode,
    - "border-image-slice": propertyNode,
    - "border-image-width": propertyNode,
    - "border-right-color": propertyNode,
    - "border-right-style": propertyNode,
    - "border-right-width": propertyNode,
    - "perspective-origin": propertyNode,
    - "-khtml-user-select": propertyNode,
    - "background-origin": propertyNode,
    - "background-repeat": propertyNode,
    - "border-left-color": propertyNode,
    - "border-left-style": propertyNode,
    - "border-left-width": propertyNode,
    - "column-rule-color": propertyNode,
    - "column-rule-style": propertyNode,
    - "column-rule-width": propertyNode,
    - "counter-increment": propertyNode,
    - "page-break-before": propertyNode,
    - "page-break-inside": propertyNode,
    - "background-color": propertyNode,
    - "background-image": propertyNode,
    - "border-top-color": propertyNode,
    - "border-top-style": propertyNode,
    - "border-top-width": propertyNode,
    - "font-size-adjust": propertyNode,
    - "list-style-image": propertyNode,
    - "page-break-after": propertyNode,
    - "transform-origin": propertyNode,
    - "transition-delay": propertyNode,
    - "-ms-touch-action": propertyNode,
    - "-moz-user-select": propertyNode,
    - "animation-delay": propertyNode,
    - "background-clip": propertyNode,
    - "background-size": propertyNode,
    - "border-collapse": propertyNode,
    - "justify-content": propertyNode,
    - "list-style-type": propertyNode,
    - "text-align-last": propertyNode,
    - "text-decoration": propertyNode,
    - "transform-style": propertyNode,
    - "-ms-user-select": propertyNode,
    - "animation-name": propertyNode,
    - "border-spacing": propertyNode,
    - "flex-direction": propertyNode,
    - "letter-spacing": propertyNode,
    - "outline-offset": propertyNode,
    - "padding-bottom": propertyNode,
    - "text-transform": propertyNode,
    - "vertical-align": propertyNode,
    - "align-content": propertyNode,
    - "border-bottom": propertyNode,
    - "border-radius": propertyNode,
    - "counter-reset": propertyNode,
    - "margin-bottom": propertyNode,
    - "outline-color": propertyNode,
    - "outline-style": propertyNode,
    - "outline-width": propertyNode,
    - "padding-right": propertyNode,
    - "text-overflow": propertyNode,
    - "border-color": propertyNode,
    - "border-image": propertyNode,
    - "border-right": propertyNode,
    - "border-style": propertyNode,
    - "border-width": propertyNode,
    - "caption-side": propertyNode,
    - "column-count": propertyNode,
    - "column-width": propertyNode,
    - "font-stretch": propertyNode,
    - "font-variant": propertyNode,
    - "margin-right": propertyNode,
    - "padding-left": propertyNode,
    - "table-layout": propertyNode,
    - "text-justify": propertyNode,
    - "unicode-bidi": propertyNode,
    - "word-spacing": propertyNode,
    - "touch-action": propertyNode,
    - "align-items": propertyNode,
    - "border-left": propertyNode,
    - "column-fill": propertyNode,
    - "column-rule": propertyNode,
    - "column-span": propertyNode,
    - "empty-cells": propertyNode,
    - "flex-shrink": propertyNode,
    - "font-family": propertyNode,
    - "font-weight": propertyNode,
    - "line-height": propertyNode,
    - "margin-left": propertyNode,
    - "padding-top": propertyNode,
    - perspective: propertyNode,
    - "text-indent": propertyNode,
    - "text-shadow": propertyNode,
    - "white-space": propertyNode,
    - "user-select": propertyNode,
    - "align-self": propertyNode,
    - background: propertyNode,
    - "border-top": propertyNode,
    - "box-shadow": propertyNode,
    - "box-sizing": propertyNode,
    - "column-gap": propertyNode,
    - "flex-basis": propertyNode,
    - "@font-face": propertyNode,
    - "font-style": propertyNode,
    - "@keyframes": propertyNode,
    - "list-style": propertyNode,
    - "margin-top": propertyNode,
    - "max-height": propertyNode,
    - "min-height": propertyNode,
    - "overflow-x": propertyNode,
    - "overflow-y": propertyNode,
    - "text-align": propertyNode,
    - transition: propertyNode,
    - visibility: propertyNode,
    - "word-break": propertyNode,
    - animation: propertyNode,
    - direction: propertyNode,
    - "flex-flow": propertyNode,
    - "flex-grow": propertyNode,
    - "flex-wrap": propertyNode,
    - "font-size": propertyNode,
    - "max-width": propertyNode,
    - "min-width": propertyNode,
    - "nav-index": propertyNode,
    - "nav-right": propertyNode,
    - transform: propertyNode,
    - "word-wrap": propertyNode,
    - "nav-down": propertyNode,
    - "nav-left": propertyNode,
    - overflow: propertyNode,
    - position: propertyNode,
    - "tab-size": propertyNode,
    - columns: propertyNode,
    - content: propertyNode,
    - display: propertyNode,
    - opacity: propertyNode,
    - outline: propertyNode,
    - padding: propertyNode,
    - "z-index": propertyNode,
    - border: propertyNode,
    - bottom: propertyNode,
    - cursor: propertyNode,
    - filter: propertyNode,
    - height: propertyNode,
    - margin: propertyNode,
    - "@media": propertyNode,
    - "nav-up": propertyNode,
    - quotes: propertyNode,
    - resize: propertyNode,
    - clear: propertyNode,
    - color: propertyNode,
    - float: propertyNode,
    - order: propertyNode,
    - right: propertyNode,
    - width: propertyNode,
    - clip: propertyNode,
    - fill: propertyNode,
    - flex: propertyNode,
    - font: propertyNode,
    - left: propertyNode,
    - all: propertyNode,
    - top: propertyNode,
    - comment: commentNode
    - }),
    - [{ regex: /--/, nodeConstructor: variableNode }]
    - )
    - }
    - get selectorCell() {
    - return this.getWord(0)
    - }
    - get isSelectorNode() {
    - return true
    - }
    - getSelector() {
    - const parentSelector = this.getParent().getSelector()
    - return this.getFirstWord()
    - .split(",")
    - .map(part => {
    - if (part.startsWith("&")) return parentSelector + part.substr(1)
    - return parentSelector ? parentSelector + " " + part : part
    - })
    - .join(",")
    - }
    - compile() {
    - const propertyNodes = this.getChildren().filter(node => node.doesExtend("propertyNode"))
    - if (!propertyNodes.length) return ""
    - const spaces = " "
    - return `${this.getSelector()} {
    - ${propertyNodes.map(child => child.compile(spaces)).join("\n")}
    - }\n`
    - }
    - }
    -
    - window.hakonNode = hakonNode
    - }
    - ;
    -
    - const BrowserEvents = {}
    - BrowserEvents.click = "click"
    - BrowserEvents.change = "change"
    - BrowserEvents.mouseover = "mouseover"
    - BrowserEvents.mouseout = "mouseout"
    - BrowserEvents.mousedown = "mousedown"
    - BrowserEvents.contextmenu = "contextmenu"
    - BrowserEvents.keypress = "keypress"
    - BrowserEvents.keyup = "keyup"
    - BrowserEvents.focus = "focus"
    - BrowserEvents.mousemove = "mousemove"
    - BrowserEvents.dblclick = "dblclick"
    - BrowserEvents.submit = "submit"
    - BrowserEvents.blur = "blur"
    - BrowserEvents.paste = "paste"
    - BrowserEvents.copy = "copy"
    - BrowserEvents.resize = "resize"
    - BrowserEvents.cut = "cut"
    - BrowserEvents.drop = "drop"
    - BrowserEvents.dragover = "dragover"
    - BrowserEvents.dragenter = "dragenter"
    - BrowserEvents.dragleave = "dragleave"
    - BrowserEvents.ready = "ready"
    - const WillowConstants = {}
    - // todo: cleanup
    - WillowConstants.clickCommand = "clickCommand"
    - WillowConstants.shiftClickCommand = "shiftClickCommand"
    - WillowConstants.blurCommand = "blurCommand"
    - WillowConstants.contextMenuCommand = "contextMenuCommand"
    - WillowConstants.changeCommand = "changeCommand"
    - WillowConstants.doubleClickCommand = "doubleClickCommand"
    - // todo: cleanup
    - WillowConstants.titleTag = "titleTag"
    - WillowConstants.styleTag = "styleTag"
    - WillowConstants.tagMap = {}
    - WillowConstants.tagMap[WillowConstants.styleTag] = "style"
    - WillowConstants.tagMap[WillowConstants.titleTag] = "title"
    - WillowConstants.tags = {}
    - WillowConstants.tags.html = "html"
    - WillowConstants.tags.head = "head"
    - WillowConstants.tags.body = "body"
    - WillowConstants.collapse = "collapse"
    - WillowConstants.uidAttribute = "stumpUid"
    - WillowConstants.class = "class"
    - WillowConstants.type = "type"
    - WillowConstants.value = "value"
    - WillowConstants.name = "name"
    - WillowConstants.checkbox = "checkbox"
    - WillowConstants.checkedSelector = ":checked"
    - WillowConstants.contenteditable = "contenteditable"
    - WillowConstants.inputTypes = ["input", "textarea"]
    - var CacheType
    - ;(function(CacheType) {
    - CacheType["inBrowserMemory"] = "inBrowserMemory"
    - })(CacheType || (CacheType = {}))
    - class WillowHTTPResponse {
    - constructor(superAgentResponse) {
    - this._cacheType = CacheType.inBrowserMemory
    - this._fromCache = false
    - this._cacheTime = Date.now()
    - this._superAgentResponse = superAgentResponse
    - this._mimeType = superAgentResponse && superAgentResponse.type
    - }
    - // todo: ServerMemoryCacheTime and ServerMemoryDiskCacheTime
    - get cacheTime() {
    - return this._cacheTime
    - }
    - get cacheType() {
    - return this._cacheType
    - }
    - get body() {
    - return this._superAgentResponse && this._superAgentResponse.body
    - }
    - get text() {
    - if (this._text === undefined) this._text = this._superAgentResponse && this._superAgentResponse.text ? this._superAgentResponse.text : this.body ? JSON.stringify(this.body, null, 2) : ""
    - return this._text
    - }
    - get asJson() {
    - return this.body ? this.body : JSON.parse(this.text)
    - }
    - get fromCache() {
    - return this._fromCache
    - }
    - setFromCache(val) {
    - this._fromCache = val
    - return this
    - }
    - getParsedDataOrText() {
    - if (this._mimeType === "text/csv") return this.text
    - return this.body || this.text
    - }
    - }
    - class WillowHTTPProxyCacheResponse extends WillowHTTPResponse {
    - constructor(proxyServerResponse) {
    - super()
    - this._proxyServerResponse = proxyServerResponse
    - this._cacheType = proxyServerResponse.body.cacheType
    - this._cacheTime = proxyServerResponse.body.cacheTime
    - this._text = proxyServerResponse.body.text
    - }
    - }
    - class AbstractWillowShadow {
    - constructor(stumpNode) {
    - this._stumpNode = stumpNode
    - }
    - getShadowStumpNode() {
    - return this._stumpNode
    - }
    - getShadowValue() {
    - return this._val
    - }
    - removeShadow() {
    - return this
    - }
    - setInputOrTextAreaValue(value) {
    - this._val = value
    - return this
    - }
    - getShadowParent() {
    - return this.getShadowStumpNode()
    - .getParent()
    - .getShadow()
    - }
    - getPositionAndDimensions(gridSize = 1) {
    - const offset = this.getShadowOffset()
    - const parentOffset = this.getShadowParent().getShadowOffset()
    - return {
    - left: Math.floor((offset.left - parentOffset.left) / gridSize),
    - top: Math.floor((offset.top - parentOffset.top) / gridSize),
    - width: Math.floor(this.getShadowWidth() / gridSize),
    - height: Math.floor(this.getShadowHeight() / gridSize)
    - }
    - }
    - shadowHasClass(name) {
    - return false
    - }
    - getShadowAttr(name) {
    - return ""
    - }
    - makeResizable(options) {
    - return this
    - }
    - makeDraggable(options) {
    - return this
    - }
    - makeSelectable(options) {
    - return this
    - }
    - isShadowChecked() {
    - return false
    - }
    - getShadowHtml() {
    - return ""
    - }
    - getShadowOffset() {
    - return { left: 111, top: 111 }
    - }
    - getShadowWidth() {
    - return 111
    - }
    - getShadowHeight() {
    - return 111
    - }
    - setShadowAttr(name, value) {
    - return this
    - }
    - isShadowDraggable() {
    - return this.shadowHasClass("draggable")
    - }
    - toggleShadow() {}
    - addClassToShadow(className) {}
    - removeClassFromShadow(className) {
    - return this
    - }
    - onShadowEvent(event, selector, fn) {
    - // todo:
    - return this
    - }
    - offShadowEvent(event, fn) {
    - // todo:
    - return this
    - }
    - triggerShadowEvent(name) {
    - return this
    - }
    - getShadowPosition() {
    - return {
    - left: 111,
    - top: 111
    - }
    - }
    - getShadowOuterHeight() {
    - return 11
    - }
    - getShadowOuterWidth() {
    - return 11
    - }
    - getShadowCss(property) {
    - return ""
    - }
    - setShadowCss(css) {
    - return this
    - }
    - insertHtmlNode(childNode, index) {}
    - getShadowElement() {}
    - }
    - class WillowShadow extends AbstractWillowShadow {}
    - class WillowStore {
    - constructor() {
    - this._values = {}
    - }
    - get(key) {
    - return this._values[key]
    - }
    - set(key, value) {
    - this._values[key] = value
    - return this
    - }
    - remove(key) {
    - delete this._values[key]
    - }
    - each(fn) {
    - Object.keys(this._values).forEach(key => {
    - fn(this._values[key], key)
    - })
    - }
    - clearAll() {
    - this._values = {}
    - }
    - }
    - class WillowMousetrap {
    - constructor() {
    - this.prototype = {}
    - }
    - bind() {}
    - }
    - // this one should have no document, window, $, et cetera.
    - class AbstractWillowBrowser extends stumpNode {
    - constructor(fullHtmlPageUrlIncludingProtocolAndFileName) {
    - super(`${WillowConstants.tags.html}
    - ${WillowConstants.tags.head}
    - ${WillowConstants.tags.body}`)
    - this._offlineMode = false
    - this._httpGetResponseCache = {}
    - this.location = {}
    - this._htmlStumpNode = this.nodeAt(0)
    - this._headStumpNode = this.nodeAt(0).nodeAt(0)
    - this._bodyStumpNode = this.nodeAt(0).nodeAt(1)
    - this.addSuidsToHtmlHeadAndBodyShadows()
    - this._fullHtmlPageUrlIncludingProtocolAndFileName = fullHtmlPageUrlIncludingProtocolAndFileName
    - const url = new URL(fullHtmlPageUrlIncludingProtocolAndFileName)
    - this.location.port = url.port
    - this.location.protocol = url.protocol
    - this.location.hostname = url.hostname
    - this.location.host = url.host
    - }
    - _getPort() {
    - return this.location.port ? ":" + this.location.port : ""
    - }
    - getHash() {
    - return this.location.hash || ""
    - }
    - setHash(value) {
    - this.location.hash = value
    - }
    - queryObjectToQueryString(obj) {
    - const params = new URLSearchParams()
    - for (const [key, value] of Object.entries(obj)) {
    - params.set(key, String(value))
    - }
    - return params.toString()
    - }
    - toPrettyDeepLink(treeCode, queryObject) {
    - // todo: move things to a constant.
    - const nodeBreakSymbol = "~"
    - const edgeSymbol = "_"
    - const obj = Object.assign({}, queryObject)
    - if (!treeCode.includes(nodeBreakSymbol) && !treeCode.includes(edgeSymbol)) {
    - obj.nodeBreakSymbol = nodeBreakSymbol
    - obj.edgeSymbol = edgeSymbol
    - obj.data = encodeURIComponent(treeCode.replace(/ /g, edgeSymbol).replace(/\n/g, nodeBreakSymbol))
    - } else obj.data = encodeURIComponent(treeCode)
    - return this.getAppWebPageUrl() + "?" + this.queryObjectToQueryString(obj)
    - }
    - getHost() {
    - return this.location.host
    - }
    - reload() {}
    - toggleOfflineMode() {
    - this._offlineMode = !this._offlineMode
    - }
    - addSuidsToHtmlHeadAndBodyShadows() {}
    - getShadowClass() {
    - return WillowShadow
    - }
    - getMockMouseEvent() {
    - return {
    - clientX: 0,
    - clientY: 0,
    - offsetX: 0,
    - offsetY: 0
    - }
    - }
    - toggleFullScreen() {}
    - getMousetrap() {
    - if (!this._mousetrap) this._mousetrap = new WillowMousetrap()
    - return this._mousetrap
    - }
    - _getFocusedShadow() {
    - return this._focusedShadow || this.getBodyStumpNode().getShadow()
    - }
    - getHeadStumpNode() {
    - return this._headStumpNode
    - }
    - getBodyStumpNode() {
    - return this._bodyStumpNode
    - }
    - getHtmlStumpNode() {
    - return this._htmlStumpNode
    - }
    - getStore() {
    - if (!this._store) this._store = new WillowStore()
    - return this._store
    - }
    - someInputHasFocus() {
    - const focusedShadow = this._getFocusedShadow()
    - if (!focusedShadow) return false
    - const stumpNode = focusedShadow.getShadowStumpNode()
    - return stumpNode && stumpNode.isInputType()
    - }
    - copyTextToClipboard(text) {}
    - setCopyData(evt, str) {}
    - getAppWebPageUrl() {
    - return this._fullHtmlPageUrlIncludingProtocolAndFileName
    - }
    - getAppWebPageParentFolderWithoutTrailingSlash() {
    - return jtree.Utils.getPathWithoutFileName(this._fullHtmlPageUrlIncludingProtocolAndFileName)
    - }
    - _makeRelativeUrlAbsolute(url) {
    - if (url.startsWith("http://") || url.startsWith("https://")) return url
    - return this.getAppWebPageParentFolderWithoutTrailingSlash() + "/" + url.replace(/^\//, "")
    - }
    - async makeUrlAbsoluteAndHttpGetUrl(url, queryStringObject, responseClass = WillowHTTPResponse) {
    - return this.httpGetUrl(this._makeRelativeUrlAbsolute(url), queryStringObject, responseClass)
    - }
    - async httpGetUrl(url, queryStringObject, responseClass = WillowHTTPResponse) {
    - if (this._offlineMode) return new WillowHTTPResponse()
    - const superAgentResponse = await superagent
    - .get(url)
    - .query(queryStringObject)
    - .set(this._headers || {})
    - return new responseClass(superAgentResponse)
    - }
    - _getFromResponseCache(cacheKey) {
    - const hit = this._httpGetResponseCache[cacheKey]
    - if (hit) hit.setFromCache(true)
    - return hit
    - }
    - _setInResponseCache(url, res) {
    - this._httpGetResponseCache[url] = res
    - return this
    - }
    - async httpGetUrlFromCache(url, queryStringMap = {}, responseClass = WillowHTTPResponse) {
    - const cacheKey = url + JSON.stringify(queryStringMap)
    - const cacheHit = this._getFromResponseCache(cacheKey)
    - if (!cacheHit) {
    - const res = await this.httpGetUrl(url, queryStringMap, responseClass)
    - this._setInResponseCache(cacheKey, res)
    - return res
    - }
    - return cacheHit
    - }
    - async httpGetUrlFromProxyCache(url) {
    - const queryStringMap = {}
    - queryStringMap.url = url
    - queryStringMap.cacheOnServer = "true"
    - return await this.httpGetUrlFromCache("/proxy", queryStringMap, WillowHTTPProxyCacheResponse)
    - }
    - async httpPostUrl(url, data) {
    - if (this._offlineMode) return new WillowHTTPResponse()
    - const superAgentResponse = await superagent
    - .post(this._makeRelativeUrlAbsolute(url))
    - .set(this._headers || {})
    - .send(data)
    - return new WillowHTTPResponse(superAgentResponse)
    - }
    - encodeURIComponent(str) {
    - return encodeURIComponent(str)
    - }
    - downloadFile(data, filename, filetype) {
    - // noop
    - }
    - async appendScript(url) {}
    - getWindowTitle() {
    - // todo: deep getNodeByBase/withBase/type/word or something?
    - const nodes = this.getTopDownArray()
    - const titleNode = nodes.find(node => node.getFirstWord() === WillowConstants.titleTag)
    - return titleNode ? titleNode.getContent() : ""
    - }
    - setWindowTitle(value) {
    - const nodes = this.getTopDownArray()
    - const headNode = nodes.find(node => node.getFirstWord() === WillowConstants.tags.head)
    - headNode.touchNode(WillowConstants.titleTag).setContent(value)
    - return this
    - }
    - _getHostname() {
    - return this.location.hostname || ""
    - }
    - openUrl(link) {
    - // noop in willow
    - }
    - getPageHtml() {
    - return this.getHtmlStumpNode().toHtmlWithSuids()
    - }
    - getStumpNodeFromElement(el) {}
    - setPasteHandler(fn) {
    - return this
    - }
    - setErrorHandler(fn) {
    - return this
    - }
    - setCopyHandler(fn) {
    - return this
    - }
    - setCutHandler(fn) {
    - return this
    - }
    - setResizeEndHandler(fn) {
    - return this
    - }
    - async confirmThen(message) {
    - return true
    - }
    - async promptThen(message, value) {
    - return value
    - }
    - setLoadedDroppedFileHandler(callback, helpText = "") {}
    - getWindowSize() {
    - return {
    - width: 1111,
    - height: 1111
    - }
    - }
    - getDocumentSize() {
    - return this.getWindowSize()
    - }
    - isExternalLink(link) {
    - if (link && link.substr(0, 1) === "/") return false
    - if (!link.includes("//")) return false
    - const hostname = this._getHostname()
    - const url = new URL(link)
    - return url.hostname && hostname !== url.hostname
    - }
    - forceRepaint() {}
    - blurFocusedInput() {}
    - }
    - class WillowBrowser extends AbstractWillowBrowser {
    - constructor(fullHtmlPageUrlIncludingProtocolAndFileName) {
    - super(fullHtmlPageUrlIncludingProtocolAndFileName)
    - this._offlineMode = true
    - }
    - }
    - WillowBrowser._stumpsOnPage = 0
    - class WillowBrowserShadow extends AbstractWillowShadow {
    - _getJQElement() {
    - // todo: speedup?
    - if (!this._cachedEl) this._cachedEl = jQuery(`[${WillowConstants.uidAttribute}="${this.getShadowStumpNode()._getUid()}"]`)
    - return this._cachedEl
    - }
    - getShadowElement() {
    - return this._getJQElement()[0]
    - }
    - getShadowPosition() {
    - return this._getJQElement().position()
    - }
    - shadowHasClass(name) {
    - return this._getJQElement().hasClass(name)
    - }
    - getShadowHtml() {
    - return this._getJQElement().html()
    - }
    - getShadowValue() {
    - // todo: cleanup, add tests
    - if (this.getShadowStumpNode().isInputType()) return this._getJQElement().val()
    - return this._getJQElement().val() || this.getShadowValueFromAttr()
    - }
    - getShadowValueFromAttr() {
    - return this._getJQElement().attr(WillowConstants.value)
    - }
    - getShadowOuterHeight() {
    - return this._getJQElement().outerHeight()
    - }
    - getShadowOuterWidth() {
    - return this._getJQElement().outerWidth()
    - }
    - isShadowChecked() {
    - return this._getJQElement().is(WillowConstants.checkedSelector)
    - }
    - getShadowWidth() {
    - return this._getJQElement().width()
    - }
    - getShadowHeight() {
    - return this._getJQElement().height()
    - }
    - getShadowOffset() {
    - return this._getJQElement().offset()
    - }
    - getShadowAttr(name) {
    - return this._getJQElement().attr(name)
    - }
    - _logMessage(type) {
    - if (true) return true
    - WillowBrowserShadow._shadowUpdateNumber++
    - console.log(`DOM Update ${WillowBrowserShadow._shadowUpdateNumber}: ${type}`)
    - }
    - getShadowCss(prop) {
    - return this._getJQElement().css(prop)
    - }
    - triggerShadowEvent(event) {
    - this._getJQElement().trigger(event)
    - this._logMessage("trigger")
    - return this
    - }
    - // BEGIN MUTABLE METHODS:
    - // todo: add tests
    - // todo: idea, don't "paint" wall (dont append it to parent, until done.)
    - insertHtmlNode(childStumpNode, index) {
    - const newChildJqElement = jQuery(childStumpNode.toHtmlWithSuids())
    - newChildJqElement.data("stumpNode", childStumpNode) // todo: what do we use this for?
    - const jqEl = this._getJQElement()
    - // todo: can we virtualize this?
    - // would it be a "virtual shadow?"
    - if (index === undefined) jqEl.append(newChildJqElement)
    - else if (index === 0) jqEl.prepend(newChildJqElement)
    - else jQuery(jqEl.children().get(index - 1)).after(newChildJqElement)
    - WillowBrowser._stumpsOnPage++
    - this._logMessage("insert")
    - }
    - addClassToShadow(className) {
    - this._getJQElement().addClass(className)
    - this._logMessage("addClass")
    - return this
    - }
    - removeClassFromShadow(className) {
    - this._getJQElement().removeClass(className)
    - this._logMessage("removeClass")
    - return this
    - }
    - onShadowEvent(event, two, three) {
    - this._getJQElement().on(event, two, three)
    - this._logMessage("bind on")
    - return this
    - }
    - offShadowEvent(event, fn) {
    - this._getJQElement().off(event, fn)
    - this._logMessage("bind off")
    - return this
    - }
    - toggleShadow() {
    - this._getJQElement().toggle()
    - this._logMessage("toggle")
    - return this
    - }
    - makeResizable(options) {
    - this._getJQElement().resizable(options)
    - this._logMessage("resizable")
    - return this
    - }
    - removeShadow() {
    - this._getJQElement().remove()
    - WillowBrowser._stumpsOnPage--
    - this._logMessage("remove")
    - return this
    - }
    - setInputOrTextAreaValue(value) {
    - this._getJQElement().val(value)
    - this._logMessage("val")
    - return this
    - }
    - setShadowAttr(name, value) {
    - this._getJQElement().attr(name, value)
    - this._logMessage("attr")
    - return this
    - }
    - makeDraggable(options) {
    - this._logMessage("draggable")
    - this._getJQElement().draggable(options)
    - return this
    - }
    - setShadowCss(css) {
    - this._getJQElement().css(css)
    - this._logMessage("css")
    - return this
    - }
    - makeSelectable(options) {
    - this._getJQElement().selectable(options)
    - this._logMessage("selectable")
    - return this
    - }
    - }
    - WillowBrowserShadow._shadowUpdateNumber = 0 // todo: what is this for, debugging perf?
    - // same thing, except with side effects.
    - class RealWillowBrowser extends AbstractWillowBrowser {
    - findStumpNodesByShadowClass(className) {
    - const stumpNodes = []
    - const that = this
    - jQuery("." + className).each(function() {
    - stumpNodes.push(that.getStumpNodeFromElement(this))
    - })
    - return stumpNodes
    - }
    - addSuidsToHtmlHeadAndBodyShadows() {
    - jQuery(WillowConstants.tags.html).attr(WillowConstants.uidAttribute, this.getHtmlStumpNode()._getUid())
    - jQuery(WillowConstants.tags.head).attr(WillowConstants.uidAttribute, this.getHeadStumpNode()._getUid())
    - jQuery(WillowConstants.tags.body).attr(WillowConstants.uidAttribute, this.getBodyStumpNode()._getUid())
    - }
    - getShadowClass() {
    - return WillowBrowserShadow
    - }
    - setCopyHandler(fn) {
    - jQuery(document).on(BrowserEvents.copy, fn)
    - return this
    - }
    - setCutHandler(fn) {
    - jQuery(document).on(BrowserEvents.cut, fn)
    - return this
    - }
    - setPasteHandler(fn) {
    - window.addEventListener(BrowserEvents.paste, fn, false)
    - return this
    - }
    - setErrorHandler(fn) {
    - window.addEventListener("error", fn)
    - window.addEventListener("unhandledrejection", fn)
    - return this
    - }
    - toggleFullScreen() {
    - const doc = document
    - if ((doc.fullScreenElement && doc.fullScreenElement !== null) || (!doc.mozFullScreen && !doc.webkitIsFullScreen)) {
    - if (doc.documentElement.requestFullScreen) doc.documentElement.requestFullScreen()
    - else if (doc.documentElement.mozRequestFullScreen) doc.documentElement.mozRequestFullScreen()
    - else if (doc.documentElement.webkitRequestFullScreen) doc.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)
    - } else {
    - if (doc.cancelFullScreen) doc.cancelFullScreen()
    - else if (doc.mozCancelFullScreen) doc.mozCancelFullScreen()
    - else if (doc.webkitCancelFullScreen) doc.webkitCancelFullScreen()
    - }
    - }
    - setCopyData(evt, str) {
    - const originalEvent = evt.originalEvent
    - originalEvent.preventDefault()
    - originalEvent.clipboardData.setData("text/plain", str)
    - originalEvent.clipboardData.setData("text/html", str)
    - }
    - getMousetrap() {
    - return window.Mousetrap
    - }
    - copyTextToClipboard(text) {
    - // http://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript
    - const textArea = document.createElement("textarea")
    - textArea.style.position = "fixed"
    - textArea.style.top = "0"
    - textArea.style.left = "0"
    - textArea.style.width = "2em"
    - textArea.style.height = "2em"
    - textArea.style.padding = "0"
    - textArea.style.border = "none"
    - textArea.style.outline = "none"
    - textArea.style.boxShadow = "none"
    - textArea.style.background = "transparent"
    - textArea.value = text
    - document.body.appendChild(textArea)
    - textArea.select()
    - try {
    - const successful = document.execCommand("copy")
    - } catch (err) {}
    - document.body.removeChild(textArea)
    - }
    - getStore() {
    - return window.store
    - }
    - getHash() {
    - return location.hash || ""
    - }
    - setHash(value) {
    - location.hash = value
    - }
    - getHost() {
    - return location.host
    - }
    - _getHostname() {
    - return location.hostname
    - }
    - async appendScript(url) {
    - if (!url) return undefined
    - if (!this._loadingPromises) this._loadingPromises = {}
    - if (this._loadingPromises[url]) return this._loadingPromises[url]
    - if (this.isNodeJs()) return undefined
    - this._loadingPromises[url] = this._appendScript(url)
    - return this._loadingPromises[url]
    - }
    - _appendScript(url) {
    - //https://bradb.net/blog/promise-based-js-script-loader/
    - return new Promise(function(resolve, reject) {
    - let resolved = false
    - const scriptEl = document.createElement("script")
    - scriptEl.type = "text/javascript"
    - scriptEl.src = url
    - scriptEl.async = true
    - scriptEl.onload = scriptEl.onreadystatechange = function() {
    - if (!resolved && (!this.readyState || this.readyState == "complete")) {
    - resolved = true
    - resolve(this)
    - }
    - }
    - scriptEl.onerror = scriptEl.onabort = reject
    - document.head.appendChild(scriptEl)
    - })
    - }
    - downloadFile(data, filename, filetype) {
    - const downloadLink = document.createElement("a")
    - downloadLink.setAttribute("href", `data:${filetype},` + encodeURIComponent(data))
    - downloadLink.setAttribute("download", filename)
    - downloadLink.click()
    - }
    - reload() {
    - window.location.reload()
    - }
    - openUrl(link) {
    - window.open(link)
    - }
    - setResizeEndHandler(fn) {
    - let resizeTimer
    - jQuery(window).on(BrowserEvents.resize, evt => {
    - const target = jQuery(evt.target)
    - if (target.is("div")) return // dont resize on div resizes
    - clearTimeout(resizeTimer)
    - resizeTimer = setTimeout(() => {
    - fn({ width: target.width(), height: target.height() })
    - }, 100)
    - })
    - return this
    - }
    - getStumpNodeFromElement(el) {
    - const jqEl = jQuery(el)
    - return this.getHtmlStumpNode().getNodeByGuid(parseInt(jqEl.attr(WillowConstants.uidAttribute)))
    - }
    - forceRepaint() {
    - jQuery(window).width()
    - }
    - getBrowserHtml() {
    - return document.documentElement.outerHTML
    - }
    - async confirmThen(message) {
    - return confirm(message)
    - }
    - async promptThen(message, value) {
    - return prompt(message, value)
    - }
    - getWindowSize() {
    - const windowStumpNode = jQuery(window)
    - return {
    - width: windowStumpNode.width(),
    - height: windowStumpNode.height()
    - }
    - }
    - getDocumentSize() {
    - const documentStumpNode = jQuery(document)
    - return {
    - width: documentStumpNode.width(),
    - height: documentStumpNode.height()
    - }
    - }
    - // todo: denote the side effect
    - blurFocusedInput() {
    - // todo: test against browser.
    - document.activeElement.blur()
    - }
    - setLoadedDroppedFileHandler(callback, helpText = "") {
    - const bodyStumpNode = this.getBodyStumpNode()
    - const bodyShadow = bodyStumpNode.getShadow()
    - // Added the below to ensure dragging from the chrome downloads bar works
    - // http://stackoverflow.com/questions/19526430/drag-and-drop-file-uploads-from-chrome-downloads-bar
    - const handleChromeBug = event => {
    - const originalEvent = event.originalEvent
    - const effect = originalEvent.dataTransfer.effectAllowed
    - originalEvent.dataTransfer.dropEffect = effect === "move" || effect === "linkMove" ? "move" : "copy"
    - }
    - const dragoverHandler = event => {
    - handleChromeBug(event)
    - event.preventDefault()
    - event.stopPropagation()
    - if (!bodyStumpNode.stumpNodeHasClass("dragOver")) {
    - bodyStumpNode.insertChildNode(`div ${helpText}
    - id dragOverHelp`)
    - bodyStumpNode.addClassToStumpNode("dragOver")
    - // Add the help, and then hopefull we'll get a dragover event on the dragOverHelp, then
    - // 50ms later, add the dragleave handler, and from now on drag leave will only happen on the help
    - // div
    - setTimeout(function() {
    - bodyShadow.onShadowEvent(BrowserEvents.dragleave, dragleaveHandler)
    - }, 50)
    - }
    - }
    - const dragleaveHandler = event => {
    - event.preventDefault()
    - event.stopPropagation()
    - bodyStumpNode.removeClassFromStumpNode("dragOver")
    - bodyStumpNode.findStumpNodeByChild("id dragOverHelp").removeStumpNode()
    - bodyShadow.offShadowEvent(BrowserEvents.dragleave, dragleaveHandler)
    - }
    - const dropHandler = async event => {
    - event.preventDefault()
    - event.stopPropagation()
    - bodyStumpNode.removeClassFromStumpNode("dragOver")
    - bodyStumpNode.findStumpNodeByChild("id dragOverHelp").removeStumpNode()
    - const droppedItems = event.originalEvent.dataTransfer.items
    - // NOTE: YOU NEED TO STAY IN THE "DROP" EVENT, OTHERWISE THE DATATRANSFERITEMS MUTATE
    - // (BY DESIGN) https://bugs.chromium.org/p/chromium/issues/detail?id=137231
    - // DO NOT ADD AN AWAIT IN THIS LOOP. IT WILL BREAK.
    - const items = []
    - for (let droppedItem of droppedItems) {
    - const entry = droppedItem.webkitGetAsEntry()
    - items.push(this._handleDroppedEntry(entry))
    - }
    - const results = await Promise.all(items)
    - callback(results)
    - }
    - bodyShadow.onShadowEvent(BrowserEvents.dragover, dragoverHandler)
    - bodyShadow.onShadowEvent(BrowserEvents.drop, dropHandler)
    - // todo: why do we do this?
    - bodyShadow.onShadowEvent(BrowserEvents.dragenter, function(event) {
    - event.preventDefault()
    - event.stopPropagation()
    - })
    - }
    - _handleDroppedEntry(item, path = "") {
    - // http://stackoverflow.com/questions/3590058/does-html5-allow-drag-drop-upload-of-folders-or-a-folder-tree
    - // http://stackoverflow.com/questions/6756583/prevent-browser-from-loading-a-drag-and-dropped-file
    - return item.isFile ? this._handleDroppedFile(item) : this._handleDroppedDirectory(item, path)
    - }
    - _handleDroppedDirectory(item, path) {
    - return new Promise((resolve, reject) => {
    - item.createReader().readEntries(async entries => {
    - const promises = []
    - for (let i = 0; i < entries.length; i++) {
    - promises.push(this._handleDroppedEntry(entries[i], path + item.name + "/"))
    - }
    - const res = await Promise.all(promises)
    - resolve(res)
    - })
    - })
    - }
    - _handleDroppedFile(file) {
    - // https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications
    - // http://www.sitepoint.com/html5-javascript-open-dropped-files/
    - return new Promise((resolve, reject) => {
    - file.file(data => {
    - const reader = new FileReader()
    - reader.onload = evt => {
    - resolve({ data: evt.target.result, filename: data.name })
    - }
    - reader.onerror = err => reject(err)
    - reader.readAsText(data)
    - })
    - })
    - }
    - _getFocusedShadow() {
    - const stumpNode = this.getStumpNodeFromElement(document.activeElement)
    - return stumpNode && stumpNode.getShadow()
    - }
    - }
    - class AbstractTheme {
    - hakonToCss(str) {
    - const hakonProgram = new hakonNode(str)
    - // console.log(hakonProgram.getAllErrors())
    - return hakonProgram.compile()
    - }
    - }
    - class DefaultTheme extends AbstractTheme {}
    - class AbstractTreeComponent extends jtree.GrammarBackedNode {
    - async startWhenReady() {
    - if (this.isNodeJs()) return this.start()
    - document.addEventListener(
    - "DOMContentLoaded",
    - async () => {
    - this.start()
    - },
    - false
    - )
    - }
    - start() {
    - this._bindTreeComponentFrameworkCommandListenersOnBody()
    - this.renderAndGetRenderReport(this.getWillowBrowser().getBodyStumpNode())
    - }
    - getWillowBrowser() {
    - if (!this._willowBrowser) {
    - if (this.isNodeJs()) {
    - this._willowBrowser = new WillowBrowser("http://localhost:8000/index.html")
    - } else {
    - this._willowBrowser = new RealWillowBrowser(window.location.href)
    - }
    - }
    - return this._willowBrowser
    - }
    - onCommandError(err) {
    - throw err
    - }
    - _setMouseEvent(evt) {
    - this._mouseEvent = evt
    - return this
    - }
    - getMouseEvent() {
    - return this._mouseEvent || this.getWillowBrowser().getMockMouseEvent()
    - }
    - _onCommandWillRun() {
    - // todo: remove. currently used by ohayo
    - }
    - _getCommandArgumentsFromStumpNode(stumpNode, commandMethod) {
    - if (commandMethod.includes(" ")) {
    - // todo: cleanup and document
    - // It seems the command arguments can from the method string or from form values.
    - const parts = commandMethod.split(" ")
    - return {
    - uno: parts[1],
    - dos: parts[2]
    - }
    - }
    - const shadow = stumpNode.getShadow()
    - let valueParam
    - if (stumpNode.isStumpNodeCheckbox()) valueParam = shadow.isShadowChecked() ? true : false
    - // todo: fix bug if nothing is entered.
    - else if (shadow.getShadowValue() !== undefined) valueParam = shadow.getShadowValue()
    - else valueParam = stumpNode.getStumpNodeAttr("value")
    - const nameParam = stumpNode.getStumpNodeAttr("name")
    - return {
    - uno: valueParam,
    - dos: nameParam
    - }
    - }
    - getStumpNodeString() {
    - return this.getWillowBrowser()
    - .getHtmlStumpNode()
    - .toString()
    - }
    - _getHtmlOnlyNodes() {
    - const nodes = []
    - this.getWillowBrowser()
    - .getHtmlStumpNode()
    - .deepVisit(node => {
    - if (node.getFirstWord() === "styleTag" || (node.getContent() || "").startsWith("
    - nodes.push(node)
    - })
    - return nodes
    - }
    - getStumpNodeStringWithoutCssAndSvg() {
    - // todo: cleanup. feels hacky.
    - const clone = new jtree.TreeNode(
    - this.getWillowBrowser()
    - .getHtmlStumpNode()
    - .toString()
    - )
    - clone.getTopDownArray().forEach(node => {
    - if (node.getFirstWord() === "styleTag" || (node.getContent() || "").startsWith("
    - })
    - return clone.toString()
    - }
    - getTextContent() {
    - return this._getHtmlOnlyNodes()
    - .map(node => node.getTextContent())
    - .filter(text => text)
    - .join("\n")
    - }
    - getCommandNames() {
    - return Object.getOwnPropertyNames(Object.getPrototypeOf(this)).filter(word => word.endsWith("Command"))
    - }
    - async _executeCommandOnStumpNode(stumpNode, commandMethod) {
    - const params = this._getCommandArgumentsFromStumpNode(stumpNode, commandMethod)
    - if (commandMethod.includes(" "))
    - // todo: cleanup
    - commandMethod = commandMethod.split(" ")[0]
    - this.addToCommandLog([commandMethod, params.uno, params.dos].filter(identity => identity).join(" "))
    - this._onCommandWillRun() // todo: remove. currently used by ohayo
    - let treeComponent = stumpNode.getStumpNodeTreeComponent()
    - while (!treeComponent[commandMethod]) {
    - const parent = treeComponent.getParent()
    - if (parent === treeComponent) throw new Error(`Unknown command "${commandMethod}"`)
    - if (!parent) debugger
    - treeComponent = parent
    - }
    - try {
    - await treeComponent[commandMethod](params.uno, params.dos)
    - } catch (err) {
    - this.onCommandError(err)
    - }
    - }
    - _bindTreeComponentFrameworkCommandListenersOnBody() {
    - const willowBrowser = this.getWillowBrowser()
    - const bodyShadow = willowBrowser.getBodyStumpNode().getShadow()
    - const app = this
    - const checkAndExecute = (el, attr, evt) => {
    - const stumpNode = willowBrowser.getStumpNodeFromElement(el)
    - evt.preventDefault()
    - evt.stopImmediatePropagation()
    - this._executeCommandOnStumpNode(stumpNode, stumpNode.getStumpNodeAttr(attr))
    - return false
    - }
    - bodyShadow.onShadowEvent(BrowserEvents.contextmenu, `[${WillowConstants.contextMenuCommand}]`, function(evt) {
    - if (evt.ctrlKey) return true
    - app._setMouseEvent(evt) // todo: remove?
    - return checkAndExecute(this, WillowConstants.contextMenuCommand, evt)
    - })
    - bodyShadow.onShadowEvent(BrowserEvents.click, `[${WillowConstants.clickCommand}]`, function(evt) {
    - if (evt.shiftKey) return checkAndExecute(this, WillowConstants.shiftClickCommand, evt)
    - app._setMouseEvent(evt) // todo: remove?
    - return checkAndExecute(this, WillowConstants.clickCommand, evt)
    - })
    - bodyShadow.onShadowEvent(BrowserEvents.dblclick, `[${WillowConstants.doubleClickCommand}]`, function(evt) {
    - if (evt.target !== evt.currentTarget) return true // direct dblclicks only
    - app._setMouseEvent(evt) // todo: remove?
    - return checkAndExecute(this, WillowConstants.doubleClickCommand, evt)
    - })
    - bodyShadow.onShadowEvent(BrowserEvents.blur, `[${WillowConstants.blurCommand}]`, function(evt) {
    - return checkAndExecute(this, WillowConstants.blurCommand, evt)
    - })
    - bodyShadow.onShadowEvent(BrowserEvents.change, `[${WillowConstants.changeCommand}]`, function(evt) {
    - return checkAndExecute(this, WillowConstants.changeCommand, evt)
    - })
    - }
    - stopPropagationCommand() {
    - // todo: remove?
    - // intentional noop
    - }
    - // todo: remove?
    - async clearMessageBufferCommand() {
    - delete this._messageBuffer
    - }
    - // todo: remove?
    - async unmountAndDestroyCommand() {
    - this.unmountAndDestroy()
    - }
    - toggleTreeComponentFrameworkDebuggerCommand() {
    - // todo: move somewhere else?
    - // todo: cleanup
    - const app = this.getRootNode()
    - const node = app.getNode("TreeComponentFrameworkDebuggerComponent")
    - if (node) {
    - node.unmountAndDestroy()
    - } else {
    - app.appendLine("TreeComponentFrameworkDebuggerComponent")
    - app.renderAndGetRenderReport()
    - }
    - }
    - getStumpNode() {
    - return this._htmlStumpNode
    - }
    - toHakonCode() {
    - return ""
    - }
    - getTheme() {
    - if (!this.isRoot()) return this.getRootNode().getTheme()
    - if (!this._theme) this._theme = new DefaultTheme()
    - return this._theme
    - }
    - getCommandsBuffer() {
    - if (!this._commandsBuffer) this._commandsBuffer = []
    - return this._commandsBuffer
    - }
    - addToCommandLog(command) {
    - this.getCommandsBuffer().push({
    - command: command,
    - time: this._getProcessTimeInMilliseconds()
    - })
    - }
    - getMessageBuffer() {
    - if (!this._messageBuffer) this._messageBuffer = new jtree.TreeNode()
    - return this._messageBuffer
    - }
    - // todo: move this to tree class? or other higher level class?
    - addStumpCodeMessageToLog(message) {
    - // note: we have 1 parameter, and are going to do type inference first.
    - // Todo: add actions that can be taken from a message?
    - // todo: add tests
    - this.getMessageBuffer().appendLineAndChildren("message", message)
    - }
    - addStumpErrorMessageToLog(errorMessage) {
    - // todo: cleanup!
    - return this.addStumpCodeMessageToLog(`div
    - class OhayoError
    - bern${jtree.TreeNode.nest(errorMessage, 2)}`)
    - }
    - logMessageText(message = "") {
    - const pre = `pre
    - bern${jtree.TreeNode.nest(message, 2)}`
    - return this.addStumpCodeMessageToLog(pre)
    - }
    - unmount() {
    - if (
    - !this.isMounted() // todo: why do we need this check?
    - )
    - return undefined
    - this._getChildTreeComponents().forEach(child => child.unmount())
    - this.treeComponentWillUnmount()
    - this._removeCss()
    - this._removeHtml()
    - delete this._lastRenderedTime
    - this.treeComponentDidUnmount()
    - }
    - _removeHtml() {
    - this._htmlStumpNode.removeStumpNode()
    - delete this._htmlStumpNode
    - }
    - toStumpCode() {
    - return `div
    - class ${this.getCssClassNames().join(" ")}`
    - }
    - getCssClassNames() {
    - return this._getJavascriptPrototypeChainUpTo("AbstractTreeComponent")
    - }
    - treeComponentWillMount() {}
    - async treeComponentDidMount() {
    - AbstractTreeComponent._mountedTreeComponents++
    - }
    - treeComponentDidUnmount() {
    - AbstractTreeComponent._mountedTreeComponents--
    - }
    - treeComponentWillUnmount() {}
    - getNewestTimeToRender() {
    - return this._lastTimeToRender
    - }
    - _setLastRenderedTime(time) {
    - this._lastRenderedTime = time
    - return this
    - }
    - async treeComponentDidUpdate() {}
    - _getChildTreeComponents() {
    - return this.getChildrenByNodeConstructor(AbstractTreeComponent)
    - }
    - _hasChildrenTreeComponents() {
    - return this._getChildTreeComponents().length > 0
    - }
    - // todo: this is hacky. we do it so we can just mount all tiles to wall.
    - getStumpNodeForChildren() {
    - return this.getStumpNode()
    - }
    - _getLastRenderedTime() {
    - return this._lastRenderedTime
    - }
    - _getCss() {
    - return this.getTheme().hakonToCss(this.toHakonCode())
    - }
    - toPlainHtml(containerId) {
    - return `
    -
    - ${new stumpNode(this.toStumpCode()).compile()}
    -
    `
    - }
    - _getCssStumpCode() {
    - return `styleTag
    - for ${this.constructor.name}
    - bern${jtree.TreeNode.nest(this._getCss(), 2)}`
    - }
    - _updateAndGetUpdateReport() {
    - const reasonForUpdatingOrNot = this.getWhetherToUpdateAndReason()
    - if (!reasonForUpdatingOrNot.shouldUpdate) return reasonForUpdatingOrNot
    - this._setLastRenderedTime(this._getProcessTimeInMilliseconds())
    - this._removeCss()
    - this._mountCss()
    - // todo: fucking switch to react? looks like we don't update parent because we dont want to nuke children.
    - // okay. i see why we might do that for non tile treeComponents. but for Tile treeComponents, seems like we arent nesting, so why not?
    - // for now
    - if (this._hasChildrenTreeComponents()) return { shouldUpdate: false, reason: "did not update because is a parent" }
    - this._updateHtml()
    - this._lastTimeToRender = this._getProcessTimeInMilliseconds() - this._getLastRenderedTime()
    - return reasonForUpdatingOrNot
    - }
    - _updateHtml() {
    - const stumpNodeToMountOn = this._htmlStumpNode.getParent()
    - const currentIndex = this._htmlStumpNode.getIndex()
    - this._removeHtml()
    - this._mountHtml(stumpNodeToMountOn, this._toLoadedOrLoadingStumpCode(), currentIndex)
    - }
    - unmountAndDestroy() {
    - this.unmount()
    - return this.destroy()
    - }
    - // todo: move to keyword node class?
    - toggle(firstWord, contentOptions) {
    - const currentNode = this.getNode(firstWord)
    - if (!contentOptions) return currentNode ? currentNode.unmountAndDestroy() : this.appendLine(firstWord)
    - const currentContent = currentNode === undefined ? undefined : currentNode.getContent()
    - const index = contentOptions.indexOf(currentContent)
    - const newContent = index === -1 || index + 1 === contentOptions.length ? contentOptions[0] : contentOptions[index + 1]
    - this.delete(firstWord)
    - if (newContent) this.touchNode(firstWord).setContent(newContent)
    - return newContent
    - }
    - isMounted() {
    - return !!this._htmlStumpNode
    - }
    - toggleAndRender(firstWord, contentOptions) {
    - this.toggle(firstWord, contentOptions)
    - this.getRootNode().renderAndGetRenderReport()
    - }
    - _getFirstOutdatedDependency(lastRenderedTime = this._getLastRenderedTime() || 0) {
    - return this.getDependencies().find(dep => dep.getLineModifiedTime() > lastRenderedTime)
    - }
    - getWhetherToUpdateAndReason() {
    - const mTime = this.getLineModifiedTime()
    - const lastRenderedTime = this._getLastRenderedTime() || 0
    - const staleTime = mTime - lastRenderedTime
    - if (lastRenderedTime === 0)
    - return {
    - shouldUpdate: true,
    - reason: "shouldUpdate because this TreeComponent hasn't been rendered yet",
    - staleTime: staleTime
    - }
    - if (staleTime > 0)
    - return {
    - shouldUpdate: true,
    - reason: "shouldUpdate because this TreeComponent changed",
    - staleTime: staleTime
    - }
    - const outdatedDependency = this._getFirstOutdatedDependency(lastRenderedTime)
    - if (outdatedDependency)
    - return {
    - shouldUpdate: true,
    - reason: "Should update because a dependency updated",
    - dependency: outdatedDependency,
    - staleTime: outdatedDependency.getLineModifiedTime() - lastRenderedTime
    - }
    - return {
    - shouldUpdate: false,
    - reason: "Should NOT update because no dependency changed",
    - lastRenderedTime: lastRenderedTime,
    - mTime: mTime
    - }
    - }
    - getDependencies() {
    - return []
    - }
    - _getTreeComponentsThatNeedRendering(arr) {
    - this._getChildTreeComponents().forEach(child => {
    - const reasonForUpdatingOrNot = child.getWhetherToUpdateAndReason()
    - if (!child.isMounted() || reasonForUpdatingOrNot.shouldUpdate) arr.push({ child: child, childUpdateBecause: reasonForUpdatingOrNot })
    - child._getTreeComponentsThatNeedRendering(arr)
    - })
    - }
    - toStumpLoadingCode() {
    - return `div Loading ${this.getFirstWord()}...
    - class ${this.getCssClassNames().join(" ")}
    - id ${this.getTreeComponentId()}`
    - }
    - getTreeComponentId() {
    - // html ids can't begin with a number
    - return "treeComponent" + this._getUid()
    - }
    - _toLoadedOrLoadingStumpCode() {
    - if (!this.isLoaded()) return this.toStumpLoadingCode()
    - this.setRunTimePhaseError("renderPhase")
    - try {
    - return this.toStumpCode()
    - } catch (err) {
    - console.error(err)
    - this.setRunTimePhaseError("renderPhase", err)
    - return this.toStumpErrorStateCode(err)
    - }
    - }
    - toStumpErrorStateCode(err) {
    - return `div ${err}
    - class ${this.getCssClassNames().join(" ")}
    - id ${this.getTreeComponentId()}`
    - }
    - _mount(stumpNodeToMountOn, index) {
    - this._setLastRenderedTime(this._getProcessTimeInMilliseconds())
    - this.treeComponentWillMount()
    - this._mountCss()
    - this._mountHtml(stumpNodeToMountOn, this._toLoadedOrLoadingStumpCode(), index) // todo: add index back?
    - this._lastTimeToRender = this._getProcessTimeInMilliseconds() - this._getLastRenderedTime()
    - return this
    - }
    - // todo: we might be able to squeeze virtual dom in here on the mountCss and mountHtml methods.
    - _mountCss() {
    - // todo: only insert css once per class? have a set?
    - this._cssStumpNode = this._getPageHeadStump().insertCssChildNode(this._getCssStumpCode())
    - }
    - _getPageHeadStump() {
    - return this.getRootNode()
    - .getWillowBrowser()
    - .getHeadStumpNode()
    - }
    - _removeCss() {
    - this._cssStumpNode.removeCssStumpNode()
    - delete this._cssStumpNode
    - }
    - _mountHtml(stumpNodeToMountOn, htmlCode, index) {
    - this._htmlStumpNode = stumpNodeToMountOn.insertChildNode(htmlCode, index)
    - this._htmlStumpNode.setStumpNodeTreeComponent(this)
    - }
    - renderAndGetRenderReport(stumpNode, index) {
    - const isUpdateOp = this.isMounted()
    - let treeComponentUpdateReport = {
    - shouldUpdate: false,
    - reason: ""
    - }
    - if (isUpdateOp) treeComponentUpdateReport = this._updateAndGetUpdateReport()
    - else this._mount(stumpNode, index)
    - const stumpNodeForChildren = this.getStumpNodeForChildren()
    - // Todo: insert delayed rendering?
    - const childResults = this._getChildTreeComponents().map((child, index) => child.renderAndGetRenderReport(stumpNodeForChildren, index))
    - if (isUpdateOp) {
    - if (treeComponentUpdateReport.shouldUpdate) {
    - try {
    - if (this.isLoaded()) this.treeComponentDidUpdate()
    - } catch (err) {
    - console.error(err)
    - }
    - }
    - } else {
    - try {
    - if (this.isLoaded()) this.treeComponentDidMount()
    - } catch (err) {
    - console.error(err)
    - }
    - }
    - let str = `${this.getWord(0) || this.constructor.name} ${isUpdateOp ? "update" : "mount"} ${treeComponentUpdateReport.shouldUpdate} ${treeComponentUpdateReport.reason}`
    - childResults.forEach(child => (str += "\n" + child.toString(1)))
    - return new jtree.TreeNode(str)
    - }
    - }
    - AbstractTreeComponent._mountedTreeComponents = 0
    - class TreeComponentFrameworkDebuggerComponent extends AbstractTreeComponent {
    - toHakonCode() {
    - return `.TreeComponentFrameworkDebuggerComponent
    - position fixed
    - top 5px
    - left 5px
    - z-index 1000
    - background rgba(254,255,156, .95)
    - box-shadow 1px 1px 1px rgba(0,0,0,.5)
    - padding 12px
    - overflow scroll
    - max-height 500px
    - .TreeComponentFrameworkDebuggerComponentCloseButton
    - position absolute
    - cursor pointer
    - opacity .9
    - top 2px
    - right 2px
    - &:hover
    - opacity 1`
    - }
    - toStumpCode() {
    - const app = this.getRootNode()
    - return `div
    - class TreeComponentFrameworkDebuggerComponent
    - div x
    - class TreeComponentFrameworkDebuggerComponentCloseButton
    - clickCommand toggleTreeComponentFrameworkDebuggerCommand
    - div
    - span This app is powered by the
    - a Tree Component Framework
    - href https://github.com/treenotation/jtree/tree/master/treeComponentFramework
    - p ${app.getNumberOfLines()} components loaded. ${WillowBrowser._stumpsOnPage} stumps on page.
    - pre
    - bern
    - ${app.toString(3)}`
    - }
    - }
    - class AbstractGithubTriangleComponent extends AbstractTreeComponent {
    - constructor() {
    - super(...arguments)
    - this.githubLink = `https://github.com/treenotation/jtree`
    - }
    - toHakonCode() {
    - return `.AbstractGithubTriangleComponent
    - display block
    - position absolute
    - top 0
    - right 0`
    - }
    - toStumpCode() {
    - return `a
    - class AbstractGithubTriangleComponent
    - href ${this.githubLink}
    - img
    - src /github-fork.svg`
    - }
    - }
    - window.AbstractGithubTriangleComponent = AbstractGithubTriangleComponent
    - window.AbstractTreeComponent = AbstractTreeComponent
    - window.WillowBrowser = WillowBrowser
    - window.TreeComponentFrameworkDebuggerComponent = TreeComponentFrameworkDebuggerComponent
    - ;
    -
    - {
    - class tileBlankLineNode extends jtree.GrammarBackedNode {
    - get emptyCell() {
    - return this.getWord(0)
    - }
    - get visible() {
    - return false
    - }
    - }
    -
    - class abstractTileTreeComponentNode extends AbstractTreeComponent {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - catchAllErrorNode,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    - "amazon.history": amazonHistoryNode,
    - "fitbit.all": fitbitAllNode,
    - "datawrapper.comingSoon": datawrapperComingSoonNode,
    - "dcjs.comingSoon": dcjsComingSoonNode,
    - "finos.perspective.comingSoon": finosPerspectiveComingSoonNode,
    - "fivethirtyeight.comingSoon": fivethirtyeightComingSoonNode,
    - "gov.comingSoon": GovNode,
    - "highcharts.comingSoon": highchartsComingSoonNode,
    - "re3data.comingSoon": re3dataComingSoonNode,
    - "zing.comingSoon": zingComingSoonNode,
    - "editor.helloWorld": editorHelloWorldNode,
    - "challenge.list": challengeListNode,
    - "samples.list": samplesListNode,
    - "vega.data.list": vegaDataListNode,
    - "vega.example.list": vegaExampleListNode,
    - "doc.picker": PickerTileNode,
    - "templates.list": templatesListNode,
    - "asciichart.line": asciiChartNode,
    - "calendar.heat": calendarHeatNode,
    - "challenge.play": challengePlayNode,
    - "debug.dump": debugDumpNode,
    - "web.dump": webDumpNode,
    - "debug.commands": debugCommandsNode,
    - "debug.sleep": debugSleepNode,
    - "debug.noop": debugNoOpNode,
    - "debug.throw": debugThrowNode,
    - "dtjs.basic": dtjsBasicNode,
    - "editor.gallery": editorGalleryNode,
    - "handsontable.basic": handsontableBasicNode,
    - "html.text": htmlTextNode,
    - "html.printAs": htmlPrintAsNode,
    - "html.h1": htmlH1Node,
    - "html.img": htmlImgNode,
    - "html.iframe": htmlIframeNode,
    - "html.custom": htmlCustomNode,
    - "icons.human": iconsHumanNode,
    - "icons.circle": iconsCircleNode,
    - "list.basic": listBasicNode,
    - "list.links": listLinksNode,
    - "markdown.toHtml": markdownToHtmlNode,
    - "roughjs.bar": roughJsBarNode,
    - "roughjs.pie": roughJsPieNode,
    - "roughjs.line": roughJsLineNode,
    - "show.rowCount": showRowCountNode,
    - "show.columnCount": showColumnCountNode,
    - "show.static": showStaticNode,
    - "show.value": showValueNode,
    - "show.median": showMedianNode,
    - "show.sum": showSumNode,
    - "show.mean": showMeanNode,
    - "show.min": showMinNode,
    - "show.max": showMaxNode,
    - "tables.basic": tablesBasicNode,
    - "tables.interesting": tablesInterestingNode,
    - "tables.dump": tablesDumpNode,
    - "text.wordcloud": textWordcloudNode,
    - "treenotation.3d": treenotation3dNode,
    - "treenotation.outline": treenotationOutlineNode,
    - "treenotation.dotline": treenotationDotlineNode,
    - "vega.bar": vegaBarNode,
    - "vega.line": vegaLineNode,
    - "vega.area": vegaAreaNode,
    - "vega.scatter": vegaScatterNode,
    - "vega.bubble": vegaBubbleNode,
    - "vega.emoji": vegaEmojiNode,
    - "vega.histogram": vegaHistogramNode,
    - "vega.example": vegaExampleNode,
    - "tiles.didyoumean": DidYouMeanTileNode,
    - "doc.title": docTitleNode,
    - "doc.subtitle": docSubtitleNode,
    - "doc.section": docSectionNode,
    - "doc.ref": docReferenceNode,
    - "doc.comment": docCommentNode,
    - "doc.tooling": docToolingNode,
    - "github.info": githubInfoNode,
    - "disk.browse": diskBrowseNode,
    - "disk.read": diskReadNode,
    - "hackernews.top": hackernewsTopNode,
    - "hackernews.submissions": hackernewsSubmissionsNode,
    - "publicapis.entries": publicApisNode,
    - "web.get": webGetNode,
    - "web.post": webPostNode,
    - "wikipedia.page": wikipediaContentNode,
    - "cancer.cases": cancerCasesNode,
    - "cdc.infants.weight": weightPercentilesNode,
    - "cdc.infants.length": lengthPercentilesNode,
    - "cdc.infants.headCircumference": headPercentilesNode,
    - "kaggle.datasets.heart": kaggleDatasetsHeartNode,
    - "moz.top500": mozTop500Node,
    - "owid.lifeExpectancy": lifeExpectancyNode,
    - "owid.list": owidListNode,
    - "samples.telescopes": samplesTelescopesNode,
    - "samples.mtcars": samplesMtcarsNode,
    - "samples.iris": samplesIrisNode,
    - "samples.flights14": samplesFlights14Node,
    - "samples.si": samplesSiNode,
    - "samples.portals": samplesPortalNode,
    - "samples.starWars": samplesStarWarsNode,
    - "samples.populations": samplesPopulationsNode,
    - "samples.babyNames": samplesBabyNamesNode,
    - "samples.declaration": samplesDeclarationNode,
    - "samples.periodicTable": samplesPeriodicTableNode,
    - "samples.letters": samplesLettersNode,
    - "samples.presidents": samplesPresidentsNode,
    - "ucimlr.datasets": ucimlrDatasetsNode,
    - "vega.data": vegaDataNode,
    - "reddit.all": redditAllNode,
    - "reddit.subs": redditSubsNode,
    - "reddit.sub": redditSubNode,
    - "samples.patients": samplesPatientsNode,
    - "samples.poem": samplesPoemNode,
    - "samples.outerSpace": samplesOuterSpaceNode,
    - "samples.treeProgram": samplesTreeProgramNode,
    - "samples.waterBill": samplesWaterBillNode,
    - "samples.gapMinder": samplesGapMinderNode,
    - "date.addColumns": dateAddColumnsNode,
    - "gen.constant": genConstantNode,
    - "gen.growth": genGrowthNode,
    - "math.log": mathLogNode,
    - "rows.addIndexColumn": rowsAddIndexColumnNode,
    - "rows.runningTotal": rowsRunningTotalNode,
    - "text.length": textLengthNode,
    - "text.split": textSplitNode,
    - "text.reverseSplit": reverseTextSplitNode,
    - "text.toLowerCase": textToLowerCaseNode,
    - "text.template": textTemplateNode,
    - "text.permalink": textPermalinkNode,
    - "text.replace": textReplaceNode,
    - "text.trim": textTrimNode,
    - "text.substring": textSubstringNode,
    - "text.firstLetter": testFirstLetterNode,
    - "columns.describe": columnsDescribeNode,
    - "columns.list": columnsListNode,
    - "data.eval": dataEvalNode,
    - "join.by": joinByNode,
    - "match.columnsFuzzy": matchColumnsFuzzyNode,
    - "schema.toTypescript": schemaTypeScriptNode,
    - "schema.toSimple": schemaSimpleNode,
    - "text.wordCount": textWordCountNode,
    - "text.lineCount": textLineCountNode,
    - "treenotation.wordTypes": treenotationWordTypesNode,
    - "columns.first": columnsFirstNode,
    - "columns.last": columnsLastNode,
    - "columns.drop": columnsDropNode,
    - "columns.dropConstants": columnsDropConstantsNode,
    - "columns.keep": columnsKeepNode,
    - "columns.keepNumerics": columnsKeepNumericsNode,
    - "rows.shuffle": rowsShuffleNode,
    - "rows.reverse": rowsReverseNode,
    - "filter.where": filterWhereNode,
    - "filter.with": filterWithNode,
    - "filter.without": filterWithoutNode,
    - "filter.withAny": filterAnyNode,
    - "rows.first": rowsFirstNode,
    - "rows.sample": rowsSampleNode,
    - "rows.dropIfMissing": rowsDropIfMissingNode,
    - "rows.last": rowsLastNode,
    - "bitanath.pca": pcaNode,
    - "columns.rename": columnsRenameNode,
    - "columns.cleanNames": columnsCleanNamesNode,
    - "columns.setType": columnsSetTypeNode,
    - "data.synth": dataSynthNode,
    - "data.about": dataAboutNode,
    - "data.usabilityScore": dataUsabilityScoreNode,
    - "fill.missing": fillMissingNode,
    - "gen.range": genRangeNode,
    - "group.by": groupByNode,
    - "rows.sortBy": rowsSortByNode,
    - "rows.sortByReverse": rowsSortByReverseNode,
    - "rows.addOne": rowsAddOneNode,
    - "text.matches": textMatchesNode,
    - "text.combine": textCombineNode,
    - "data.inline": dataInlineNode,
    - "data.localStorage": dataLocalStorageNode,
    - "debug.parserTest": debugParserTestNode,
    - "debug.ohayoGrammar": debugGrammarNode,
    - "debug.ohayoGrammarTree": debugGrammarTreeNode,
    - "editor.files": editorFilesNode,
    - "editor.commandHistory": editorCommandHistoryNode,
    - "math.gen": mathGenNode,
    - "random.float": randomFloatNode,
    - "random.int": randomIntNode,
    - "samples.tinyIris": samplesTinyIrisNode,
    - "assert.rowCount": assertRowCountNode,
    - "print.text": printNode,
    - "print.csv": printCsvNode,
    - hidden: hiddenNode,
    - visible: visibleNode,
    - maximized: maximizedNode,
    - left: leftNode,
    - top: topNode,
    - width: widthNode,
    - height: heightNode
    - }),
    - [{ regex: /^$/, nodeConstructor: tileBlankLineNode }]
    - )
    - }
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get inspectionStumpTemplate() {
    - return `div TileConstructor: {constructorName} ParentConstructor: {parentConstructorName}
    - div Messages:
    - ol
    - {messages}
    - div Tree:
    - pre
    - bern
    - {sourceCode}
    - div All Tile Settings:
    - pre
    - bern
    - {settings}
    - div Input rows: {inputCount} Output rows: {outputCount}
    - div Load time: {timeToLoad} Render time: {renderTime}
    - div Input Columns:
    - pre
    - bern
    - {inputColumnsAsTable}
    - div Output Columns
    - pre
    - bern
    - {outputColumnsAsTable}
    - div Output Numeric Values:
    - pre
    - bern
    - {outputNumericValues}
    - div TypeScript Interface:
    - pre
    - bern
    - {typeScriptInterface}
    - div Input Numeric Values:
    - pre
    - bern
    - {inputNumericValues}`
    - }
    - get tileStumpTemplate() {
    - return `div
    - class {classes}
    - id {id}
    - div
    - style {bodyStyle}
    - class TileBody
    - {body}
    - div
    - class TileFooter
    - {footer}`
    - }
    - get errorStateStumpTemplate() {
    - return `div
    - class {classes}
    - id {id}
    - div
    - class TileBody
    - div ERROR
    - {content}
    - div
    - class TileFooter
    - {footer}`
    - }
    - get pencilStumpTemplate() {
    - return `span ➕
    - class TileInsertBetweenButton
    - clickCommand insertTileBetweenCommand
    - span ▼
    - class TileDropDownButton
    - clickCommand toggleTileMenuCommand`
    - }
    - get errorLogMessageStumpTemplate() {
    - return `div Error occurred. See console.
    - class OhayoError`
    - }
    - get tileLoadingTemplate() {
    - return `div
    - class abstractTileTreeComponentNode
    - id {id}
    - div Loading {name}...
    - class TileBody
    - div
    - class TileFooter
    - {footer}`
    - }
    - get visibleKey() {
    - return `visible`
    - }
    - get hiddenKey() {
    - return `hidden`
    - }
    - get yearKey() {
    - return `year`
    - }
    - get monthKey() {
    - return `month`
    - }
    - get needsData() {
    - return true
    - }
    - get dayKey() {
    - return `day`
    - }
    - get ohayoFileExtensionKey() {
    - return `.ohayo`
    - }
    - get columnPredictionHintsKey() {
    - return `columnPredictionHints`
    - }
    - get sizeColumnKey() {
    - return `sizeColumn`
    - }
    - get shapeColumnKey() {
    - return `shapeColumn`
    - }
    - get colorColumnKey() {
    - return `colorColumn`
    - }
    - get yColumnKey() {
    - return `yColumn`
    - }
    - get xColumnKey() {
    - return `xColumn`
    - }
    - get contentKey() {
    - return `content`
    - }
    - get rowDisplayLimitKey() {
    - return `rowDisplayLimit`
    - }
    - get settingKey() {
    - return `setting`
    - }
    - // todo: ADD TYPINGS
    - getPipishInput() {
    - // todo: add placeholder property?
    - return this.getSettingsStruct().content || this.getParentOrDummyTable().getFirstColumnAsString() || ""
    - }
    - getDependencies() {
    - return [{ getLineModifiedTime: () => this.getParentOrDummyTable().getTableCTime() }] // todo: we removed this: this.getOutputOrInputTable().getTableCTime()...i think we had it because we want to return true to update children.
    - }
    - getRunTimeEnumOptions(cell) {
    - // todo: only works if codemirror === tab
    - try {
    - // todo: handle at static time.
    - if (cell.getCellTypeId() === "columnNameCell" && this.isLoaded()) {
    - const mirrorNode = typeof app === "undefined" ? this : app.mountedProgram.nodeAtLine(this.getLineNumber() - 1)
    - return mirrorNode.getParentOrDummyTable().getColumnNames()
    - }
    - } catch (err) {
    - console.log(err)
    - }
    - }
    - mapSettingNamesToColumnNames(settingNames) {
    - const tileStruct = this.getSettingsStruct()
    - return settingNames.map(name => tileStruct[name])
    - }
    - getOutputOrInputTable() {
    - return this._outputTable || this.getParentOrDummyTable()
    - }
    - getOutputTable() {
    - return this._outputTable
    - }
    - getParentOrDummyTable() {
    - // Returns: non-empty input table || dummy table || empty input table.
    - const parentTable = this.getParent().getOutputOrInputTable()
    - if (!parentTable.isBlankTable()) return parentTable
    - return this._getDummyTable() || parentTable
    - }
    - _getDummyTable() {
    - const dataSet = DummyDataSets[this.dummyDataSetName]
    - if (!this._dummyTable && dataSet) this._dummyTable = new Table(jtree.Utils.javascriptTableWithHeaderRowToObjects(dataSet))
    - return this._dummyTable
    - }
    - getRequiredTableWithHeader(headerSettingNames) {
    - const columnNames = this.mapSettingNamesToColumnNames(headerSettingNames)
    - const table = this.getParentOrDummyTable()
    - const columns = columnNames.map(name => table.getTableColumnByName(name))
    - if (columns.some(col => !col)) return []
    - return this.getRowsAsDataTableArrayWithHeader(table.getRows(), columnNames)
    - }
    - setIsDataLoaded(value) {
    - this._isDataLoaded = value
    - this.makeDirty() // todo: remove
    - return this
    - }
    - getRowsAsDataTableArrayWithHeader(rows, header) {
    - const data = rows.map(row => row.getAsArray(header))
    - data.unshift(header)
    - return data
    - }
    - getTileQualityCheck() {
    - const definition = this.getDefinition()
    - const name = this.getFirstWord()
    - let score = 0
    - return {
    - name: name,
    - namespace: name.split(".")[0],
    - description: definition.getDescription() ? 1 : 0,
    - dummyDataSetName: this.dummyDataSetName,
    - runTimeErrors: Object.values(this.getRunTimePhaseErrors()).length,
    - examples: definition.getExamples().length,
    - edgeTests: 0,
    - speedTests: 0,
    - roadMap: 0,
    - idealStyleUXDescription: 0,
    - secPriTests: 0,
    - userType: 0
    - }
    - }
    - _getCachedSettings() {
    - if (this._cache_settingsObject) return this._cache_settingsObject
    - this._cache_settingsObject = {}
    - this.filter(child => child.doesExtend("abstractTileSettingTerminalNode") || child.doesExtend("abstractTileSettingNonTerminalNode")).forEach(setting => {
    - this._cache_settingsObject[setting.getFirstWord()] = setting.getSettingValue()
    - })
    - return this._cache_settingsObject
    - }
    - // todo: ADD TYPINGS
    - getSettingsStruct() {
    - const settingsFromCache = this._getCachedSettings()
    - // todo: this wont work anymore
    - const hintsNode = this.getDefinition().getConstantsObject()[this.columnPredictionHintsKey]
    - if (hintsNode)
    - Object.assign(
    - settingsFromCache,
    - this.getParentOrDummyTable().getPredictionsForAPropertyNameToColumnNameMapGivenHintsNode(new jtree.TreeNode(hintsNode), settingsFromCache)
    - )
    - return settingsFromCache
    - }
    - getProgramTemplate(id) {}
    - getSnippetTemplate(id) {}
    - getExampleTemplate(index) {
    - // todo: right now we only have 1 example per tile.
    - const exampleNode = this.getDefinition().getNode(jtree.GrammarConstants.example)
    - return exampleNode ? exampleNode.childrenToString() : ""
    - }
    - toStumpLoadingCode() {
    - return this.qFormat(this.tileLoadingTemplate, {
    - classes: this.getCssClassNames().join(" "),
    - id: this.getTreeComponentId(),
    - name: this.getWord(0),
    - footer: this.getTileMenuButtonStumpCode()
    - })
    - }
    - emitLogMessage(message) {
    - const tab = this.getTab()
    - if (tab) tab.addStumpCodeMessageToLog(message)
    - else if (this.isNodeJs()) console.log(message)
    - }
    - getTheme() {
    - return this.getTab().getTheme()
    - }
    - qFormat(str, obj) {
    - return new jtree.TreeNode(str).templateToString(obj)
    - }
    - scrollIntoView() {
    - const el = this.getStumpNode()
    - .getShadow()
    - .getShadowElement()
    - if (el) el.scrollIntoView()
    - }
    - async loadBrowserRequirements() {
    - const loadingMap = this.getTab()
    - .getRootNode()
    - .getDefinitionLoadingPromiseMap()
    - if (!loadingMap.has(this.constructor)) loadingMap.set(this.constructor, this._makeBrowserLoadRequirementsPromise(loadingMap))
    - await loadingMap.get(this.constructor)
    - }
    - async _makeBrowserLoadRequirementsPromise(loadingMap) {
    - const app = this.getWebApp()
    - const cssScript = this[OhayoConstants.tileCssScript]
    - if (cssScript) this._loadTileCss(cssScript)
    - const def = this.getDefinition()
    - const scriptPaths = def.nodesThatStartWith("string " + OhayoConstants.tileScript).map(node => node.getWord(2))
    - const thisScript = this[OhayoConstants.tileScript]
    - if (thisScript && !scriptPaths.includes(thisScript)) scriptPaths.push(thisScript)
    - if (scriptPaths.length) await Promise.all(scriptPaths.map(scriptPath => app.getWillowBrowser().appendScript(scriptPath)))
    - loadingMap.set(this.constructor, true)
    - }
    - _loadTileCss(css) {
    - const app = this.getWebApp()
    - app
    - .getWillowBrowser()
    - .getBodyStumpNode()
    - .insertChildNode(
    - css
    - .split(" ")
    - .map(
    - url => `link
    - rel stylesheet
    - media screen
    - href ${url}`
    - )
    - .join("\n")
    - )
    - }
    - _hasBrowserRequirements() {
    - return this.tileScript
    - }
    - _areBrowserRequirementsLoaded() {
    - if (this.isNodeJs()) return true
    - // todo: cleanup. assumes app is here in browser.
    - const loadingMap = app.getDefinitionLoadingPromiseMap()
    - return !this._hasBrowserRequirements() || loadingMap.get(this.constructor) === true
    - }
    - isLoaded() {
    - return this._areBrowserRequirementsLoaded() && (!this.needsData || this._isDataLoaded)
    - }
    - getErrorMessageHtml() {
    - const errors = Object.values(this.getRunTimePhaseErrors())
    - return errors.length ? ` ${errors.join(" ")}` : "" //todo: cleanup
    - }
    - toStumpErrorStateCode(err) {
    - return this.qFormat(this.errorStateStumpTemplate, {
    - classes: this.getCssClassNames().join(" "),
    - id: this.getTreeComponentId(),
    - content: `div ` + err,
    - footer: this.getTileMenuButtonStumpCode()
    - })
    - }
    - // todo: delete this
    - makeDirty() {
    - delete this._cache_settingsObject
    - delete this._bodyStumpCodeCache // todo: cleanup
    - this._setLastRenderedTime(0)
    - }
    - getAllTileSettingsDefinitions() {
    - const def = this.getDefinition()
    - return Object.values(def.getFirstWordMapWithDefinitions()).filter(def => def.isOrExtendsANodeTypeInScope([OhayoConstants.abstractTileSetting]))
    - }
    - getTab() {
    - return this.getRootNode().getTab()
    - }
    - getChildTiles() {
    - return this.getChildInstancesOfNodeTypeId("abstractTileTreeComponentNode")
    - }
    - selectTile() {
    - this.selectNode()
    - if (this.isMounted()) this.getStumpNode().addClassToStumpNode(OhayoConstants.selectedClass)
    - }
    - unselectNode() {
    - super.unselectNode()
    - if (this.isMounted()) this.getStumpNode().removeClassFromStumpNode(OhayoConstants.selectedClass)
    - }
    - getCssClassNames() {
    - const classNames = super.getCssClassNames()
    - if (this._isMaximized()) classNames.push("TileMaximized")
    - return classNames
    - }
    - toStumpCode() {
    - return this.qFormat(this.tileStumpTemplate, {
    - classes: this.getCssClassNames().join(" "),
    - id: this.getTreeComponentId(),
    - bodyStyle: this.customBodyStyle || "",
    - body: this._getBodyStumpCodeCache() || "",
    - footer: this.getTileFooterStumpCode()
    - })
    - }
    - _getBodyStumpCodeCache() {
    - if (!this._bodyStumpCodeCache) this._bodyStumpCodeCache = this.getTileBodyStumpCode()
    - return this._bodyStumpCodeCache
    - }
    - getTileBodyStumpCode() {
    - return ``
    - }
    - _getCss() {
    - const selector = "#" + this.getTreeComponentId()
    - const theme = this.getTheme()
    - const visibleCss = this.isVisible() ? "" : "display: none"
    - const hakonCode = this.hakonTemplate ? new jtree.TreeNode(theme).evalTemplateString(this.hakonTemplate) : this.toHakonCode()
    - return `${selector} { ${visibleCss} }
    - ${theme.hakonToCss(hakonCode)}`
    - }
    - handleTileError(err) {
    - if (!this._errorCount) this._errorCount = 0
    - this._errorCount++
    - this.getRootNode().goRed(err)
    - }
    - async insertTileBetweenCommand() {
    - const tab = this.getTab()
    - const newNode = this.appendLine("doc.picker")
    - this.getChildTiles().forEach(tile => {
    - if (tile === newNode) return true
    - newNode.appendNode(tile)
    - tile.unmountAndDestroy()
    - })
    - tab.autosaveTab()
    - await this.getRootNode().loadAndIncrementalRender()
    - }
    - getWall() {
    - return this.getWebApp().getAppWall()
    - }
    - getWebApp() {
    - return this.getTab().getRootNode()
    - }
    - async runAndrenderAndGetRenderReport() {
    - await this.execute()
    - return this.renderAndGetRenderReport()
    - }
    - getTimeToLoad() {
    - return this._timeToLoad || 0
    - }
    - toHakonCode() {
    - return ""
    - }
    - getTileFooterStumpCode() {
    - return this.getTileMenuButtonStumpCode()
    - }
    - getTileMenuButtonStumpCode() {
    - return this.qFormat(this.pencilStumpTemplate)
    - }
    - // Tile child rendering is done at the wall level.
    - _getChildTreeComponents() {
    - return []
    - }
    - getStumpNodeForChildren() {
    - // We render all Tiles on the Wall.
    - return this.getStumpNode().getParent()
    - }
    - toInspectionStumpCode() {
    - const messages = this.getMessageBuffer().map(message => `li ${moment(message.getLineModifiedTime()).fromNow()} - ${message.childrenToString()}`)
    - // const settings = this.getAllTileSettingsDefinitions()
    - // .map(setting => `${setting.getFirstWord()} ${setting.getDescription()}`)
    - // .join("\n")
    - const settings = JSON.stringify(this.getSettingsStruct(), null, 2)
    - const parentConstructorName = this.getParent().constructor.name
    - const constructorName = this.constructor.name
    - const sourceCode = this.toString()
    - const inputTable = this.getParentOrDummyTable()
    - const outputTable = this.getOutputOrInputTable()
    - const outputColumns = outputTable.getColumnsArrayOfObjects()
    - const inputCols = inputTable.getColumnsArrayOfObjects()
    - const inputCount = inputTable.getRowCount()
    - const outputCount = outputTable.getRowCount()
    - const timeToLoad = this.getTimeToLoad()
    - const renderTime = this.getNewestTimeToRender()
    - const inputColumnsAsTable = new jtree.TreeNode(inputCols).toTable()
    - const outputColumnsAsTable = new jtree.TreeNode(outputColumns).toTable()
    - const outputNumericValues = new jtree.TreeNode(outputTable.getJavascriptNativeTypedValues()).toTable()
    - const typeScriptInterface = outputTable.toTypeScriptInterface()
    - const inputNumericValues = new jtree.TreeNode(inputTable.getJavascriptNativeTypedValues()).toTable()
    - return this.qFormat(this.inspectionStumpTemplate, {
    - settings,
    - inputCount,
    - outputCount,
    - timeToLoad,
    - renderTime,
    - inputColumnsAsTable,
    - outputColumnsAsTable,
    - outputNumericValues,
    - typeScriptInterface,
    - inputNumericValues,
    - constructorName,
    - parentConstructorName,
    - sourceCode,
    - messages
    - })
    - }
    - isVisible() {
    - if (this.has(this.visibleKey)) return true
    - if (this.visible === false) return false
    - if (this.has(this.hiddenKey)) return false
    - return true
    - }
    - _isMaximized() {
    - return this.has(OhayoConstants.maximized)
    - }
    - async _executeChildNodes() {
    - await Promise.all(this.getChildTiles().map(tile => tile.execute()))
    - }
    - async _execute() {
    - this.setIsDataLoaded(true)
    - await this._executeChildNodes()
    - }
    - async execute() {
    - try {
    - this.setRunTimePhaseError("execute")
    - await this._execute()
    - } catch (err) {
    - this.setRunTimePhaseError("execute", err)
    - console.error(err)
    - this.emitLogMessage(this.errorLogMessageStumpTemplate)
    - }
    - return this
    - }
    - cloneTileCommand() {
    - this.duplicateLineCommand()
    - return this.getTab().autosaveAndRender()
    - }
    - duplicateLineCommand() {
    - return this.getParent().insertLineAndChildren(this.getLine(), undefined, this.getIndex() + 1)
    - }
    - async toggleTileMaximizeCommand() {
    - if (this.has(OhayoConstants.maximized)) this.delete(OhayoConstants.maximized)
    - else this.touchNode(OhayoConstants.maximized)
    - await this._runAfterTileUpdate(this)
    - }
    - async triggerTileMethodCommand(value, methodName) {
    - await thisethodName](value)
    - await this._runAfterTileUpdate(this)
    - }
    - // todo: refactor.
    - async changeTileTypeCommand(newValue) {
    - const tab = this.getTab()
    - this.setFirstWord(newValue)
    - const newNode = this.duplicate()
    - // todo: destroy or something? how do we reparse.
    - this.getChildTiles().forEach(tile => tile.unmountAndDestroy())
    - this.unmountAndDestroy()
    - tab.autosaveTab()
    - this.getRootNode().loadAndIncrementalRender()
    - }
    - changeParentCommand(pathVector) {
    - // if (tile.getFirstWordPath() === value) return; // todo: do we need this line?
    - const program = this.getRootNode()
    - const indexPath = pathVector ? pathVector.split(" ").map(num => parseInt(num)) : ""
    - const destinationTree = indexPath ? program.nodeAt(indexPath) : program
    - // todo: on jtree should we make copyTo second param optional?
    - this.copyTo(destinationTree, destinationTree.length)
    - this.unmountAndDestroy()
    - return this.getTab().autosaveAndRender()
    - }
    - async removeTileCommand() {
    - const tab = this.getTab()
    - this.getChildTiles().forEach(tile => {
    - tile.unmount()
    - tile.shiftLeft()
    - })
    - this.unmountAndDestroy()
    - tab.autosaveTab()
    - this.getRootNode().loadAndIncrementalRender()
    - }
    - getNewDataCommand() {
    - // todo: have some type of paging system to fetch new data.
    - }
    - async changeTileSettingAndRenderCommand(value, settingName) {
    - // note the unusual ordering of params.
    - this.touchNode(settingName).setContent(value.toString())
    - // todo: sometimes size needs to be redone (maximize, for example)
    - await this._runAfterTileUpdate(this)
    - }
    - // todo: remove
    - async changeTileSettingMultilineCommand(val, settingName) {
    - this.touchNode(settingName).setChildren(val)
    - await this._runAfterTileUpdate(this)
    - }
    - async changeTileSettingCommand(settingName, value) {
    - this.touchNode(settingName).setContent(value)
    - }
    - async changeWordAndRenderCommand(value, index) {
    - this.setWord(parseInt(index), value)
    - await this._runAfterTileUpdate(this)
    - }
    - async changeWordsAndRenderCommand(value, index) {
    - index = parseInt(index)
    - const edgeSymbol = this.getEdgeSymbol()
    - const words = this.getWords().slice(0, index)
    - this.setLine(words.concat(value.split(edgeSymbol)).join(edgeSymbol))
    - await this._runAfterTileUpdate(this)
    - }
    - async updateChildrenCommand(val) {
    - this.setChildren(val)
    - // reload the whole doc for now.
    - await this._runAfterTileUpdate(this)
    - }
    - async _runAfterTileUpdate(tile) {
    - tile.makeDirty() // ugly!
    - tile.getChildTiles().forEach(tile => {
    - tile.makeDirty() // todo: ugly!
    - })
    - // todo: what if you have a tile that has a contextare that allows editing of its children/
    - // if you edit a child, then that parent tile needs to update to...should we allow that or ban that?
    - await tile.getTab().autosaveTab()
    - await tile.runAndrenderAndGetRenderReport()
    - tile
    - .getTab()
    - .getRootNode()
    - .renderApp() // Need to render full app because of code editor
    - }
    - // todo: downstream data changes?
    - async changeTileContentAndRenderCommand(value) {
    - this.setContent(value)
    - await this._runAfterTileUpdate(this)
    - }
    - async copyTileCommand() {
    - // todo: remove cousin tiles?
    - this.getRootNode()
    - .getWillowBrowser()
    - .copyTextToClipboard(this.getFirstAncestor().toString())
    - }
    - async createProgramFromTileExampleCommand(index) {
    - const template = this.getExampleTemplate(index)
    - if (!template) return undefined
    - const fileExtension = "ohayo" // todo: generalize
    - const tab = await this.getTab()
    - .getRootNode()
    - ._createAndOpen(template, `help-for-${this.getFirstWord()}.${fileExtension}`)
    - tab.addStumpCodeMessageToLog(`div Created '${tab.getFullTabFilePath()}'`)
    - }
    - async inspectTileCommand() {
    - if (!this.isNodeJs()) {
    - console.log("Tile available at window.tile")
    - window.tile = this
    - console.log(this)
    - }
    - this.getTab().addStumpCodeMessageToLog(this.toInspectionStumpCode())
    - this.getTab()
    - .getRootNode()
    - .renderApp()
    - }
    - async toggleTileMenuCommand() {
    - const app = this.getTab().getRootNode()
    - app.setTargetTile(this)
    - app.toggleAndRender(`${StudioConstants.tileMenu}`)
    - }
    - async createProgramFromTemplateCommand(id) {
    - const programTemplate = this.getProgramTemplate(id)
    - if (!programTemplate) return undefined
    - const tab = await this.getTab()
    - .getRootNode()
    - ._createAndOpen(programTemplate.template, programTemplate.name)
    - tab.addStumpCodeMessageToLog(`div Created '${tab.getFullTabFilePath()}'`)
    - }
    - async appendSnippetTemplateCommand(id) {
    - const snippet = this.getSnippetTemplate(id)
    - if (!snippet) return undefined
    - const tab = this.getTab()
    - const tabProgram = tab.getTabProgram()
    - const newNodes = tabProgram.concat(snippet)
    - const newTiles = newNodes.filter(tile => tile.doesExtend && tile.doesExtend("abstractTileTreeComponentNode"))
    - tab.autosaveTab()
    - tabProgram.clearSelection()
    - tab.getTabWall().unmount()
    - await tabProgram.loadAndIncrementalRender()
    - newTiles.forEach(tile => tile.selectTile())
    - newTiles[0].scrollIntoView()
    - }
    - async copyDataCommand(delimiter) {
    - this.getRootNode()
    - .getWillowBrowser()
    - .copyTextToClipboard(this.getOutputOrInputTable().toDelimited(delimiter))
    - }
    - async copyDataAsJavascriptCommand() {
    - const table = this.getOutputOrInputTable()
    - this.getRootNode()
    - .getWillowBrowser()
    - .copyTextToClipboard(JSON.stringify(table.toTree().toDataTable(table.getColumnNames()), null, 2))
    - }
    - async copyDataAsTreeCommand() {
    - const text = this.getOutputOrInputTable()
    - .toTree()
    - .toString()
    - this.getRootNode()
    - .getWillowBrowser()
    - .copyTextToClipboard(text)
    - }
    - async exportTileDataCommand(format = "csv") {
    - // todo: figure this out. use the browsers filename? tile title? id?
    - let extension = "csv"
    - let type = "text/csv"
    - let str = this.getOutputOrInputTable().toDelimited(",")
    - if (format === "tree") {
    - extension = "tree"
    - type = "text"
    - str = this.getOutputOrInputTable()
    - .toTree()
    - .toString()
    - }
    - this.getRootNode()
    - .getWillowBrowser()
    - .downloadFile(str, this.getTab().getFileName() + "." + extension, type)
    - }
    - }
    -
    - class abstractChartNode extends abstractTileTreeComponentNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { rowDisplayLimit: rowDisplayLimitNode }),
    - undefined
    - )
    - }
    - get tileFooterTemplate() {
    - return `span Rows: {rowCount} Columns Out: {columnCount}
    - {tileMenuButton}`
    - }
    - get rowDisplayLimit() {
    - return 10000
    - }
    - getTileFooterStumpCode() {
    - const table = this.getParentOrDummyTable()
    - return this.qFormat(this.tileFooterTemplate, {
    - rowCount: table.getRowCount(),
    - columnCount: table.getColumnCount(),
    - tileMenuButton: this.getTileMenuButtonStumpCode()
    - })
    - }
    - getTileRunTimeWidth() {
    - return this.isNodeJs() ? 456 : jQuery(".WallTreeComponent").width() - 100
    - }
    - getTileRunTimeHeight() {
    - return 300
    - }
    - toDisplayString(value, columnName) {
    - // todo: remove.
    - if (value === undefined) return ""
    - return this.getParentOrDummyTable()
    - .getTableColumnByName(columnName)
    - .toDisplayString(value)
    - }
    - _getRowDisplayLimit() {
    - const limitStr = this.getSettingsStruct()[this.rowDisplayLimitKey] || this.rowDisplayLimit
    - const limit = parseInt(limitStr)
    - if (!limitStr || isNaN(limit)) return undefined
    - return limit
    - }
    - getRowsWithRowDisplayLimit() {
    - return this.getParentOrDummyTable()
    - .getRows()
    - .slice(0, this._getRowDisplayLimit())
    - }
    - }
    -
    - class abstractTextNode extends abstractChartNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { content: contentNode }),
    - undefined
    - )
    - }
    - get stringCell() {
    - return this.getWordsFrom(0)
    - }
    - get bodyStumpTemplate() {
    - return `div
    - class TileSelectable
    - bern
    - {content}`
    - }
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, { content: this.content ? jtree.Utils.linkify(this.content) : "" })
    - }
    - }
    -
    - class abstractInstructionsNode extends abstractTextNode {
    - get content() {
    - return `Instructions go here.`
    - }
    - get tileSize() {
    - return `600 240`
    - }
    - }
    -
    - class amazonHistoryNode extends abstractInstructionsNode {
    - get dummyDataSetName() {
    - return `amazonPurchases`
    - }
    - get content() {
    - return `Step 1. Go to https://www.amazon.com/gp/b2b/reports to download your Amazon order history.
    Step 2. Add the data here.`
    - }
    - }
    -
    - class fitbitAllNode extends abstractInstructionsNode {
    - get content() {
    - return `Step 1. Go to https://www.fitbit.com/settings/data/export to download your Fitbit data.
    Step 2. Drop the CSV onto this page.`
    - }
    - }
    -
    - class abstractComingSoonNode extends abstractTextNode {
    - get content() {
    - return `Instructions go here.`
    - }
    - get tileSize() {
    - return `600 240`
    - }
    - }
    -
    - class datawrapperComingSoonNode extends abstractComingSoonNode {
    - get content() {
    - return `We don't have support yet for https://www.datawrapper.de/`
    - }
    - }
    -
    - class dcjsComingSoonNode extends abstractComingSoonNode {
    - get content() {
    - return `We don't have support yet for https://github.com/dc-js/dc.js`
    - }
    - }
    -
    - class finosPerspectiveComingSoonNode extends abstractComingSoonNode {
    - get content() {
    - return `We don't have support yet for https://perspective.finos.org/`
    - }
    - }
    -
    - class fivethirtyeightComingSoonNode extends abstractComingSoonNode {
    - get content() {
    - return `We don't have support yet for https://github.com/fivethirtyeight/data/`
    - }
    - }
    -
    - class GovNode extends abstractComingSoonNode {
    - get content() {
    - return `We don't have support yet for https://www.data.gov/`
    - }
    - }
    -
    - class highchartsComingSoonNode extends abstractComingSoonNode {
    - get content() {
    - return `We don't have support yet for https://www.highcharts.com/blog/snippets/3d-solar-system/`
    - }
    - }
    -
    - class re3dataComingSoonNode extends abstractComingSoonNode {
    - get content() {
    - return `We don't have support yet for https://www.re3data.org/`
    - }
    - }
    -
    - class zingComingSoonNode extends abstractComingSoonNode {
    - get content() {
    - return `We don't have support yet for https://www.zingchart.com/`
    - }
    - }
    -
    - class editorHelloWorldNode extends abstractTextNode {
    - get content() {
    - return `Ohayo world!`
    - }
    - }
    -
    - class abstractSnippetGalleryNode extends abstractChartNode {
    - get optionStumpTemplate() {
    - return `li
    - a {title}
    - value {value}
    - class appendSnippetButton
    - clickCommand appendSnippetTemplateCommand`
    - }
    - get bodyStumpTemplate() {
    - return `h4 {title}
    - ol
    - class TileSelectable
    - {options}`
    - }
    - get tileSize() {
    - return `600 240`
    - }
    - getGalleryNodes() {}
    - async _execute() {
    - this._outputTable = new Table(
    - this.getGalleryNodes()
    - .toDataTable()
    - .slice(1)
    - )
    - this.setIsDataLoaded(true)
    - await this._executeChildNodes()
    - }
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, {
    - title: this.title,
    - options: new jtree.TreeNode(
    - this.getGalleryNodes()
    - .map(node => this.qFormat(this.optionStumpTemplate, { title: node.evalTemplateString(this.itemFormat), value: node.get("id") }))
    - .join("\n")
    - ).toString()
    - })
    - }
    - }
    -
    - class abstractTemplateGalleryNode extends abstractSnippetGalleryNode {
    - get optionStumpTemplate() {
    - return `li
    - a {title}
    - value {value}
    - class createProgramButton
    - clickCommand createProgramFromTemplateCommand`
    - }
    - }
    -
    - class challengeListNode extends abstractSnippetGalleryNode {
    - get itemFormat() {
    - return `{question}`
    - }
    - get title() {
    - return `Try a challenge:`
    - }
    - getGalleryNodes() {
    - return typeof challengesTree === "undefined" ? jtree.TreeNode.fromDisk("ohayo/packages/challenge/challenges.tree") : new jtree.TreeNode(challengesTree)
    - }
    - getSnippetTemplate(id) {
    - return `challenge.play ${id}`
    - }
    - }
    -
    - class samplesListNode extends abstractSnippetGalleryNode {
    - get isDataPublicDomain() {
    - return true
    - }
    - get itemFormat() {
    - return `{id} - {description}`
    - }
    - get title() {
    - return `All samples:`
    - }
    - getGalleryNodes() {
    - // todo: cleanup.
    - const ohayo = this.getWebApp().getOhayoGrammarAsTree()
    - const hits = ohayo.getNodesByRegex(/^samples/).map(node => {
    - return {
    - id: node.get("crux"),
    - description: node.get("description")
    - }
    - })
    - return new jtree.TreeNode(hits)
    - }
    - getSnippetTemplate(id) {
    - return id
    - }
    - }
    -
    - class vegaDataListNode extends abstractSnippetGalleryNode {
    - get itemFormat() {
    - return `{id}`
    - }
    - get title() {
    - return `All Vega datasets:`
    - }
    - getGalleryNodes() {
    - // todo: cleanup this line.
    - const node = this.getWebApp()
    - .getOhayoGrammarAsTree()
    - .getNodesByRegex(/^vegaDataSetCell/)[0]
    - return new jtree.TreeNode(
    - node
    - .get("enum")
    - .split(" ")
    - .map(item => {
    - return {
    - id: item
    - }
    - })
    - )
    - }
    - getSnippetTemplate(id) {
    - return `vega.data ${id}`
    - }
    - }
    -
    - class vegaExampleListNode extends abstractSnippetGalleryNode {
    - get itemFormat() {
    - return `{id}`
    - }
    - get title() {
    - return `All Vega examples:`
    - }
    - getGalleryNodes() {
    - // todo: cleanup this line.
    - const node = this.getWebApp()
    - .getOhayoGrammarAsTree()
    - .getNodesByRegex(/^vegaExampleNameCell/)[0]
    - return new jtree.TreeNode(
    - node
    - .get("enum")
    - .split(" ")
    - .map(item => {
    - return {
    - id: item
    - }
    - })
    - )
    - }
    - getSnippetTemplate(id) {
    - return `vega.example ${id}`
    - }
    - }
    -
    - class abstractPickerTileNode extends abstractChartNode {
    - get categoryBreakStumpTemplate() {
    - return `div {category}
    - class PickerCategory`
    - }
    - get itemStumpTemplate() {
    - return `{categoryBreak}
    - a {name}
    - br
    - span {description}
    - title {description}
    - tabindex -1
    - value {value}
    - class pickerItemButton
    - clickCommand {command}`
    - }
    - get hakonTemplate() {
    - return `.abstractPickerTileNode
    - .PickerCategory
    - width 100%
    - margin-top 20px
    - text-align center
    - .TileBody
    - display flex
    - flex-flow row wrap
    - a
    - &:hover
    - background-color {borderColor}
    - padding 10px
    - margin 5px
    - height 30px
    - background-color {backgroundColor}
    - border 1px solid {borderColor}
    - overflow hidden
    - text-align center
    - text-overflow ellipsis
    - font-size 14px
    - width 120px
    - span
    - font-size 70%`
    - }
    - get needsData() {
    - return false
    - }
    - get tileSize() {
    - return `480 420`
    - }
    - async fetchTableInputs() {
    - return { rows: this.getChoices() }
    - }
    - getTileBodyStumpCode() {
    - let lastCat = ""
    - return this.getChoices()
    - .map(choice => {
    - choice.categoryBreak = lastCat !== choice.category ? this.qFormat(this.categoryBreakStumpTemplate, { category: choice.category }) : ""
    - lastCat = choice.category
    - return this.qFormat(this.itemStumpTemplate, choice)
    - })
    - .join("\n")
    - }
    - }
    -
    - class PickerTileNode extends abstractPickerTileNode {
    - getChoices() {
    - const allChoices = this.getRootNode()
    - .getHandGrammarProgram()
    - .getTopNodeTypeDefinitions()
    - const filteredChoices = allChoices.filter(nodeDef => !(nodeDef.get(jtree.GrammarConstants.tags) || "").includes(OhayoConstants.noPicker))
    - const theChoices = filteredChoices.length ? filteredChoices : allChoices
    - return theChoices.map(nodeDefinition => {
    - const nodeId = nodeDefinition.get("crux") || nodeDefinition.getNodeTypeIdFromDefinition()
    - const name = nodeId.split(".")[1] || ""
    - const category = lodash.upperFirst(nodeId.split(".")[0])
    - const description = nodeDefinition.getDescription()
    - return { name, category, description, value: nodeId, command: "changeTileTypeCommand" }
    - })
    - }
    - }
    -
    - class templatesListNode extends abstractPickerTileNode {
    - getChoices() {
    - // todo: cleanup.
    - const choices = this.getWebApp()
    - .getStandardTemplates()
    - .map(node => {
    - const id = node
    - .getWord(1)
    - .replace("templates/", "")
    - .replace(this.ohayoFileExtensionKey, "")
    - return {
    - command: "createProgramFromTemplateCommand",
    - name: node.get("data doc.title"),
    - value: id,
    - category: lodash.upperFirst(node.get("data doc.categories")),
    - description: ""
    - }
    - })
    - return lodash.sortBy(choices, "category")
    - }
    - getProgramTemplate(id) {
    - const node = this.getWebApp()
    - .getStandardTemplates()
    - .filter(node => node.getContent() === `templates/${id}${this.ohayoFileExtensionKey}`)[0]
    - return {
    - template: node.getNode("data").childrenToString(),
    - name: id + this.ohayoFileExtensionKey
    - }
    - }
    - }
    -
    - class asciiChartNode extends abstractChartNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { yColumn: yColumnNode }),
    - undefined
    - )
    - }
    - get titleCell() {
    - return this.getWordsFrom(0)
    - }
    - get bodyStumpTemplate() {
    - return `pre
    - class TileSelectable
    - style overflow: scroll; width: 100%; height: 100%; white-space: pre;
    - bern
    - {title}
    - {chart}`
    - }
    - get columnPredictionHints() {
    - return `yColumn isString=false`
    - }
    - get tileScript() {
    - return `ohayo/packages/asciichart/asciichart.js`
    - }
    - getTileBodyStumpCode() {
    - // todo: autodetect column
    - const columName = this.mapSettingNamesToColumnNames(["yColumn"])[0]
    - const column = this.getParentOrDummyTable().getColumnByName(columName)
    - const values = column.getValues()
    - const chart = asciichart.plot(values, { height: 15 })
    - const title = this.getContent() || ""
    - const leftPad = Math.max(0, Math.floor((chart.split("\n")[0].length - title.length) / 2))
    - return this.qFormat(this.bodyStumpTemplate, { title: " ".repeat(leftPad) + title, chart })
    - }
    - }
    -
    - class calendarHeatNode extends abstractChartNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { count: countNode, dayColumn: dayColumnNode }),
    - undefined
    - )
    - }
    - get hakonTemplate() {
    - return `.heatCal
    - rect
    - fill {darkerBackground}
    - shape-rendering crispedges
    - text
    - font-size 10px
    - fill #ddd`
    - }
    - get bodyStumpTemplate() {
    - return `div
    - class heatCal
    - bern
    - {svg}`
    - }
    - get dummyDataSetName() {
    - return `waterBill`
    - }
    - get columnPredictionHints() {
    - return `count getPrimitiveTypeName=number
    - dayColumn getPrimitiveTypeName=day`
    - }
    - get tileSize() {
    - return `750 200`
    - }
    - _getLegend(quins, squareSideWithPadding, position) {
    - const theme = this.getTheme()
    - const quinSvgs = quins
    - .map((quin, index) => {
    - const left = position.left + squareSideWithPadding * index
    - const style = "fill: " + theme.getHeatColor(1 - quin.percent)
    - return ``
    - })
    - .join("")
    - return `
    - Less
    - ${quinSvgs}
    - More
    - `
    - }
    - getTileBodyStumpCode() {
    - const svg = this._getSvg()
    - return this.qFormat(this.bodyStumpTemplate, { svg })
    - }
    - _getDayMap(quins, rows, dayColumnName, countColumnName) {
    - const getQuin = val => {
    - for (let index = 0; index < quins.length; index++) {
    - if (val <= quins[index].value) return quins[index].percent
    - }
    - }
    - const dayMap = {}
    - rows.forEach(row => {
    - dayMapoment(row[dayColumnName]).format("MM/DD/YYYY")] = {
    - Quin: getQuin(row[countColumnName]),
    - count: row[countColumnName],
    - row: row
    - }
    - })
    - return dayMap
    - }
    - _getDaysArray(startDay, daysToShow) {
    - const days = []
    - const firstDay = parseInt(startDay.format("e"))
    - for (let dayIndex = 0; dayIndex <= daysToShow; dayIndex++) {
    - const day = startDay.clone().add(dayIndex, "days")
    - days.push({
    - day: day,
    - row: parseInt(day.format("e")),
    - col: Math.floor((firstDay + dayIndex) / 7)
    - })
    - }
    - return days
    - }
    - _getDayNamesG(squareSideWithPadding) {
    - const dayNames = [{ day: "Mon", row: 2 }, { day: "Wed", row: 4 }, { day: "Fri", row: 6 }]
    - .map(day => {
    - const _top = 20 + day.row * squareSideWithPadding - 3
    - return `${day.day}`
    - })
    - .join("")
    - return `${dayNames}`
    - }
    - _getMonthNamesG(daysArray, squareSideWithPadding) {
    - const _usedMonths = {}
    - const monthNames = daysArray
    - .map(day => {
    - const monthName = day.day.format("MMM")
    - const monthYear = day.day.format("MM/YYYY")
    - if (_usedMonthsonthYear]) return ""
    - _usedMonthsonthYear] = true
    - const left = 40 + day.col * squareSideWithPadding
    - return `${monthName}`
    - })
    - .join("")
    - return `${monthNames}`
    - }
    - _getDataSquaresG(daysArray, squareSideWithPadding, dayMap) {
    - const dayFormat = "MM/DD/YYYY"
    - const today = moment(Date.now()).format(dayFormat)
    - const theme = this.getTheme()
    - const dataSquares = daysArray
    - .map(day => {
    - const dayKey = day.day.format(dayFormat)
    - const _top = 20 + day.row * squareSideWithPadding
    - const left = 40 + day.col * squareSideWithPadding
    - const value = dayMap[dayKey]
    - const todayStyle = dayKey === today ? "stroke-width:2;stroke:rgb(0,0,0);" : ""
    - const style = (value ? "fill: " + theme.getHeatColor(1 - value.Quin) : "") + ";" + todayStyle
    - const title = `${dayKey}: ${value ? value.count : 0}`
    - return `${title}`
    - })
    - .join("")
    - return `${dataSquares}`
    - }
    - _getSvg() {
    - const inputTable = this.getParentOrDummyTable()
    - const rows = inputTable.getJavascriptNativeTypedValues()
    - if (!rows.length) return ""
    - const tileStruct = this.getSettingsStruct()
    - const dayColumnName = tileStruct.dayColumn
    - const countColumnName = tileStruct.count
    - if (!dayColumnName || !countColumnName) return ""
    - const dayCol = inputTable.getTableColumnByName(dayColumnName)
    - const countCol = inputTable.getTableColumnByName(countColumnName)
    - let daysToShow = 365 * 1 // todo: make configurable
    - let endDay = moment(Date.now())
    - let startDay = endDay.clone().subtract(daysToShow, "days")
    - // todo: make configurable
    - // reductions = dayCol.getReductions()
    - // startDay = moment(reductions.min)
    - // endDay = moment(reductions.max)
    - // daysToShow = endDay.diff(startDay, "days")
    - const squareSide = 10
    - const squarePadding = 2
    - const squareSideWithPadding = squareSide + squarePadding
    - const width = squareSideWithPadding * (daysToShow / 6)
    - const height = 7 * squareSideWithPadding + 100
    - const quins = countCol.getQuins()
    - const dayMap = this._getDayMap(quins, rows, dayColumnName, countColumnName)
    - const daysArray = this._getDaysArray(startDay, daysToShow)
    - const dayNamesG = this._getDayNamesG(squareSideWithPadding)
    - const monthNamesG = this._getMonthNamesG(daysArray, squareSideWithPadding)
    - const squaresG = this._getDataSquaresG(daysArray, squareSideWithPadding, dayMap)
    - const keyG = this._getLegend(quins, squareSideWithPadding, { top: 110, left: 60 })
    - return `${dayNamesG + squaresG + monthNamesG + keyG}`
    - }
    - }
    -
    - class challengePlayNode extends abstractChartNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get challengeIdCell() {
    - return parseInt(this.getWord(1))
    - }
    - get challengeAnswerCell() {
    - return this.getWordsFrom(2).map(val => parseFloat(val))
    - }
    - get tileSize() {
    - return `640 240`
    - }
    - getProgramTemplate(id) {
    - const challengeNode = this._getChallengeNode(parseInt(id))
    - return {
    - template: challengeNode.getNode("solution").childrenToString(),
    - name: "challenge-" + id + "-solution.ohayo"
    - }
    - }
    - _getChallengeNode(challengeId) {
    - const challenges =
    - typeof challengesTree === "undefined" ? jtree.TreeNode.fromDisk("ohayo/packages/challenge/challenges.tree") : new jtree.TreeNode(challengesTree)
    - return challenges.nodeAt(challengeId - 1) || challenges.nodeAt(0)
    - }
    - getTileBodyStumpCode() {
    - const challengeId = parseInt(this.getWord(1))
    - const answer = this.getWord(2)
    - const challengeNode = this._getChallengeNode(challengeId)
    - const isCorrect = answer === challengeNode.get("answer")
    - const theme = this.getTheme()
    - const color = answer ? (isCorrect ? theme.successColor : theme.errorColor) : theme.warningColor
    - const answerMessage = answer !== undefined ? (isCorrect ? "CORRECT!" : "Wrong.") : ""
    - return `h3 Challenge #${challengeId}
    - style color:${color}
    - br
    - div ${challengeNode.evalTemplateString(`Question: {question}`)}
    - class TileSelectable
    - br
    - input
    - placeholder Enter your answer here. All answers are a number.
    - value ${answer !== undefined ? answer : ""}
    - style width: 300px;
    - name 2
    - changeCommand changeWordAndRenderCommand
    - span ${answerMessage}
    - style color: ${color};
    - br
    - div
    - a See a solution
    - clickCommand createProgramFromTemplateCommand
    - value ${challengeId}`
    - }
    - }
    -
    - class debugDumpNode extends abstractChartNode {
    - get bodyStumpTemplate() {
    - return `div
    - style overflow: scroll; width: 100%; height: 100%; white-space: pre;
    - bern
    - {text}`
    - }
    - _getCharacterLimit() {
    - // Todo: great example of a scale test. I found it to be slow with:
    - /*
    - vega.sample movies.json
    - web.dump
    - So some tiles will have characterLimit, rowDisplayLimit, et cetera. And have "speedTestExamples" .
    - */
    - return 20000
    - }
    - getTileBodyStumpCode() {
    - const text = this._getTextToDump()
    - const characterLimit = this._getCharacterLimit()
    - let sub = text.substr(0, characterLimit)
    - if (text.length > characterLimit)
    - // todo: Show standardized truncation warning
    - sub = `(Notice: Results truncated to ${characterLimit} characters)
    ` + sub
    - return this.qFormat(this.bodyStumpTemplate, { text: sub || "No data to dump" })
    - }
    - _getTextToDump() {
    - return this.getPipishInput()
    - }
    - }
    -
    - class webDumpNode extends debugDumpNode {
    - _getTextToDump() {
    - return this.getParent().getWillowHttpResponse ? this.getParent().getWillowHttpResponse().text : `${this.constructor.name} requires a parent web tile.`
    - }
    - }
    -
    - class debugCommandsNode extends abstractChartNode {
    - get bodyStumpTemplate() {
    - return `a Run Speed Test on all Templates
    - clickCommand _runTemplateSpeedTestCommand
    - br
    - a Open all Templates Command
    - clickCommand _openAllTemplatesCommand
    - br
    - a Run Tile Quality Check
    - clickCommand _doTileQualityCheckCommand`
    - }
    - getTileBodyStumpCode() {
    - return this.bodyStumpTemplate
    - }
    - _runTemplateSpeedTestCommand() {
    - return this.getWebApp()._runTemplateSpeedTestCommand()
    - }
    - _openAllTemplatesCommand() {
    - return this.getWebApp()._openAllTemplatesCommand()
    - }
    - _doTileQualityCheckCommand() {
    - return this.getWebApp()._doTileQualityCheckCommand()
    - }
    - }
    -
    - class debugSleepNode extends abstractChartNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get millisecondsCell() {
    - return parseInt(this.getWord(1))
    - }
    - get dummyDataSetIdCell() {
    - return this.getWord(2)
    - }
    - get dummyDataSetName() {
    - return `waterBill`
    - }
    - async fetchTableInputs() {
    - const ms = parseInt(this.getWord(1) || 1)
    - await this.getWebApp().sleepCommand(ms)
    - return { rows: jtree.Utils.javascriptTableWithHeaderRowToObjects(DummyDataSets[this.getWord(2) || "stockPrice"]) }
    - }
    - }
    -
    - class debugNoOpNode extends abstractChartNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get anyCell() {
    - return this.getWordsFrom(1)
    - }
    - get visible() {
    - return false
    - }
    - }
    -
    - class debugThrowNode extends abstractChartNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get tileEventNameCell() {
    - return this.getWord(1)
    - }
    - async fetchTableInputs() {
    - this._throwIfMethodNameIs("fetchTableInputs")
    - return {
    - rows: []
    - }
    - }
    - _throwIfMethodNameIs(name) {
    - // Never throw if no word provided. That ensures it wont throw during testing.
    - const lookingFor = this.getContent()
    - if (lookingFor === name) throw new Error(`DebugTile threw an error on purpose on event: "${lookingFor}"`)
    - }
    - getTileBodyStumpCode() {
    - this._throwIfMethodNameIs("getTileBodyStumpCode")
    - }
    - treeComponentDidMount() {
    - this._throwIfMethodNameIs("treeComponentDidMount")
    - }
    - treeComponentDidUpdate() {
    - this._throwIfMethodNameIs("treeComponentDidUpdate")
    - }
    - }
    -
    - class dtjsBasicNode extends abstractChartNode {
    - get rowStumpTemplate() {
    - return `tr
    - {cols}`
    - }
    - get cellStumpTemplate() {
    - return `td
    - bern
    - {box}`
    - }
    - get bodyStumpTemplate() {
    - return `div
    - table
    - class DataTable
    - thead
    - tr
    - {headerRows}
    - tbody
    - {rows}`
    - }
    - get tileScript() {
    - return `ohayo/packages/dtjs/datatables.min.js`
    - }
    - get tileCssScript() {
    - return `ohayo/packages/dtjs/datatables.min.css`
    - }
    - get tileSize() {
    - return `1200 500`
    - }
    - getTileBodyStumpCode() {
    - const columnDefs = this.getParentOrDummyTable()
    - .getColumnsArray()
    - .slice(0, 10)
    - const headerRows = this._getHeaderRowsStumpCode(columnDefs.map(col => col.getColumnName()))
    - const rows = this._getTableRowsStumpCode(columnDefs)
    - return this.qFormat(this.bodyStumpTemplate, { headerRows, rows })
    - }
    - _getHeaderRowsStumpCode(columns) {
    - return columns.map(colName => `th ${colName}`).join("\n")
    - }
    - _getTableRowsStumpCode(columns) {
    - return this.getRowsWithRowDisplayLimit()
    - .slice(0, 10)
    - .map((row, index) => {
    - const cols = columns
    - .map(column => {
    - const box = row.getRowHtmlSafeValue(column.getColumnName()) // todo: cache?
    - return this.qFormat(this.cellStumpTemplate, { box })
    - })
    - .join("\n")
    - return this.qFormat(this.cellStumpTemplate, { cols })
    - })
    - .join("\n")
    - }
    - treeComponentWillUnmount() {
    - // cleanup
    - }
    - treeComponentDidUpdate() {
    - super.treeComponentDidUpdate()
    - const table = this.getParentOrDummyTable()
    - const columnDefs = this.getParentOrDummyTable()
    - .getColumnsArray()
    - .slice(0, 10)
    - const container = this.getStumpNode().findStumpNodeByChild("class DataTable")
    - if (this.isNodeJs()) return undefined
    - const width = this.getTileRunTimeWidth()
    - const height = this.getTileRunTimeHeight()
    - const shadow = container.getShadow()
    - const el = shadow.getShadowElement()
    - shadow.setShadowCss({ width, height })
    - const rows = this.getRowsWithRowDisplayLimit()
    - // todo: note, this is only works with jQuery
    - jQuery.fn.dataTable.ext.errMode = "throw"
    - this._dataTables = jQuery(el).DataTable({
    - data: this.getRowsAsDataTableArrayWithHeader(rows, columnDefs.map(col => col.getColumnName())).slice(1),
    - pageLength: 10,
    - scrollY: height
    - //"scrollCollapse": true,
    - //"paging": false
    - })
    - }
    - treeComponentDidMount() {
    - this.treeComponentDidUpdate()
    - }
    - }
    -
    - class editorGalleryNode extends abstractChartNode {
    - get miniStyleTemplate() {
    - return `div`
    - }
    - get bodyStumpTemplate() {
    - return `div
    - class MiniMapTile
    - {minis}`
    - }
    - get miniStumpTemplate() {
    - return `a
    - class miniMap
    - {onClick}
    - {value}
    - {href}
    - div
    - class miniPreview
    - {theTiles}
    - div {filename}
    - class miniFooter`
    - }
    - get hakonTemplate() {
    - return `.MiniMapTile
    - .miniMap
    - background {backgroundColor}
    - width 120px
    - height 90px
    - margin 6px
    - position relative
    - overflow hidden
    - box-sizing border-box
    - display inline-block
    - &:hover
    - border 1px solid {boxShadow}
    - &:active
    - border 2px solid {boxShadow}
    - .miniFooter
    - font-size 12px
    - position absolute
    - bottom 0
    - width 100%
    - height 15px
    - line-height 15px
    - white-space nowrap
    - text-align center
    - .miniPreview
    - position absolute
    - width 100%
    - height calc(100% - 15px)
    - top 0
    - overflow hidden
    - div
    - background {linkColor}
    - height 5px
    - margin 1px`
    - }
    - get dummyDataSetName() {
    - return `ohayoPrograms`
    - }
    - get tileSize() {
    - return `1080 600`
    - }
    - async openFullPathInNewTabAndFocusCommand(url) {
    - return this.getTab()
    - .getRootNode()
    - .openFullPathInNewTabAndFocusCommand(url)
    - }
    - _getMiniStumpCode(sourceCode, filename, permalink, width = 120, height = 75) {
    - const ohayoProgram = new ohayoNode(sourceCode)
    - const theTiles = ohayoProgram
    - .getTiles()
    - .filter(tile => tile.isVisible())
    - .map(tile => this.qFormat(this.miniStyleTemplate, {}))
    - .join("\n")
    - const onClick = permalink ? "clickCommand openFullPathInNewTabAndFocusCommand" : ""
    - const value = permalink ? `value ${permalink}` : ""
    - const href = permalink ? `href ${permalink}` : ""
    - return this.qFormat(this.miniStumpTemplate, { filename, theTiles, onClick, value, href })
    - }
    - getTileBodyStumpCode() {
    - // todo: cache.
    - const minis = this.getRowsWithRowDisplayLimit()
    - .map(row => this._getMiniStumpCode(row.getRowOriginalValue("bytes"), row.getRowOriginalValue("filename"), row.getRowOriginalValue("link")))
    - .join("\n")
    - return this.qFormat(this.bodyStumpTemplate, { minis })
    - }
    - }
    -
    - class handsontableBasicNode extends abstractChartNode {
    - get bodyStumpTemplate() {
    - return `div
    - class hot`
    - }
    - get hakonTemplate() {
    - return `.hot
    - color black`
    - }
    - get tileScript() {
    - return `ohayo/packages/handsontable/handsontable.full.min.js`
    - }
    - get tileCssScript() {
    - return `ohayo/packages/handsontable/handsontable.min.css`
    - }
    - get tileSize() {
    - return `1200 500`
    - }
    - getTileBodyStumpCode() {
    - return this.bodyStumpTemplate
    - }
    - // todo: allow editing
    - treeComponentWillUnmount() {
    - if (this._hot) this._hot.destroy()
    - delete this._hot
    - }
    - treeComponentDidUpdate() {
    - super.treeComponentDidUpdate()
    - const table = this.getParentOrDummyTable()
    - const columnDefs = table.getColumnsByImportance()
    - const colNames = columnDefs.map(col => col.getColumnName())
    - const rows = this.getRowsWithRowDisplayLimit()
    - const data = this.getRowsAsDataTableArrayWithHeader(rows, colNames)
    - const container = this.getStumpNode().findStumpNodeByChild("class hot")
    - const app = this.getWebApp()
    - if (this.isNodeJs()) return undefined
    - const width = this.getTileRunTimeWidth()
    - const height = this.getTileRunTimeHeight()
    - this._hot = new Handsontable(container.getShadow().getShadowElement(), {
    - data: data,
    - rowHeaders: true,
    - colHeaders: true,
    - stretchH: "all",
    - width,
    - minSpareCols: 10,
    - minSpareRows: 30,
    - afterSelection: () => app.pauseShortcutListener(),
    - afterDeselect: () => app.startShortcutListener(),
    - height
    - })
    - return this._hot
    - }
    - treeComponentDidMount() {
    - this.treeComponentDidUpdate()
    - }
    - }
    -
    - class abstractHtmlNode extends abstractChartNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { style: styleNode, content: contentNode }),
    - undefined
    - )
    - }
    - get htmlCell() {
    - return this.getWordsFrom(0)
    - }
    - get bodyStumpTemplate() {
    - return `{tag}
    - {style}
    - {src}
    - bern
    - {content}`
    - }
    - get hakonTemplate() {
    - return `.abstractHtmlNode
    - code
    - user-select text`
    - }
    - getTileFooterStumpCode() {
    - return this.getTileMenuButtonStumpCode()
    - }
    - async fetchTableInputs() {
    - return { rows: [{ text: this.getHtmlContent() }] }
    - }
    - getHtmlContent() {
    - return this.getWordsFrom(2).join(" ") || "No html content to show."
    - }
    - getTag() {
    - return this.getWord(1) || "div" // todo: verify this is legal tag.
    - }
    - getSrc() {
    - return this.getSettingsStruct().src
    - }
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, {
    - tag: this.getTag(),
    - style: this.style ? `style ${this.style}` : "",
    - src: this.getSrc() ? `src ${this.getSrc()}` : "",
    - content: this.getHtmlContent() || ""
    - })
    - }
    - }
    -
    - class htmlTextNode extends abstractHtmlNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get htmlTextTagCell() {
    - return this.getWord(1)
    - }
    - get htmlCell() {
    - return this.getWordsFrom(2)
    - }
    - }
    -
    - class htmlPrintAsNode extends abstractHtmlNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get htmlTextTagCell() {
    - return this.getWord(1)
    - }
    - getHtmlContent() {
    - return this.getPipishInput()
    - }
    - }
    -
    - class abstractHTMLFixedTagTileNode extends abstractHtmlNode {
    - getHtmlContent() {
    - return this.getContent()
    - }
    - getTag() {
    - return this.htmlTagName
    - }
    - }
    -
    - class htmlH1Node extends abstractHTMLFixedTagTileNode {
    - get htmlCell() {
    - return this.getWordsFrom(0)
    - }
    - get style() {
    - return `text-align:center;`
    - }
    - get htmlTagName() {
    - return `h1`
    - }
    - get tileSize() {
    - return `600 75`
    - }
    - }
    -
    - class abstractHTMLContentIsSrcTileNode extends abstractHTMLFixedTagTileNode {
    - getHtmlContent() {
    - return ""
    - }
    - getSrc() {
    - return this.getContent() || super.getSrc()
    - }
    - }
    -
    - class htmlImgNode extends abstractHTMLContentIsSrcTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get urlCell() {
    - return this.getWord(1)
    - }
    - get style() {
    - return `width:100%;`
    - }
    - get htmlTagName() {
    - return `img`
    - }
    - }
    -
    - class htmlIframeNode extends abstractHTMLContentIsSrcTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get urlCell() {
    - return this.getWord(1)
    - }
    - get htmlTagName() {
    - return `iframe`
    - }
    - }
    -
    - class htmlCustomNode extends abstractChartNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { content: contentNode }),
    - undefined
    - )
    - }
    - get bodyStumpTemplate() {
    - return `div
    - bern
    - {content}`
    - }
    - getTileBodyStumpCode() {
    - // https://meta.stackexchange.com/questions/1777/what-html-tags-are-allowed-on-stack-exchange-sites
    - // todo: sanitize tags
    - const contentNode = this.getNode("content")
    - const content = contentNode ? contentNode.childrenToString() : "No HTML content to show"
    - return this.qFormat(this.bodyStumpTemplate, { content })
    - }
    - }
    -
    - class iconsIconNode extends abstractChartNode {}
    -
    - class iconsHumanNode extends iconsIconNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { genderColumn: genderColumnNode, headSize: headSizeNode }),
    - undefined
    - )
    - }
    - get dummyDataSetName() {
    - return `patients`
    - }
    - get bodyStumpTemplate() {
    - return `div
    - bern
    - {bern}`
    - }
    - get columnPredictionHints() {
    - return `headSize isString=false
    - genderColumn isString=true`
    - }
    - getTileBodyStumpCode() {
    - // Now, what if there is no input table?
    - const table = this.getParentOrDummyTable()
    - const rows = table.getRows()
    - // Now, what if we are using dummy input table?
    - const headSizeColumn = this.getSettingsStruct().headSize
    - const genderColumn = this.getSettingsStruct().genderColumn
    - const reducts = table.getColumnByName(headSizeColumn).getReductions()
    - const headColMax = reducts.max
    - const bern = rows
    - .map(row => {
    - const typedRow = row.rowToObjectWithOnlyNativeJavascriptTypes()
    - const value = typedRow[headSizeColumn]
    - // TODO: ADD TYPINGS
    - const genderVal = typedRow[genderColumn].toLowerCase()
    - const gender = genderVal === "male" ? "blue" : "pink"
    - let character = "O"
    - let percent = value / headColMax
    - if (isNaN(value)) {
    - character = "x"
    - percent = reducts.median / headColMax
    - }
    - const title = row.getHoverTitle()
    - percent = Math.round(18 * percent)
    - return `${character}`
    - })
    - .join(" ")
    - return this.qFormat(this.bodyStumpTemplate, { bern: bern })
    - }
    - }
    -
    - class iconsCircleNode extends iconsIconNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { radius: radiusNode }),
    - undefined
    - )
    - }
    - get bodyStumpTemplate() {
    - return `div
    - bern
    - {bern}`
    - }
    - get dummyDataSetName() {
    - return `playerGoals`
    - }
    - get columnPredictionHints() {
    - return `radius isString=false`
    - }
    - getTileBodyStumpCode() {
    - const column = this.getSettingsStruct().radius
    - const bern = this.getParentOrDummyTable()
    - .getRows()
    - .map(row => `O`)
    - .join(" ")
    - return this.qFormat(this.bodyStumpTemplate, { bern: bern })
    - }
    - }
    -
    - class listBasicNode extends abstractChartNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { label: labelNode }),
    - undefined
    - )
    - }
    - get columnNameCell() {
    - return this.getWordsFrom(0)
    - }
    - get columnPredictionHints() {
    - return `label getTitlePotential`
    - }
    - get dummyDataSetName() {
    - return `telescopes`
    - }
    - get tileSize() {
    - return `400 400`
    - }
    - get listItemStumpTemplate() {
    - return `li
    - span {label}`
    - }
    - get bodyStumpTemplate() {
    - return `ol
    - {items}`
    - }
    - _getListItem(label) {
    - return this.qFormat(this.listItemStumpTemplate, { label })
    - }
    - _getLabelColumnName() {
    - // todo: more automatic! Need to fix our columns/keywords issues
    - return this.getWord(1) || this.getSettingsStruct().label
    - }
    - getTileBodyStumpCode() {
    - const labelColumnName = this._getLabelColumnName()
    - const items = this.getRowsWithRowDisplayLimit()
    - .map(row => this._getListItem(jtree.Utils.stripHtml(row.getRowOriginalValue(labelColumnName)), row))
    - .join("\n")
    - return this.qFormat(this.bodyStumpTemplate, { items })
    - }
    - }
    -
    - class listLinksNode extends listBasicNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { label: labelNode, link: linkNode }),
    - undefined
    - )
    - }
    - get columnNameCell() {
    - return this.getWordsFrom(0)
    - }
    - get columnPredictionHints() {
    - return `label getTitlePotential
    - link isLink`
    - }
    - get listItemHakonTemplate() {
    - return `li
    - a {label}
    - href {link}`
    - }
    - get dummyDataSetName() {
    - return `telescopes`
    - }
    - _getUrlColumnName() {
    - // todo: more automatic! Need to fix our columns/keywords issues
    - return this.getWord(2) || this.getSettingsStruct().link
    - }
    - _getListItem(label, row) {
    - const urlColumnName = this._getUrlColumnName()
    - if (!urlColumnName) return super._getListItem(label, row)
    - return this.qFormat(this.listItemHakonTemplate, { label, link: jtree.Utils.stripHtml(row.getRowOriginalValue(urlColumnName)) })
    - }
    - }
    -
    - class markdownToHtmlNode extends abstractChartNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { content: contentNode }),
    - undefined
    - )
    - }
    - get dummyDataSetName() {
    - return `markdown`
    - }
    - get tileSize() {
    - return `400 400`
    - }
    - get bodyStumpTemplate() {
    - return `div
    - class TileSelectable
    - bern
    - {md}`
    - }
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, { md: marked(this.getPipishInput()) })
    - }
    - }
    -
    - class abstractRoughJsChartNode extends abstractChartNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { roughness: roughnessNode }),
    - undefined
    - )
    - }
    - get titleCell() {
    - return this.getWordsFrom(0)
    - }
    - get bodyStumpTemplate() {
    - return `div
    - id {id}`
    - }
    - get tileScript() {
    - return `ohayo/packages/roughjs/roughviz.min.js`
    - }
    - _getRoughId() {
    - return `rough${this._getUid()}`
    - }
    - treeComponentDidUpdate() {
    - super.treeComponentDidUpdate()
    - if (this.isNodeJs()) return undefined
    - this._drawRough()
    - }
    - treeComponentDidMount() {
    - this.treeComponentDidUpdate()
    - }
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, { id: this._getRoughId() })
    - }
    - get _roughness() {
    - const value = this.get("roughness")
    - return value ? parseInt(value) : 1
    - }
    - _getOptions() {
    - return {}
    - }
    - _drawRough() {
    - const colors = this.get("colors") ? this.get("colors").split(" ") : undefined
    - const options = Object.assign(this._getOptions(), {
    - title: this.getContent() || "",
    - element: "#" + this._getRoughId(),
    - roughness: this._roughness,
    - width: this.getTileRunTimeWidth(),
    - height: this.getTileRunTimeHeight(),
    - colors,
    - data: this._getRoughData()
    - })
    - const roughEl = new roughViz[this.roughChartType](options)
    - }
    - _getValues(settingName) {
    - const columName = this.mapSettingNamesToColumnNames([settingName])[0]
    - return this.getParentOrDummyTable()
    - .getColumnByName(columName)
    - .getValues()
    - }
    - }
    -
    - class abstractRoughJsLabelValueNode extends abstractRoughJsChartNode {
    - get columnPredictionHints() {
    - return `value getPrimitiveTypeName=number`
    - }
    - get dummyDataSetName() {
    - return `stockPrice`
    - }
    - _getRoughData() {
    - const data = { labels: this._getValues("label"), values: this._getValues("value") }
    - console.log(data)
    - return data
    - }
    - }
    -
    - class roughJsBarNode extends abstractRoughJsLabelValueNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { label: labelNode, value: valueNode }),
    - undefined
    - )
    - }
    - get roughChartType() {
    - return `Bar`
    - }
    - }
    -
    - class roughJsPieNode extends abstractRoughJsLabelValueNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { label: labelNode, value: valueNode }),
    - undefined
    - )
    - }
    - get roughChartType() {
    - return `Pie`
    - }
    - }
    -
    - class roughJsLineNode extends abstractRoughJsChartNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { colors: colorsNode }),
    - undefined
    - )
    - }
    - get roughChartType() {
    - return `Line`
    - }
    - _getNumericColumns() {
    - return Object.values(this.getParentOrDummyTable().getColumnsMap()).filter(col => col.isNumeric())
    - }
    - _getRoughData() {
    - const data = {}
    - const numerics = this._getNumericColumns()
    - numerics.forEach(col => {
    - data[col.getColumnName()] = col.getValues()
    - })
    - return data
    - }
    - _getOptions() {
    - const options = {}
    - const numerics = this._getNumericColumns()
    - numerics.forEach((col, index) => {
    - options["y" + index] = col.getColumnName()
    - })
    - return options
    - }
    - }
    -
    - class abstractShowTileNode extends abstractChartNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - get titleCell() {
    - return this.getWordsFrom(2)
    - }
    - get bodyStumpTemplate() {
    - return `h6 {title}
    - h3 {number}`
    - }
    - get hakonTemplate() {
    - return `.abstractShowTileNode
    - h3
    - text-align center
    - h6
    - text-align center
    - height 40px
    - overflow hidden`
    - }
    - get dummyDataSetName() {
    - return `stockPrice`
    - }
    - get tileSize() {
    - return `140 120`
    - }
    - getTileBodyStumpCode() {
    - const columnName = this.getWord(1)
    - if (!columnName) return `No data for ${this.getFirstWord()}`
    - const table = this.getParentOrDummyTable()
    - const col = table.getTableColumnByName(columnName)
    - if (!col) {
    - console.log(`No column named ${columnName}`)
    - return ""
    - }
    - const reductionName = this.reductionName || this.getWord(0).split(".")[1]
    - const title = this.getWordsFrom(2).join(" ") || [columnName, reductionName].join(" ")
    - const number = this.toDisplayString(col.getReductions()[reductionName], columnName)
    - return this.qFormat(this.bodyStumpTemplate, { title, number })
    - }
    - }
    -
    - class showRowCountNode extends abstractShowTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get titleCell() {
    - return this.getWordsFrom(1)
    - }
    - get defaultTitle() {
    - return `Total rows`
    - }
    - get dummyDataSetName() {
    - return `stockPrice`
    - }
    - get tileSize() {
    - return `140 120`
    - }
    - getTileBodyStumpCode() {
    - const title = this.getWordsFrom(1).join(" ") || this.defaultTitle
    - return this.qFormat(this.bodyStumpTemplate, { title, number: this._getNumber() })
    - }
    - _getNumber() {
    - return this.getParentOrDummyTable().getRowCount()
    - }
    - }
    -
    - class showColumnCountNode extends showRowCountNode {
    - get defaultTitle() {
    - return `Total columns`
    - }
    - _getNumber() {
    - return this.getParentOrDummyTable().getColumnNames().length
    - }
    - }
    -
    - class showStaticNode extends abstractShowTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get numberCell() {
    - return parseFloat(this.getWord(1))
    - }
    - get titleCell() {
    - return this.getWordsFrom(2)
    - }
    - getTileBodyStumpCode() {
    - const title = this.getWordsFrom(2).join(" ")
    - return this.qFormat(this.bodyStumpTemplate, { title, number: this.getWord(1) || "" })
    - }
    - }
    -
    - class showValueNode extends abstractShowTileNode {
    - get reductionName() {
    - return `median`
    - }
    - }
    -
    - class showMedianNode extends abstractShowTileNode {}
    -
    - class showSumNode extends abstractShowTileNode {}
    -
    - class showMeanNode extends abstractShowTileNode {}
    -
    - class showMinNode extends abstractShowTileNode {}
    -
    - class showMaxNode extends abstractShowTileNode {}
    -
    - class tablesBasicNode extends abstractChartNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { columnLimit: columnLimitNode }),
    - undefined
    - )
    - }
    - get bodyStumpTemplate() {
    - return `div
    - class tablesBasicNode
    - table
    - thead
    - {headerRows}
    - tbody
    - {bodyRows}`
    - }
    - get headerRowStumpTemplate() {
    - return `th
    - value {colName}
    - span {colName}
    - value {colName}`
    - }
    - get rowStumpTemplate() {
    - return `tr
    - class tableRow
    - value {value}
    - td {number}
    - {cols}`
    - }
    - get cellLinkStumpTemplate() {
    - return `td
    - a
    - href {content}
    - bern
    - {content}`
    - }
    - get cellStumpTemplate() {
    - return `td
    - bern
    - {content}`
    - }
    - get hakonTemplate() {
    - return `.tablesBasicNode
    - font-size 14px
    - box-sizing border-box
    - {enableTextSelect1}
    - table
    - width 100%
    - tr
    - white-space nowrap
    - padding 0
    - td
    - border 1px solid {lineColor}
    - tr:nth-child(even)
    - background-color {veryLightGrey}
    - td,th
    - padding 2px 3px
    - text-align left
    - overflow hidden
    - text-overflow ellipsis
    - max-width 250px
    - td:hover,th:hover
    - overflow visible
    - td:first-child,th:first-child
    - padding-left 5px
    - color {greyish}
    - width 60px
    - th
    - cursor pointer
    - background-color {lightGrey}
    - border 1px solid {lineColor}
    - border-bottom-color {greyish}`
    - }
    - get customBodyStyle() {
    - return `padding:0px;`
    - }
    - get tileSize() {
    - return `750 300`
    - }
    - get columnLimit() {
    - return 20
    - }
    - get rowDisplayLimit() {
    - return 100
    - }
    - _getTableRowsStumpCode(columns) {
    - return this.getRowsWithRowDisplayLimit()
    - .map((row, index) => {
    - const cols = columns
    - .map(column => {
    - return this.qFormat(column.isLink() ? this.cellLinkStumpTemplate : this.cellStumpTemplate, {
    - content: row.getRowHtmlSafeValue(column.getColumnName())
    - })
    - })
    - .join("\n")
    - return this.qFormat(this.rowStumpTemplate, { number: index + 1, value: row.getPuid(), cols })
    - })
    - .join("\n")
    - }
    - _getHeaderRowsStumpCode(columns) {
    - // todo: can we get a copy column command?
    - return ["Row"]
    - .concat(columns)
    - .map(colName => this.qFormat(this.headerRowStumpTemplate, { colName }))
    - .join("\n")
    - }
    - getTileBodyStumpCode() {
    - const tileStruct = this.getSettingsStruct()
    - const table = this.getParentOrDummyTable()
    - if (table.isBlankTable()) return `div No data to show`
    - let columnDefs = tileStruct.columnOrder === "importance" ? table.getColumnsByImportance() : table.getColumnsArray()
    - columnDefs = columnDefs.slice(0, tileStruct.columnLimit || this.columnLimit)
    - const columnNames = columnDefs.map(col => col.getColumnName())
    - // todo: if the types for a column are all equal, add a total row to the bottom.
    - // todo: if the types for a row are all equal, add a total column to the right.
    - const headerRows = this._getHeaderRowsStumpCode(columnNames)
    - const bodyRows = this._getTableRowsStumpCode(columnDefs)
    - return this.qFormat(this.bodyStumpTemplate, { headerRows, bodyRows })
    - }
    - }
    -
    - class tablesInterestingNode extends tablesBasicNode {
    - get columnOrder() {
    - return `importance`
    - }
    - }
    -
    - class tablesDumpNode extends tablesBasicNode {
    - get columnOrder() {
    - return `default`
    - }
    - }
    -
    - class textWordcloudNode extends abstractChartNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { column: columnNode, count: countNode }),
    - undefined
    - )
    - }
    - get columnPredictionHints() {
    - return `name isString=true
    - count isString=false`
    - }
    - get dummyDataSetName() {
    - return `wordCounts`
    - }
    - get tileScript() {
    - return `ohayo/packages/text/wordcloud2.min.js`
    - }
    - get bodyStumpTemplate() {
    - return `div
    - class divWhereWordCloudWillGo
    - style height: 300px;`
    - }
    - getTileBodyStumpCode() {
    - return this.bodyStumpTemplate
    - }
    - _getAllWords() {
    - return this.getRequiredTableWithHeader(["name", "count"])
    - }
    - treeComponentDidUpdate() {
    - this._draw()
    - }
    - treeComponentDidMount() {
    - this._draw()
    - }
    - _draw() {
    - if (this.isNodeJs()) return undefined
    - const tileStruct = this.getSettingsStruct()
    - const words = this._getAllWords()
    - if (!words.length) return
    - words.shift() // drop header
    - const shadow = this.getStumpNode().getShadow()
    - const width = shadow.getShadowOuterWidth()
    - const powConstant = 10 / Math.log(words.length) // breaks if too hgih.
    - const options = {
    - list: words.map(word => [word[0], word[1]]),
    - shuffle: false,
    - gridSize: Math.round((16 * width) / 1024),
    - weightFactor: size => (Math.pow(size, powConstant) * width) / 1024,
    - backgroundColor: "transparent",
    - random: jtree.Utils.makeSemiRandomFn(),
    - wait: 0
    - }
    - Object.assign(options, tileStruct)
    - const element = this.getStumpNode()
    - .findStumpNodeByChild("class divWhereWordCloudWillGo")
    - .getShadow()
    - .getShadowElement()
    - WordCloud(element, options)
    - }
    - }
    -
    - class treenotation3dNode extends abstractChartNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    - size: sizeNode,
    - cameraPosition: cameraPositionNode,
    - content: contentNode
    - }),
    - undefined
    - )
    - }
    - get dummyDataSetName() {
    - return `treeProgram`
    - }
    - get tileScript() {
    - return `ohayo/packages/treenotation/vis.min.js`
    - }
    - get tileSize() {
    - return `800 500`
    - }
    - getTileBodyStumpCode() {
    - return `div
    - class visjs`
    - }
    - treeComponentDidMount() {
    - super.treeComponentDidMount()
    - this.treeComponentDidUpdate()
    - }
    - // Called when the Visualization API is loaded.
    - treeComponentDidUpdate() {
    - super.treeComponentDidUpdate()
    - if (this.isNodeJs()) return undefined
    - try {
    - this._tryVis()
    - } catch (err) {
    - // log error
    - console.error(err)
    - }
    - }
    - _tryVis() {
    - const tileStruct = this.getSettingsStruct()
    - const source = this.getPipishInput()
    - const app = this.getWebApp()
    - const program = new ohayoNode(source)
    - const rows = this._treeTo3D(program)
    - // Create and populate a data table.
    - const data = new vis.DataSet()
    - rows.forEach(row => data.add(row))
    - const dotSize = tileStruct.size
    - const showGrid = tileStruct.showGrid
    - // specify options
    - // docs: http://visjs.org/docs/graph3d/
    - const cameraPositionNode = this.getNode("cameraPosition") || new jtree.TreeNode("cameraPosition 4 .1 1.5").getNode("cameraPosition")
    - const distance = parseFloat(cameraPositionNode.getWord(1))
    - const horizontal = parseFloat(cameraPositionNode.getWord(2))
    - const vertical = parseFloat(cameraPositionNode.getWord(3))
    - const options = {
    - width: this.getTileRunTimeWidth() + "px",
    - height: this.getTileRunTimeHeight() - 80 + "px",
    - style: "dot-color", // dot?
    - showPerspective: false,
    - showLegend: false,
    - showShadow: false,
    - keepAspectRatio: true,
    - xStep: 1,
    - yStep: 1,
    - zStep: 1,
    - zMax: 5,
    - showGrid: true,
    - showZAxis: false,
    - showXAxis: false,
    - showYAxis: false,
    - dotSizeRatio: dotSize,
    - dotSizeMinFraction: 1,
    - cameraPosition: {
    - distance: distance,
    - horizontal: horizontal,
    - vertical: vertical
    - },
    - verticalRatio: 1.0,
    - // parameter point contains properties x, y, z, and data
    - // data is the original object passed to the point constructor
    - tooltip: point => point.data.line
    - }
    - // create a graph3d
    - const element = this.getStumpNode()
    - .findStumpNodeByChild("class visjs")
    - .getShadow()
    - .getShadowElement()
    - this._graph3d = new vis.Graph3d(element, data, options)
    - const throttled = lodash.throttle(evt => this._onCameraPositionChange(evt), 100)
    - this._graph3d.on("cameraPositionChange", throttled)
    - }
    - async _onCameraPositionChange(evt) {
    - // todo: throttle
    - const pos = this._graph3d.getCameraPosition()
    - const str = `${pos.distance} ${pos.horizontal} ${pos.vertical}`
    - this.touchNode("cameraPosition").setContent(str)
    - await this.getTab().autosaveTab()
    - }
    - _treeTo3D(program) {
    - // getCameraPosition
    - // setCameraPosition
    - // onCameraPositionChange
    - const theme = this.getWebApp().getTheme()
    - // todo: use node type for color.
    - const tagMap = {}
    - const tagTree = new jtree.TreeNode(program.toCellTypeTree())
    - // const outlineFn = node => node.getIndex()
    - // use language to get dict, use dict to get type overlay to get tag types.
    - const randomFn = jtree.Utils.makeSemiRandomFn()
    - const makeColor = word => {
    - if (!tagMap[word]) tagMap[word] = randomFn() // todo: give word types certain colors. green for keword, red for error, etc
    - const color = tagMap[word]
    - //console.log(color)
    - return color
    - }
    - const points = []
    - const nodeToPoint = (node, index) => {
    - const nodePath = node.getPathVector(program)
    - const tagNode = tagTree.nodeAt(nodePath)
    - node.getWords().forEach((word, wordIndex) => {
    - const wordType = tagNode.getWord(wordIndex)
    - const colorNumber = makeColor(wordType)
    - const xcc = node.getIndentLevel(program) + wordIndex
    - const ycc = -node.getLineNumber()
    - const zcc = 0
    - points.push({
    - x: xcc,
    - y: ycc,
    - z: zcc,
    - line: `cellType: ${wordType} | word: ${word}`,
    - style: colorNumber
    - })
    - })
    - }
    - program.getTopDownArray().forEach(nodeToPoint)
    - return points
    - }
    - }
    -
    - class treenotationOutlineNode extends abstractChartNode {
    - get bodyStumpTemplate() {
    - return `pre
    - style overflow: scroll; width: 100%; height: 100%; margin: 0; box-sizing: border-box; font-family: monospace; line-height: 13px;
    - bern
    - {bern}`
    - }
    - get tileSize() {
    - return `800 500`
    - }
    - get dummyDataSetName() {
    - return `outerSpace`
    - }
    - _getTheBern() {
    - return new jtree.TreeNode(this.getPipishInput()).toOutline()
    - }
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, { bern: this._getTheBern() })
    - }
    - }
    -
    - class treenotationDotlineNode extends treenotationOutlineNode {
    - get dummyDataSetName() {
    - return `outerSpace`
    - }
    - get dots() {
    - return true
    - }
    - _getTheBern() {
    - return new jtree.TreeNode(this.getPipishInput()).toMappedOutline(
    - node =>
    - "o" +
    - node
    - .getLine()
    - .split(" ")
    - .map(word => "º")
    - .join("")
    - )
    - }
    - }
    -
    - class abstractVegaNode extends abstractChartNode {
    - get titleCell() {
    - return this.getWordsFrom(0)
    - }
    - get bodyStumpTemplate() {
    - return `div
    - class divForExternalLibrary`
    - }
    - get markName() {
    - return `bar`
    - }
    - get dummyDataSetName() {
    - return `stockPrice`
    - }
    - get tileScript() {
    - return `ohayo/packages/vega/vega.combined.min.js`
    - }
    - get tileSize() {
    - return `800 300`
    - }
    - // todo: I don't think vega handles . in column names.
    - getTileBodyStumpCode() {
    - return this.bodyStumpTemplate
    - }
    - _getColumnToField(columnName) {
    - if (!columnName) return undefined
    - const columnsMap = this.getParentOrDummyTable().getColumnsMap()
    - const col = columnsMap[columnName]
    - const obj = { field: columnName, type: col.getVegaType() }
    - if (col.isTemporal()) {
    - const timeUnit = col.getVegaTimeUnit()
    - if (timeUnit) obj.timeUnit = timeUnit
    - }
    - return obj
    - }
    - _getElementForVega() {
    - return this.getStumpNode()
    - .findStumpNodeByChild("class divForExternalLibrary")
    - .getShadow()
    - .getShadowElement()
    - }
    - async _drawVega() {
    - // todo: don't rerun this if we dont need to.
    - await vegaEmbed(this._getElementForVega(), this._getVegaSpec())
    - }
    - treeComponentDidUpdate() {
    - super.treeComponentDidUpdate()
    - if (this.isNodeJs()) return undefined
    - this._drawVega()
    - }
    - treeComponentDidMount() {
    - this.treeComponentDidUpdate()
    - }
    - _getVegaData() {
    - return {
    - values: this.getParentOrDummyTable()
    - .cloneNativeJavascriptTypedRows()
    - .slice(0, this._getRowDisplayLimit())
    - }
    - }
    - _getVegaTitle() {
    - return this.getContent()
    - }
    - _getVegaSpec() {
    - return {
    - description: "A simple bar chart with embedded data.",
    - data: this._getVegaData(),
    - width: this.getTileRunTimeWidth(),
    - height: this.getTileRunTimeHeight(),
    - mark: this._getVegaMarkObj(),
    - encoding: this._getEncodingMap(),
    - transform: this._getVegaTransform(),
    - title: this._getVegaTitle(),
    - config: this._getVegaConfig()
    - }
    - }
    - _getVegaTransform() {
    - return undefined
    - }
    - _getVegaConfig() {
    - return undefined
    - }
    - _getEncodingMap() {
    - return {}
    - }
    - // todo: add type
    - _getVegaMarkObj() {
    - return { type: this._getVegaMark(), tooltip: { content: "data" } }
    - }
    - _getVegaMark() {
    - return this.markName
    - }
    - }
    -
    - class vegaBarNode extends abstractVegaNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    - colorColumn: colorColumnNode,
    - shapeColumn: shapeColumnNode,
    - xColumn: xColumnNode,
    - yColumn: yColumnNode
    - }),
    - undefined
    - )
    - }
    - get columnPredictionHints() {
    - return `xColumn
    - yColumn isString=false,!xColumn`
    - }
    - _getEncodingMap() {
    - const columnNames = this.mapSettingNamesToColumnNames([this.xColumnKey, this.yColumnKey, this.colorColumnKey])
    - return {
    - x: this._getColumnToField(columnNames[0]),
    - y: this._getColumnToField(columnNames[1]),
    - color: this._getColumnToField(columnNames[2])
    - }
    - }
    - }
    -
    - class vegaLineNode extends vegaBarNode {
    - get markName() {
    - return `line`
    - }
    - }
    -
    - class vegaAreaNode extends vegaLineNode {
    - get markName() {
    - return `area`
    - }
    - }
    -
    - class vegaScatterNode extends vegaBarNode {
    - get markName() {
    - return `point`
    - }
    - _getEncodingMap() {
    - const columnNames = this.mapSettingNamesToColumnNames([this.xColumnKey, this.yColumnKey, this.colorColumnKey, this.shapeColumnKey])
    - return {
    - x: this._getColumnToField(columnNames[0]),
    - y: this._getColumnToField(columnNames[1]),
    - color: this._getColumnToField(columnNames[2]),
    - shape: this._getColumnToField(columnNames[3])
    - }
    - }
    - }
    -
    - class vegaBubbleNode extends vegaScatterNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { sizeColumn: sizeColumnNode, colorColumn: colorColumnNode }),
    - undefined
    - )
    - }
    - get columnPredictionHints() {
    - return `sizeColumn isString=false
    - xColumn isString=false`
    - }
    - get dummyDataSetName() {
    - return `gapMinder`
    - }
    - get markName() {
    - return `circle`
    - }
    - _getEncodingMap() {
    - const columnNames = this.mapSettingNamesToColumnNames([this.xColumnKey, this.yColumnKey, this.sizeColumnKey, this.colorColumnKey])
    - return {
    - y: {
    - field: columnNames[1],
    - type: "quantitative",
    - scale: { zero: false },
    - axis: { minExtent: 30 }
    - },
    - x: this._getColumnToField(columnNames[0]),
    - size: { field: columnNames[2], type: "quantitative" },
    - color: { value: "#000" }
    - }
    - }
    - }
    -
    - class vegaEmojiNode extends vegaBarNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { yColumn: yColumnNode, emojiColumn: emojiColumnNode }),
    - undefined
    - )
    - }
    - get dummyDataSetName() {
    - return `emojis`
    - }
    - get columnPredictionHints() {
    - return `emojiColumn isString=true
    - yColumn isString=false`
    - }
    - _getVegaConfig() {
    - return { view: { stroke: "" } }
    - }
    - _getVegaMark() {
    - return { type: "text", baseline: "middle" }
    - }
    - _getEncodingMap() {
    - const columnNames = this.mapSettingNamesToColumnNames([this.yColumnKey, "emoji"])
    - return {
    - x: { field: columnNames[1], type: "nominal", axis: null },
    - y: { field: columnNames[0], type: "quantitative", axis: null, sort: null },
    - text: { field: columnNames[1], type: "nominal" },
    - size: { value: 65 }
    - }
    - }
    - }
    -
    - class vegaHistogramNode extends abstractVegaNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { xColumn: xColumnNode }),
    - undefined
    - )
    - }
    - get dummyDataSetName() {
    - return `wordCounts`
    - }
    - get columnPredictionHints() {
    - return `xColumn isString=false`
    - }
    - _getEncodingMap() {
    - const columnName = this.getContent() || this.mapSettingNamesToColumnNames([this.xColumnKey])[0]
    - return {
    - x: {
    - bin: true,
    - field: columnName,
    - type: "quantitative"
    - },
    - y: {
    - aggregate: "count",
    - type: "quantitative"
    - }
    - }
    - }
    - }
    -
    - class vegaExampleNode extends abstractVegaNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get vegaExampleNameCell() {
    - return this.getWord(1)
    - }
    - _getVegaSpec() {
    - return this._spec
    - }
    - async _fetchSpec() {
    - // todo: localtesting.
    - if (this.isNodeJs()) return undefined
    - const exampleName = this.getContent() || "area" // todo: pull this default from the gram?
    - const url = `ohayo/packages/vega/ignore/vega-lite/examples/compiled/${exampleName}.vg.json`
    - const res = await this.getWebApp()
    - .getWillowBrowser()
    - .httpGetUrl(url)
    - const spec = JSON.parse(res.text)
    - // rewrite data urls
    - spec.data.forEach(row => {
    - if (row.url) row.url = row.url.replace("data/", "packages/vega/datasets/")
    - })
    - this._spec = spec
    - return spec
    - }
    - // todo: clean this up.
    - async fetchTableInputs() {
    - const spec = await this._fetchSpec()
    - if (this.isNodeJs()) return { rows: [] }
    - const el = jQuery("
    ")[0]
    - const embedded = await vegaEmbed(el, spec)
    - const rows = await this._getVegaPostTransformOutputRows(spec, embedded)
    - return { rows: rows }
    - }
    - async _getVegaPostTransformOutputRows(spec, embedded) {
    - const tableName = spec.data[0] && spec.data[0].name
    - if (tableName) return embedded.view.data(tableName)
    - // const values = spec.data.values
    - // if (values && values.entries) return Array.from(values.entries())
    - // if (typeof values === "function") return []
    - // else if (values) return values
    - return []
    - }
    - }
    -
    - class DidYouMeanTileNode extends abstractTileTreeComponentNode {
    - get bodyStumpTemplate() {
    - return `div
    - span No tile '{input}' found. Line {lineNo}. Did you mean
    - a {closestTile}
    - collapse
    - tabindex -1
    - value {closestTile}
    - clickCommand changeTileTypeCommand
    - span ?`
    - }
    - getTileBodyStumpCode() {
    - const input = this.getFirstWord()
    - const lineNo = this.getLineNumber()
    - const closestTile = jtree.Utils.didYouMean(
    - input,
    - this.getRootNode()
    - .getHandGrammarProgram()
    - .getTopNodeTypeDefinitions()
    - .map(def => def.get("crux"))
    - )
    - if (!closestTile) {
    - if (!input) return `div Your program has a blank line on line ${lineNo}.`
    - return `div No tile '${input}' found.`
    - }
    - return this.qFormat(this.bodyStumpTemplate, { input, lineNo, closestTile })
    - }
    - getErrors() {
    - return [new jtree.UnknownNodeTypeError(this)]
    - }
    - }
    -
    - class abstractDocTileNode extends abstractTileTreeComponentNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get tileStumpTemplate() {
    - return `div
    - class {classes}
    - id {id}
    - div
    - class TileBody
    - {body}
    - div
    - class TileFooter
    - {footer}`
    - }
    - get bodyStumpTemplate() {
    - return `{tagName}
    - bern
    - {content}`
    - }
    - _getBody() {
    - return this.qFormat(this.bodyStumpTemplate, { content: this.getContent() || "", tagName: this.tagName })
    - }
    - toStumpCode() {
    - return this.qFormat(this.tileStumpTemplate, {
    - classes: this.getCssClassNames().join(" "),
    - footer: this.getTileMenuButtonStumpCode(),
    - id: this.getTreeComponentId(),
    - body: this._getBody()
    - })
    - }
    - }
    -
    - class docTitleNode extends abstractDocTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get stringCell() {
    - return this.getWordsFrom(1)
    - }
    - get tagName() {
    - return `h1`
    - }
    - get tileSize() {
    - return `600 75`
    - }
    - }
    -
    - class docSubtitleNode extends docTitleNode {
    - get tagName() {
    - return `h2`
    - }
    - }
    -
    - class docSectionNode extends abstractDocTileNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    - subtitle: docSectionSubtitleNode,
    - paragraph: docSectionParagraphNode,
    - link: docSectionLinkNode,
    - code: docSectionCodeNode
    - }),
    - undefined
    - )
    - }
    - _getBody() {
    - return this.compile()
    - }
    - _getCompiledLine() {
    - return ""
    - }
    - }
    -
    - class docReferenceNode extends abstractDocTileNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { url: docReferenceUrlNode }),
    - undefined
    - )
    - }
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get referenceIdCell() {
    - return this.getWord(1)
    - }
    - get tagName() {
    - return `p`
    - }
    - }
    -
    - class docCommentNode extends abstractTileTreeComponentNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(commentLineNode, undefined, undefined)
    - }
    - get commentKeywordCell() {
    - return this.getWord(0)
    - }
    - get commentCell() {
    - return this.getWordsFrom(1)
    - }
    - get visible() {
    - return false
    - }
    - }
    -
    - class docToolingNode extends docCommentNode {}
    -
    - class abstractProviderNode extends abstractTileTreeComponentNode {
    - get tileFooterTemplate() {
    - return `span Rows Out: {outputCount} Columns Out: {columnCount} Time: {time}s Parser: {parserId} {errorMessageHtml}
    - {tileMenuButton}`
    - }
    - get tileStumpTemplate() {
    - return `div
    - class {classes}
    - id {id}
    - div
    - class TileBody
    - {body}
    - div
    - class TileFooter
    - {footer}`
    - }
    - get tileSize() {
    - return `140 60`
    - }
    - getTileFooterStumpCode() {
    - const table = this.getOutputOrInputTable()
    - const time = (this.getTimeToLoad() / 1000).toFixed(1)
    - const parserId = this.getParserId() || "?"
    - return this.qFormat(this.tileFooterTemplate, {
    - parserId,
    - errorMessageHtml: this.getErrorMessageHtml() || "",
    - time,
    - outputCount: table.getRowCount(),
    - columnCount: table.getColumnCount(),
    - tileMenuButton: this.getTileMenuButtonStumpCode()
    - })
    - }
    - getRowClass() {
    - return Row
    - }
    - getTileBodyStumpCode() {
    - const description = this._getDescription()
    - return "div " + (description ? jtree.Utils.linkify(description) : "")
    - }
    - _getDescription() {
    - return this.getDefinition().get("description")
    - }
    - toStumpCode() {
    - return this.qFormat(this.tileStumpTemplate, {
    - classes: this.getCssClassNames().join(" "),
    - id: this.getTreeComponentId(),
    - body: this._getBodyStumpCodeCache(),
    - footer: this.getTileFooterStumpCode()
    - })
    - }
    - getParserId() {
    - return this.getSettingsStruct().parser
    - }
    - async fetchTableInputs() {
    - return {
    - rows: []
    - }
    - }
    - async _execute() {
    - const timeLoadStarted = this._getProcessTimeInMilliseconds()
    - this._timeLastLoadStarted = timeLoadStarted
    - const fetchedTableInputs = await this.fetchTableInputs()
    - // If a new request happened after this one, abort this one.
    - // todo: what happens to children?
    - // todo: add testing for this.
    - if (this._timeLastLoadStarted !== timeLoadStarted) {
    - console.log("superceded")
    - return null
    - }
    - this._outputTable = new Table(fetchedTableInputs.rows, fetchedTableInputs.columnDefinitions, this.getRowClass())
    - this._timeToLoad = this._getProcessTimeInMilliseconds() - timeLoadStarted
    - this.setIsDataLoaded(true)
    - await this._executeChildNodes()
    - }
    - }
    -
    - class abstractUrlNoCellsNode extends abstractProviderNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { parser: parserNode, useCache: useCacheNode }),
    - undefined
    - )
    - }
    - get tileSize() {
    - return `300 150`
    - }
    - get useCache() {
    - return true
    - }
    - getUrl() {
    - const struct = Object.assign(this.getSettingsStruct(), this.getDefinition().getConstantsObject())
    - if (struct.urlTemplate && this.getContent()) return new jtree.TreeNode({ content: this.getContent() }).evalTemplateString(struct.urlTemplate)
    - if (struct.urlPrefix && this.getContent()) return struct.urlPrefix + this.getContent()
    - return struct.urlCell || this.getContent() || this.url || ""
    - }
    - getParserId() {
    - if (this.parser) return this.parser
    - const url = this.getUrl()
    - if (super.getParserId()) return super.getParserId()
    - const extension = jtree.Utils.getFileExtension(url)
    - if (new TableParser().getAllTableParserIds().includes(extension)) return extension
    - }
    - getWillowHttpResponse() {
    - return this._willowHttpResponse
    - }
    - _setWillowHttpResponse(willowHttpResponse) {
    - this._willowHttpResponse = willowHttpResponse
    - return this
    - }
    - // todo: add support for Arrow.
    - // todo: remove this cache. use higher level.
    - async _getData(url) {
    - const useCache = this.getSettingsStruct().useCache !== "false" || this.useCache
    - const willowBrowser = this.getWebApp().getWillowBrowser()
    - let response
    - if (useCache) response = await willowBrowser.httpGetUrlFromCache(url)
    - else response = await willowBrowser.httpGetUrl(url)
    - if (response.fromCache)
    - this.emitLogMessage(`div
    - bern
    - Loading from cache: ${url}`)
    - this._setWillowHttpResponse(response)
    - return response.getParsedDataOrText()
    - }
    - async fetchTableInputs() {
    - let url = this.getUrl()
    - if (!url) return { rows: [] }
    - url = encodeURI(url)
    - const parserId = this.getParserId()
    - this.setRunTimePhaseError("fetchUrl")
    - try {
    - const data = await this._getData(url)
    - const parser = new TableParser()
    - if (typeof data === "string") return parser.parseTableInputsFromString(data, parserId)
    - if (this.jsonPath) return parser.parseTableInputsFromObject(data[this.jsonPath], parserId)
    - return parser.parseTableInputsFromObject(data, parserId)
    - } catch (err) {
    - // todo: solve the superagent not throwing response message thing.
    - const txt = (err.text || err.toString()).substr(0, 280)
    - this.emitLogMessage(`Error getting url: ${url}
    - ${txt}`)
    - this.setRunTimePhaseError("fetchUrl", txt)
    - return { rows: [] }
    - }
    - }
    - }
    -
    - class abstractUrlNode extends abstractUrlNoCellsNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get urlCell() {
    - return this.getWord(1)
    - }
    - get tileSize() {
    - return `300 100`
    - }
    - }
    -
    - class abstractUrlsNode extends abstractUrlNode {
    - getUrls() {
    - return this.getWordsFrom(1).map(url => (this.urlPrefix || "") + url)
    - }
    - async fetchTableInputs() {
    - // todo: allow cache breaking.
    - const app = this.getWebApp()
    - const willowBrowser = app.getWillowBrowser()
    - let allResults = []
    - const urls = this.getUrls()
    - const fetchMethod = async url => (app.isUrlGetProxyAvailable() ? willowBrowser.httpGetUrlFromProxyCache(url) : willowBrowser.httpGetUrlFromCache(url))
    - for (let url of urls) {
    - const response = await fetchMethod(url)
    - allResults.push(response)
    - }
    - return { rows: allResults.map(res => res.asJson) }
    - }
    - }
    -
    - class githubInfoNode extends abstractUrlsNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get githubRepoCell() {
    - return this.getWordsFrom(1)
    - }
    - get urlPrefix() {
    - return `https://api.github.com/repos/`
    - }
    - get dataDomain() {
    - return `github.com`
    - }
    - }
    -
    - class diskBrowseNode extends abstractUrlNode {
    - get pathCell() {
    - return this.getWordsFrom(0)
    - }
    - get tileSize() {
    - return `500 500`
    - }
    - get hakonTemplate() {
    - return `.DiskTile
    - table
    - width 100%
    - td,th
    - overflow hidden
    - text-overflow ellipsis
    - tr
    - white-space nowrap`
    - }
    - getUrl() {
    - return this.getContent() ? "/disk?path=" + this.getContent() : "/disk"
    - }
    - getTileBodyStumpCode() {
    - const labelCol = "name"
    - const path = this.getContent() || ""
    - const parentPath = path.replace(/\/[^\/]*$/, "")
    - const rowDisplayLimit = 1000 // todo: adjustable?
    - let rows = this.getOutputTable()
    - .getRows()
    - .slice(0, rowDisplayLimit)
    - rows = lodash.sortBy(rows, row => row.getRowOriginalValue("isDirectory") === "false")
    - return `input
    - placeholder Filepath
    - value ${path}
    - changeCommand changeTileContentAndRenderCommand
    - class LargeTileInput
    - table
    - tr
    - td
    - a ..
    - clickCommand changeTileContentAndRenderCommand
    - value ${parentPath}
    - ${rows
    - .map(row => {
    - const label = jtree.Utils.stripHtml(row.getRowOriginalValue(labelCol))
    - const isDir = row.getRowOriginalValue("isDirectory") === "true"
    - const size = row.getRowOriginalValue("bytes")
    - const mtime = row.getRowOriginalValue("mtime")
    - if (!isDir)
    - return ` tr
    - td ${label}
    - td ${numeral(size).format("0.0 b")}
    - td ${moment(parseFloat(mtime)).fromNow()}`
    - return ` tr
    - td
    - a ${label}
    - clickCommand changeTileContentAndRenderCommand
    - value ${path.replace(/\/$/, "") + "/" + label}`
    - })
    - .join("\n")}`
    - }
    - }
    -
    - class diskReadNode extends abstractUrlNode {
    - get urlPrefix() {
    - return `/disk.read?path=`
    - }
    - }
    -
    - class abstractHackernewsNode extends abstractUrlNode {
    - get dataDomain() {
    - return `news.ycombinator.com`
    - }
    - }
    -
    - class hackernewsTopNode extends abstractHackernewsNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get quantityCell() {
    - return parseInt(this.getWord(1))
    - }
    - async fetchTableInputs() {
    - // todo: allow cache breaking.
    - const willowBrowser = this.getWebApp().getWillowBrowser()
    - const firstUrls = this._getFirstUrls()
    - if (!firstUrls.length || this.isNodeJs()) return []
    - let allResults = []
    - const fetchMethod = async url =>
    - this.getWebApp().isUrlGetProxyAvailable() ? willowBrowser.httpGetUrlFromProxyCache(url) : willowBrowser.httpGetUrlFromCache(url)
    - for (let mainUrl of firstUrls) {
    - const response = await fetchMethod(mainUrl)
    - const nextUrls = this._parseNextUrls(response)
    - const batchResults = await Promise.all(nextUrls.slice(0, this._getLimit()).map(url => fetchMethod(url)))
    - allResults = allResults.concat(batchResults)
    - }
    - return { rows: allResults.map(res => res.asJson) }
    - }
    - _getLimit() {
    - return parseInt(this.getContent() || 10)
    - }
    - _parseNextUrls(response) {
    - return response.asJson.map(id => `https://hacker-news.firebaseio.com/v0/item/${id}.json?print=pretty`)
    - }
    - _getFirstUrls() {
    - return ["https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"]
    - }
    - }
    -
    - class hackernewsSubmissionsNode extends hackernewsTopNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get quantityCell() {
    - return parseInt(this.getWord(1))
    - }
    - get hackerNewsUserNameCell() {
    - return this.getWordsFrom(2)
    - }
    - _getFirstUrls() {
    - return this.getWordsFrom(2).map(username => `https://hacker-news.firebaseio.com/v0/user/${username}.json?print=pretty`)
    - }
    - _getLimit() {
    - return parseInt(this.getWord(1) || 10)
    - }
    - _parseNextUrls(response) {
    - return response.asJson.submitted.map(id => `https://hacker-news.firebaseio.com/v0/item/${id}.json?print=pretty`)
    - }
    - }
    -
    - class publicApisNode extends abstractUrlNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get jsonPath() {
    - return `entries`
    - }
    - get parser() {
    - return `json`
    - }
    - get url() {
    - return `https://api.publicapis.org/entries`
    - }
    - get dataDomain() {
    - return `publicapis.org`
    - }
    - }
    -
    - class webGetNode extends abstractUrlNode {
    - get tileSize() {
    - return `400 100`
    - }
    - get bodyStumpTemplate() {
    - return `span {kind}
    - class LargeLabel
    - input
    - value {content}
    - placeholder {placeholderMessage}
    - changeCommand changeTileContentAndRenderCommand
    - class LargeTileInput`
    - }
    - get placeholderMessage() {
    - return `Enter a url.`
    - }
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, { kind: this.getFirstWord(), content: this.getContent() || "", placeholderMessage: this.placeholderMessage })
    - }
    - }
    -
    - class webPostNode extends abstractUrlNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { post: postNode }),
    - undefined
    - )
    - }
    - get tileSize() {
    - return `400 130`
    - }
    - get webPostBodyStumpTemplate() {
    - return `textarea
    - bern
    - {post}
    - placeholder This data will be sent as the value of the 'q' param
    - name post
    - changeCommand changeTileSettingMultilineCommand
    - class TileTextArea`
    - }
    - getTileBodyStumpCode() {
    - return super.getTileBodyStumpCode() + this.qFormat(this.webPostBodyStumpTemplate, { post: jtree.Utils.stripHtml(this.getSettingsStruct().post || "") })
    - }
    - async _getData(url) {
    - const settings = this.getSettingsStruct()
    - // todo, but make a separate tile
    - // if (settings.pushButton) {
    - // if (!settings.pushed) return ""
    - // settings.pushed = false
    - // }
    - const postData = settings.post || ""
    - const res = await this.getWebApp()
    - .getWillowBrowser()
    - .httpPostUrl(url, { q: postData.trim() })
    - this._setWillowHttpResponse(res)
    - return res.getParsedDataOrText()
    - }
    - }
    -
    - class wikipediaContentNode extends abstractUrlNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get wikipediaPermalinkCell() {
    - return this.getWordsFrom(1)
    - }
    - get urlPrefix() {
    - return `https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro&explaintext&redirects=1&origin=*&titles=`
    - }
    - get dataDomain() {
    - return `wikipedia.org`
    - }
    - getUrl() {
    - return this.urlPrefix + this.wikipediaPermalinkCell.join("|")
    - }
    - async fetchTableInputs() {
    - const inputs = await super.fetchTableInputs()
    - // todo: cleanup
    - return { rows: Object.values(inputs.rows[0].query.pages) }
    - }
    - }
    -
    - class abstractFixedDatasetFromUrlNode extends abstractUrlNoCellsNode {
    - _getDescription() {
    - const desc = super._getDescription()
    - if (this.dataUrl) return (desc ? desc + " from " : "") + this.dataUrl
    - return desc
    - }
    - }
    -
    - class abstractFixedDatasetFromOhayoCollectionNode extends abstractFixedDatasetFromUrlNode {
    - get tileSize() {
    - return `300 150`
    - }
    - async _getData(url) {
    - if (!this.isNodeJs()) return super._getData(url)
    - const fs = require("fs")
    - const filepath = __dirname + "/../" + url
    - return fs.readFileSync(filepath, "utf8")
    - }
    - }
    -
    - class cancerCasesNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/cancer/cases.csv`
    - }
    - }
    -
    - class abstractCdcInfantPercentileNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get dataUrl() {
    - return `https://www.cdc.gov/growthcharts/percentile_data_files.htm`
    - }
    - get isDataPublicDomain() {
    - return true
    - }
    - }
    -
    - class weightPercentilesNode extends abstractCdcInfantPercentileNode {
    - get url() {
    - return `ohayo/packages/cdc/wtageinf.csv`
    - }
    - }
    -
    - class lengthPercentilesNode extends abstractCdcInfantPercentileNode {
    - get url() {
    - return `ohayo/packages/cdc/lenageinf.csv`
    - }
    - }
    -
    - class headPercentilesNode extends abstractCdcInfantPercentileNode {
    - get url() {
    - return `ohayo/packages/cdc/hcageinf.csv`
    - }
    - }
    -
    - class kaggleDatasetsHeartNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/kaggle/heart.csv`
    - }
    - }
    -
    - class mozTop500Node extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/moz/top500Domains.csv`
    - }
    - get isDataPublicDomain() {
    - return true
    - }
    - get dataUrl() {
    - return `https://moz.com/top500`
    - }
    - }
    -
    - class lifeExpectancyNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/owid/life-expectancy.csv`
    - }
    - }
    -
    - class owidListNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/owid/owid.tree`
    - }
    - get parser() {
    - return `treeRows`
    - }
    - }
    -
    - class samplesTelescopesNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/samples/telescopes.tsv`
    - }
    - get dataUrl() {
    - return `https://github.com/treenotation/ohayo/blob/master/ohayo/packages/samples/telescopes.tsv`
    - }
    - get isDataPublicDomain() {
    - return true
    - }
    - get dataDescription() {
    - return `## Provenance
    - This list was put together by a group of remote workers in a Google spreadsheet in 2017 and hasn't been updated in a while.`
    - }
    - }
    -
    - class samplesMtcarsNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/samples/mtcars.tsv`
    - }
    - get dataUrl() {
    - return `https://stat.ethz.ch/R-manual/R-devel/library/datasets/html/mtcars.html`
    - }
    - get isDataPublicDomain() {
    - return true
    - }
    - }
    -
    - class samplesIrisNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/samples/iris.tsv`
    - }
    - get isDataPublicDomain() {
    - return true
    - }
    - get dataUrl() {
    - return `https://archive.ics.uci.edu/ml/datasets/iris`
    - }
    - }
    -
    - class samplesFlights14Node extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/samples/flights14-sample.csv`
    - }
    - get isDataPublicDomain() {
    - return true
    - }
    - get dataUrl() {
    - return `https://github.com/Rdatatable/data.table/blob/master/vignettes/flights14.csv`
    - }
    - }
    -
    - class samplesSiNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get parser() {
    - return `text`
    - }
    - get url() {
    - return `ohayo/packages/samples/si.tree`
    - }
    - get dataUrl() {
    - return `https://github.com/treenotation/ohayo/blob/master/ohayo/packages/samples/si.tree`
    - }
    - get isDataPublicDomain() {
    - return true
    - }
    - }
    -
    - class samplesPortalNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/samples/portals.ssv`
    - }
    - get dataUrl() {
    - return `https://github.com/treenotation/ohayo/blob/master/ohayo/packages/samples/portals.ssv`
    - }
    - get isDataPublicDomain() {
    - return true
    - }
    - }
    -
    - class samplesStarWarsNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/samples/starwars.json`
    - }
    - get dataLicense() {
    - return `BSD`
    - }
    - get isDataPublicDomain() {
    - return false
    - }
    - }
    -
    - class samplesPopulationsNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/samples/populations.tsv`
    - }
    - }
    -
    - class samplesBabyNamesNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/samples/baby-names-sample.csv`
    - }
    - }
    -
    - class samplesDeclarationNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/samples/declaration-of-independence.text`
    - }
    - get isDataPublicDomain() {
    - return true
    - }
    - }
    -
    - class samplesPeriodicTableNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/samples/periodic-table.csv`
    - }
    - get dataUrl() {
    - return `https://gist.github.com/GoodmanSciences/c2dd862cd38f21b0ad36b8f96b4bf1ee`
    - }
    - }
    -
    - class samplesLettersNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/samples/letters.tsv`
    - }
    - }
    -
    - class samplesPresidentsNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/samples/presidents.csv`
    - }
    - get isDataPublicDomain() {
    - return true
    - }
    - }
    -
    - class ucimlrDatasetsNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get url() {
    - return `ohayo/packages/ucimlr/datasets.tsv`
    - }
    - }
    -
    - class vegaDataNode extends abstractFixedDatasetFromOhayoCollectionNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get vegaDataSetCell() {
    - return this.getWord(1)
    - }
    - get urlPrefix() {
    - return `ohayo/packages/vega/datasets/`
    - }
    - }
    -
    - class redditAllNode extends abstractUrlNoCellsNode {
    - get offlineDataSet() {
    - return `ohayo/packages/reddit/all.json`
    - }
    - get url() {
    - return `https://www.reddit.com/r/all/top/.json?sort=top`
    - }
    - get dataDomain() {
    - return `reddit.com`
    - }
    - async fetchTableInputs() {
    - const inputs = await super.fetchTableInputs()
    - // Todo: add tests/external dependency, as reddit API changes.
    - // Here it looks like we have the equivalent of a custom parser just for a Reddit Data source.
    - // todo: explore/define/typescriptAPI this custom parser pattern more. probably will be common.
    - return inputs.rows.length ? { rows: inputs.rows[0].data.children.map(obj => obj.data) } : inputs
    - }
    - getParserId() {
    - return "json"
    - }
    - }
    -
    - class redditSubsNode extends redditAllNode {
    - get url() {
    - return `https://www.reddit.com/reddits.json`
    - }
    - }
    -
    - class redditSubNode extends redditAllNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get subredditNameCell() {
    - return this.getWord(1)
    - }
    - getUrl() {
    - const subreddit = this.getContent() || "all"
    - return `https://www.reddit.com/r/${subreddit}/top/.json?sort=top`
    - }
    - }
    -
    - class abstractDummyNode extends abstractProviderNode {
    - get tileSize() {
    - return `300 150`
    - }
    - async _execute() {
    - this.setIsDataLoaded(true)
    - await this._executeChildNodes()
    - }
    - }
    -
    - class samplesPatientsNode extends abstractDummyNode {
    - get isDataPublicDomain() {
    - return true
    - }
    - get dummyDataSetName() {
    - return `patients`
    - }
    - }
    -
    - class samplesPoemNode extends abstractDummyNode {
    - get isDataPublicDomain() {
    - return true
    - }
    - get dummyDataSetName() {
    - return `poem`
    - }
    - }
    -
    - class samplesOuterSpaceNode extends abstractDummyNode {
    - get dummyDataSetName() {
    - return `outerSpace`
    - }
    - }
    -
    - class samplesTreeProgramNode extends abstractDummyNode {
    - get isDataPublicDomain() {
    - return true
    - }
    - get dummyDataSetName() {
    - return `treeProgram`
    - }
    - }
    -
    - class samplesWaterBillNode extends abstractDummyNode {
    - get isDataPublicDomain() {
    - return true
    - }
    - get dummyDataSetName() {
    - return `waterBill`
    - }
    - }
    -
    - class samplesGapMinderNode extends abstractDummyNode {
    - get dummyDataSetName() {
    - return `gapMinder`
    - }
    - }
    -
    - class abstractTransformerNode extends abstractProviderNode {
    - get tileFooterTemplate() {
    - return `span Rows In: {inputCount} Rows Out: {outputCount} Columns Out: {columnCount}
    - {tileMenuButton}`
    - }
    - get bodyStumpTemplate() {
    - return `span {kind}
    - class LargeLabel
    - input
    - value {content}
    - placeholder {placeholderMessage}
    - changeCommand changeTileContentAndRenderCommand
    - class LargeTileInput`
    - }
    - get placeholderMessage() {
    - return ``
    - }
    - get tileSize() {
    - return `160 100`
    - }
    - getTileFooterStumpCode() {
    - const table = this.getParentOrDummyTable()
    - const inputCount = table.getRowCount()
    - const outputTable = this.getOutputOrInputTable()
    - return this.qFormat(this.tileFooterTemplate, {
    - inputCount,
    - outputCount: table.getRowCount(),
    - columnCount: outputTable.getColumnCount(),
    - tileMenuButton: this.getTileMenuButtonStumpCode()
    - })
    - }
    - async _execute() {
    - this._outputTable = this._createOutputTable()
    - this.setIsDataLoaded(true)
    - await this._executeChildNodes()
    - }
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, { kind: this.getFirstWord(), content: this.getContent() || "", placeholderMessage: this.placeholderMessage })
    - }
    - }
    -
    - class abstractColumnAdderTileNode extends abstractTransformerNode {
    - _createOutputTable() {
    - return this.getParentOrDummyTable().addColumns(this.getNewColumns())
    - }
    - }
    -
    - class dateAddColumnsNode extends abstractColumnAdderTileNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { sourceColumn: sourceColumnNode }),
    - undefined
    - )
    - }
    - get dateColumnTypeCell() {
    - return this.getWordsFrom(0)
    - }
    - get placeholderMessage() {
    - return `Enter the source column and new date columns you want, or leave blank to get 'day month year'.`
    - }
    - get columnPredictionHints() {
    - return `sourceColumn isTemporal=true`
    - }
    - getNewColumns() {
    - const inputColumnName = this.getSettingsStruct().sourceColumn // todo: this is probably broken. need to fix settings timing issues.
    - if (!inputColumnName) return []
    - const addColumns = this.getContent() ? this.getWordsFrom(1) : ["day", "week", "month"]
    - // what happened to dayName? timeOfDay?
    - return addColumns.map(outputCol => {
    - return {
    - source: inputColumnName,
    - name: outputCol,
    - type: outputCol
    - }
    - })
    - }
    - }
    -
    - class genConstantNode extends abstractColumnAdderTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - get primitiveTypeCell() {
    - return this.getWord(2)
    - }
    - get anyCell() {
    - return this.getWord(3)
    - }
    - getNewColumns() {
    - return [
    - {
    - name: this.columnNameCell,
    - type: this.primitiveTypeCell,
    - accessorFn: row => this.anyCell
    - }
    - ]
    - }
    - }
    -
    - class genGrowthNode extends abstractColumnAdderTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - get minCell() {
    - return parseFloat(this.getWord(2))
    - }
    - get growthRateCell() {
    - return parseFloat(this.getWord(3))
    - }
    - getNewColumns() {
    - let total = this.minCell
    - return [
    - {
    - name: this.columnNameCell,
    - accessorFn: (row, rowIndex) => {
    - total = total * (1 + this.growthRateCell)
    - return total
    - }
    - }
    - ]
    - }
    - }
    -
    - class mathLogNode extends abstractColumnAdderTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - getNewColumns() {
    - const inputColumnName = this.getWord(1)
    - if (!inputColumnName) return []
    - const inputCol = this.getParentOrDummyTable().getColumnByName(inputColumnName)
    - return [
    - {
    - source: inputColumnName,
    - name: inputColumnName + "Log",
    - type: inputCol.getPrimitiveTypeName(),
    - mathFn: Math.log
    - }
    - ]
    - }
    - }
    -
    - class rowsAddIndexColumnNode extends abstractColumnAdderTileNode {
    - getNewColumns() {
    - let index = 0
    - return [
    - {
    - name: "index",
    - accessorFn: row => index++
    - }
    - ]
    - }
    - }
    -
    - class rowsRunningTotalNode extends abstractColumnAdderTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - getNewColumns() {
    - const sourceColumnName = this.getWord(1)
    - let total = 0
    - return [
    - {
    - source: sourceColumnName,
    - name: "total",
    - accessorFn: row => {
    - total += row[sourceColumnName]
    - return total
    - }
    - }
    - ]
    - }
    - }
    -
    - class textLengthNode extends abstractColumnAdderTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - getNewColumns() {
    - const sourceColumnName = this.getWord(1)
    - const destinationColumnName = sourceColumnName + "Length"
    - return [
    - {
    - source: sourceColumnName,
    - name: destinationColumnName,
    - accessorFn: row => row[sourceColumnName].length
    - }
    - ]
    - }
    - }
    -
    - class textSplitNode extends abstractColumnAdderTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - get delimiterCell() {
    - return this.getWord(2)
    - }
    - get newColumnNamesCell() {
    - return this.getWordsFrom(3)
    - }
    - get dummyDataSetName() {
    - return `poem`
    - }
    - // note: delimiter can probably be ""
    - // todo: how would we split on a space???
    - // perhaps its better to use getContent() as delimiter, and if you want to name the columns, you can do that later?
    - getNewColumns() {
    - const sourceColumnName = this.getWord(1)
    - const delimiter = this.getWord(2)
    - const destinationColumns = this.getWordsFrom(3)
    - return destinationColumns.map((destinationColumnName, index) => {
    - return {
    - source: sourceColumnName,
    - name: destinationColumnName,
    - accessorFn: row => {
    - const words = row[sourceColumnName].split(delimiter)
    - return this.reverseSplit ? words.reverse()[index] : words[index]
    - }
    - }
    - })
    - return [
    - {
    - source: sourceColumnName,
    - name: destinationColumnName,
    - accessorFn: row => row[sourceColumnName].length
    - }
    - ]
    - }
    - }
    -
    - class reverseTextSplitNode extends textSplitNode {
    - get reverseSplit() {
    - return [true]
    - }
    - }
    -
    - class textToLowerCaseNode extends abstractColumnAdderTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - get dummyDataSetName() {
    - return `poem`
    - }
    - getNewColumns() {
    - const sourceColumnName = this.getWord(1) || "text"
    - return [
    - {
    - source: sourceColumnName,
    - name: sourceColumnName,
    - accessorFn: row => row[sourceColumnName].toLowerCase()
    - }
    - ]
    - }
    - }
    -
    - class textTemplateNode extends abstractColumnAdderTileNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { content: contentNode }),
    - undefined
    - )
    - }
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get newColumnNameCell() {
    - return this.getWordsFrom(1)
    - }
    - get bodyStumpTemplate() {
    - return `textarea
    - name content
    - changeCommand changeTileSettingMultilineCommand
    - placeholder Enter template here.
    - class TileTextArea savable
    - bern
    - {text}`
    - }
    - getNewColumns() {
    - const contentNode = this.getNode("content")
    - const templateString = contentNode ? contentNode.childrenToString() : ""
    - const destColumnName = this.getWord(1) || "Output"
    - return [
    - {
    - name: destColumnName,
    - accessorFn: row => new jtree.TreeNode(templateString).templateToString(row)
    - }
    - ]
    - }
    - getDataContent() {
    - const node = this.getNode("content")
    - return node ? node.childrenToString() : ""
    - }
    - getTileBodyStumpCode() {
    - const text = lodash.escape(this.getDataContent())
    - return this.qFormat(this.bodyStumpTemplate, { text })
    - }
    - }
    -
    - class textPermalinkNode extends abstractColumnAdderTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - get newColumnNameCell() {
    - return this.getWord(2)
    - }
    - getNewColumns() {
    - const sourceColumnName = this.getWord(1) || "text"
    - const destinationColumnName = this.getWord(2) || "Permalink"
    - return [
    - {
    - source: sourceColumnName,
    - name: destinationColumnName,
    - accessorFn: row => jtree.Utils.stringToPermalink(row[sourceColumnName])
    - }
    - ]
    - }
    - }
    -
    - class textReplaceNode extends abstractColumnAdderTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - get anyCell() {
    - return this.getWordsFrom(2)
    - }
    - getNewColumns() {
    - const sourceColumnName = this.getWord(1) || "text"
    - const simpleSearch = this.getWord(2)
    - const simpleReplace = this.getWord(3)
    - const destinationColumnName = sourceColumnName
    - return [
    - {
    - source: sourceColumnName,
    - name: destinationColumnName,
    - accessorFn: row => row[sourceColumnName].replace(new RegExp(simpleSearch, "g"), simpleReplace)
    - }
    - ]
    - }
    - }
    -
    - class textTrimNode extends abstractColumnAdderTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - get anyCell() {
    - return this.getWordsFrom(2)
    - }
    - getNewColumns() {
    - const sourceColumnName = this.getWord(1) || "text"
    - const trimChar = this.getWord(2)
    - const destinationColumnName = sourceColumnName
    - return [
    - {
    - source: sourceColumnName,
    - name: destinationColumnName,
    - accessorFn: row => (trimChar ? row[sourceColumnName].replace(new RegExp(`(^${trimChar}|${trimChar}$)`, "g"), "") : row[sourceColumnName].trim())
    - }
    - ]
    - }
    - }
    -
    - class textSubstringNode extends abstractColumnAdderTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - get startIndexCell() {
    - return parseInt(this.getWord(2))
    - }
    - get lengthCell() {
    - return parseInt(this.getWord(3))
    - }
    - get destinationColumnName() {
    - return `substring`
    - }
    - get dummyDataSetName() {
    - return `poem`
    - }
    - getNewColumns() {
    - const sourceColumnName = this.getWord(1)
    - const startPosition = typeof this.startIndex !== undefined ? this.startIndex : parseInt(this.getWord(2))
    - const endPosition = typeof this.endIndex !== undefined ? this.endIndex : this.getWord(3) === undefined ? undefined : parseInt(this.getWord(3))
    - return [
    - {
    - source: sourceColumnName,
    - name: this.destinationColumnName,
    - accessorFn: row => (row[sourceColumnName] ? row[sourceColumnName].toString().substr(startPosition, endPosition) : "")
    - }
    - ]
    - }
    - }
    -
    - class testFirstLetterNode extends textSubstringNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - get endIndex() {
    - return 1
    - }
    - get startIndex() {
    - return 0
    - }
    - get destinationColumnName() {
    - return `firstLetter`
    - }
    - }
    -
    - class abstractNewRowsTransformerTileNode extends abstractTransformerNode {
    - _createOutputTable() {
    - // todo: remove this
    - return new Table(this.makeNewRows())
    - }
    - }
    -
    - class columnsDescribeNode extends abstractNewRowsTransformerTileNode {
    - makeNewRows() {
    - return this.getParentOrDummyTable().getColumnNamesAndTypesAndReductions()
    - }
    - }
    -
    - class columnsListNode extends columnsDescribeNode {
    - makeNewRows() {
    - return this.getParentOrDummyTable().getColumnNamesAndTypes()
    - }
    - }
    -
    - class dataEvalNode extends abstractNewRowsTransformerTileNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { content: contentNode }),
    - undefined
    - )
    - }
    - makeNewRows() {
    - const node = this.getNode(this.contentKey)
    - const code = node && node.childrenToString() // "rows => { return []}"
    - let fn
    - try {
    - fn = code && eval(code)
    - } catch (err) {
    - // todo: warn user
    - console.error(err)
    - }
    - const inputRows = this.getParentOrDummyTable().cloneNativeJavascriptTypedRows()
    - return fn ? fn(inputRows) : inputRows
    - }
    - }
    -
    - class joinByNode extends abstractNewRowsTransformerTileNode {
    - get columnNameCell() {
    - return this.getWordsFrom(0)
    - }
    - makeNewRows() {
    - // Todo: move to table project
    - const parentTile = this.getParent()
    - if (parentTile.isRoot()) return []
    - const grandParentTile = parentTile.getParent()
    - if (grandParentTile.isRoot()) return parentTile.getOutputOrInputTable().cloneNativeJavascriptTypedRows()
    - const tiles = [parentTile, grandParentTile]
    - const arrays = tiles.map(tile => tile.getOutputOrInputTable().cloneNativeJavascriptTypedRows())
    - const joinOn = this.getContent()
    - if (!joinOn) return jtree.Utils.flatten(arrays)
    - const cols = tiles.map(tile => tile.getOutputOrInputTable().getColumnNames())
    - return jtree.Utils.joinArraysOn(joinOn, arrays, cols)
    - }
    - }
    -
    - class matchColumnsFuzzyNode extends abstractNewRowsTransformerTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get needleColumnNameCell() {
    - return this.getWord(1)
    - }
    - get haystackColumnNameCell() {
    - return this.getWord(2)
    - }
    - get tileScript() {
    - return `ohayo/packages/match/fuse.min.js`
    - }
    - makeNewRows() {
    - // Todo: move some of this logic to table project?
    - const parentTile = this.getParent()
    - if (parentTile.isRoot()) return []
    - const grandParentTile = parentTile.getParent()
    - if (grandParentTile.isRoot()) return parentTile.getOutputOrInputTable().cloneNativeJavascriptTypedRows()
    - const tiles = [parentTile, grandParentTile]
    - const arrays = tiles.map(tile => tile.getOutputOrInputTable().cloneNativeJavascriptTypedRows())
    - return this._addFuzz(arrays[0], arrays[1])
    - }
    - get fuse() {
    - return this.isNodeJs() ? require("fuse.js") : Fuse
    - }
    - _addFuzz(needles, haystacks) {
    - const needleColumnName = this.getWord(1) || "name"
    - const haystackColumnName = this.getWord(2) || "name"
    - const options = {
    - shouldSort: true,
    - includeScore: true,
    - threshold: 0.6,
    - location: 0,
    - distance: 100,
    - maxPatternLength: 32,
    - minMatchCharLength: 1,
    - keys: [haystackColumnName]
    - }
    - const fuse = new this.fuse(haystacks, options) // "list" is the item array
    - return needles.map(needle => {
    - const searchValue = needle[needleColumnName]
    - const result = fuse.search(searchValue)
    - if (!result.length)
    - return {
    - search: searchValue,
    - match: ""
    - }
    - const match = result[0]
    - return {
    - search: searchValue,
    - match: match.item[haystackColumnName],
    - confidence: parseFloat((1 - match.score).toFixed(3))
    - }
    - })
    - }
    - }
    -
    - class schemaTypeScriptNode extends abstractNewRowsTransformerTileNode {
    - makeNewRows() {
    - return [{ text: this.getParentOrDummyTable().toTypeScriptInterface() }]
    - }
    - }
    -
    - class schemaSimpleNode extends abstractNewRowsTransformerTileNode {
    - makeNewRows() {
    - const schema = this.getParentOrDummyTable().toSimpleSchema()
    - const oneLiner = schema.replace(/ /g, ":").replace(/\n/g, " ")
    - return [{ text: oneLiner + "\n\n" + schema }]
    - }
    - }
    -
    - class textWordCountNode extends abstractNewRowsTransformerTileNode {
    - get dummyDataSetName() {
    - return `poem`
    - }
    - makeNewRows() {
    - return this._getAllWords(this.getPipishInput())
    - }
    - _getAllWords(text) {
    - const rows = []
    - if (!text) return rows
    - const words = text
    - .split(/\s/g)
    - .map(word => word.replace(/[^a-z0-9\-]/gi, ""))
    - .filter(word => word)
    - const index = {}
    - words.forEach(word => {
    - if (!index[word]) index[word] = 1
    - else index[word]++
    - })
    - Object.keys(index).forEach(word => {
    - const trimmedWord = word.trim()
    - if (trimmedWord)
    - rows.push({
    - word: trimmedWord,
    - count: index[trimmedWord]
    - })
    - })
    - return rows
    - }
    - }
    -
    - class textLineCountNode extends abstractNewRowsTransformerTileNode {
    - get dummyDataSetName() {
    - return `poem`
    - }
    - makeNewRows() {
    - return [{ lines: this.getPipishInput().split(/\n/g).length }]
    - }
    - }
    -
    - class treenotationWordTypesNode extends abstractNewRowsTransformerTileNode {
    - get dummyDataSetName() {
    - return `treeProgram`
    - }
    - makeNewRows() {
    - return [{ text: new ohayoNode(this.getPipishInput()).toCellTypeTree() }]
    - }
    - }
    -
    - class abstractColumnFilterTileNode extends abstractTransformerNode {
    - _createOutputTable() {
    - return this.getParentOrDummyTable().dropAllColumnsExcept(this.getColumnNamesToKeep())
    - }
    - }
    -
    - class columnsFirstNode extends abstractColumnFilterTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get intCell() {
    - return parseInt(this.getWord(1))
    - }
    - get placeholderMessage() {
    - return `Enter the number of columns you want to keep`
    - }
    - getColumnNamesToKeep() {
    - return this.getParentOrDummyTable()
    - .getColumnsArrayOfObjects()
    - .slice(0, parseInt(this.getContent()))
    - .map(col => col.name)
    - }
    - }
    -
    - class columnsLastNode extends abstractColumnFilterTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get intCell() {
    - return parseInt(this.getWord(1))
    - }
    - get placeholderMessage() {
    - return `Enter the number of columns you want to keep`
    - }
    - getColumnNamesToKeep() {
    - const cols = this.getParentOrDummyTable().getColumnsArrayOfObjects()
    - return cols.slice(cols.length - parseInt(this.getContent())).map(col => col.name)
    - }
    - }
    -
    - class columnsDropNode extends abstractColumnFilterTileNode {
    - get columnNameCell() {
    - return this.getWordsFrom(0)
    - }
    - getColumnNamesToKeep() {
    - const colsToDrop = this.getWordsFrom(1)
    - return this.getParentOrDummyTable()
    - .getColumnsArrayOfObjects()
    - .filter(col => !colsToDrop.includes(col.name))
    - .map(col => col.name)
    - }
    - }
    -
    - class columnsDropConstantsNode extends abstractColumnFilterTileNode {
    - getColumnNamesToKeep() {
    - return this.getParentOrDummyTable()
    - .getColumnsArray()
    - .filter(col => col.getReductions().uniqueValues > 1)
    - .map(col => col.getColumnName())
    - }
    - }
    -
    - class columnsKeepNode extends abstractColumnFilterTileNode {
    - get columnNameCell() {
    - return this.getWordsFrom(0)
    - }
    - get placeholderMessage() {
    - return `Enter the column names to keep.`
    - }
    - getColumnNamesToKeep() {
    - const colsToKeep = this.getWordsFrom(1)
    - return this.getParentOrDummyTable()
    - .getColumnsArrayOfObjects()
    - .filter(col => colsToKeep.includes(col.name))
    - .map(col => col.name)
    - }
    - }
    -
    - class columnsKeepNumericsNode extends abstractColumnFilterTileNode {
    - getColumnNamesToKeep() {
    - return Object.values(this.getParentOrDummyTable().getColumnsMap())
    - .filter(col => col.isNumeric())
    - .map(col => col.getColumnName())
    - }
    - }
    -
    - class abstractTransformerNoParamsTileNode extends abstractTransformerNode {
    - getTileBodyStumpCode() {
    - return `span ${this.getFirstWord()}
    - class LargeLabel`
    - }
    - }
    -
    - class rowsShuffleNode extends abstractTransformerNoParamsTileNode {
    - _createOutputTable() {
    - return this.getParentOrDummyTable().shuffleRows()
    - }
    - }
    -
    - class rowsReverseNode extends abstractTransformerNoParamsTileNode {
    - _createOutputTable() {
    - return this.getParentOrDummyTable().reverseRows()
    - }
    - }
    -
    - class abstractRowFilterTileNode extends abstractTransformerNode {
    - get placeholderMessage() {
    - return `Enter a string to filter by.`
    - }
    - // todo: pass thru.
    - // todo: remove this?
    - _createOutputTable() {
    - const fn = this.getRowFilterFn()
    - if (!fn) return this.getParentOrDummyTable().clone()
    - return this.getParentOrDummyTable().filterRowsByFn(fn)
    - }
    - }
    -
    - class filterWhereNode extends abstractRowFilterTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - get comparisonCell() {
    - return this.getWord(2)
    - }
    - get scalarValueCell() {
    - return this.getWord(3)
    - }
    - get tileSize() {
    - return `250 100`
    - }
    - _createOutputTable() {
    - // todo: use cells here.
    - const columnName = this.getWord(1)
    - const comparison = this.getWord(2)
    - let untypedScalarValue = this.getWord(3)
    - const table = this.getParentOrDummyTable()
    - if (!columnName || !comparison || untypedScalarValue === undefined) return table.clone()
    - const column = table.getColumnByName(columnName)
    - if (!column) return table
    - return table.filterClonedRowsByScalar(columnName, comparison, untypedScalarValue)
    - }
    - }
    -
    - class filterWithNode extends abstractRowFilterTileNode {
    - get stringCell() {
    - return this.getWordsFrom(0)
    - }
    - get expectedBooleanValue() {
    - return true
    - }
    - get tileSize() {
    - return `250 100`
    - }
    - getRowFilterFn() {
    - const words = this.getWordsFrom(1)
    - // todo: problem here is, getRows has too many columns if after a transformed column.
    - if (!words.length) return undefined
    - const len = words.length
    - const expectedValue = this.expectedBooleanValue
    - return row => {
    - const str = JSON.stringify(row)
    - for (let index = 0; index < len; index++) {
    - if (str.includes(words[index]) !== expectedValue) return false
    - }
    - return true
    - }
    - }
    - }
    -
    - class filterWithoutNode extends filterWithNode {
    - get expectedBooleanValue() {
    - return false
    - }
    - }
    -
    - class filterAnyNode extends filterWithNode {
    - getRowFilterFn() {
    - const words = this.getWordsFrom(1)
    - if (!words.length) return undefined
    - const len = words.length
    - // todo: problem here is, getRows has too many columns if after a transformed column.
    - return row => {
    - const str = JSON.stringify(row)
    - for (let index = 0; index < len; index++) {
    - if (str.includes(words[index])) return true
    - }
    - return false
    - }
    - }
    - }
    -
    - class rowsFirstNode extends abstractRowFilterTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get intCell() {
    - return parseInt(this.getWord(1))
    - }
    - getRowFilterFn() {
    - const limit = parseInt(this.getContent())
    - if (isNaN(limit)) return undefined
    - return (row, rowIndex) => rowIndex < limit
    - }
    - }
    -
    - class rowsSampleNode extends abstractRowFilterTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get intCell() {
    - return parseInt(this.getWord(1))
    - }
    - getRowFilterFn() {
    - // todo: move to jtable?
    - const sampleCount = parseInt(this.getContent())
    - if (isNaN(sampleCount)) return undefined
    - const totalCount = this.getParentOrDummyTable().getRowCount()
    - if (totalCount <= sampleCount) return undefined
    - const every = Math.floor(totalCount / sampleCount)
    - let total = 0
    - return (row, rowIndex) => {
    - if (total === totalCount) return false
    - if (rowIndex % every !== 0) return false
    - total++
    - return true
    - }
    - }
    - }
    -
    - class rowsDropIfMissingNode extends abstractRowFilterTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWordsFrom(1)
    - }
    - get placeholderMessage() {
    - return `Leave blank to filter a row if it is missing any column, or specifiy column name(s).`
    - }
    - getRowFilterFn() {
    - const column = this.getContent()
    - if (column) return row => !jtree.Utils.isValueEmpty(row[column])
    - return row => !Object.values(row).some(jtree.Utils.isValueEmpty)
    - }
    - }
    -
    - class rowsLastNode extends abstractRowFilterTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get intCell() {
    - return parseInt(this.getWord(1))
    - }
    - getRowFilterFn() {
    - const limit = parseInt(this.getContent())
    - if (isNaN(limit)) return undefined
    - const start = this.getParentOrDummyTable().getRowCount() - limit
    - return (row, rowIndex) => rowIndex >= start
    - }
    - }
    -
    - class pcaNode extends abstractTransformerNode {
    - get tileScript() {
    - return `ohayo/packages/bitanath/pca.js`
    - }
    - get github() {
    - return `https://github.com/bitanath/pca`
    - }
    - get pcaLib() {
    - return this.isNodeJs() ? require(__dirname + "/packages/bitanath/pca.js") : PCA
    - }
    - get mathLib() {
    - return this.isNodeJs() ? require(__dirname + "/packages/mathjs/math.min.js") : math
    - }
    - _createOutputTable() {
    - const table = this.getParentOrDummyTable()
    - const matrix = table.toNumericMatrix()
    - const vectors = this.pcaLib.getEigenVectors(matrix)
    - const pcaRows = vectors.map(vec => vec.vector)
    - const rows = table.getRows().map((row, index) => {
    - const obj = row.rowToObjectWithOnlyNativeJavascriptTypes()
    - const vec = matrix[index]
    - obj.pc1 = this.mathLib.dot(vec, pcaRows[0])
    - obj.pc2 = this.mathLib.dot(vec, pcaRows[1])
    - obj.pc3 = this.mathLib.dot(vec, pcaRows[2])
    - return obj
    - })
    - return new Table(rows)
    - }
    - }
    -
    - class columnsRenameNode extends abstractTransformerNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - get newColumnNameCell() {
    - return this.getWord(2)
    - }
    - _createOutputTable() {
    - const renameMap = {}
    - renameMap[this.getWord(1)] = this.getWord(2)
    - return this.getParentOrDummyTable().renameColumns(renameMap)
    - }
    - }
    -
    - class columnsCleanNamesNode extends abstractTransformerNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - _createOutputTable() {
    - return this.getParentOrDummyTable().cloneWithCleanColumnNames()
    - }
    - }
    -
    - class columnsSetTypeNode extends abstractTransformerNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - get primitiveTypeCell() {
    - return this.getWord(2)
    - }
    - _createOutputTable() {
    - const colToChange = this.getWord(1)
    - const newType = this.getWord(2)
    - return this.getParentOrDummyTable().changeColumnType(colToChange, newType)
    - }
    - }
    -
    - class dataSynthNode extends abstractTransformerNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { schema: schemaNode }),
    - undefined
    - )
    - }
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get intCell() {
    - return parseInt(this.getWord(1))
    - }
    - get schemaSimpleCell() {
    - return this.getWordsFrom(2)
    - }
    - _createOutputTable() {
    - const schema = this._getSchema()
    - const table = !schema ? this.getParentOrDummyTable() : new Table([], schema)
    - return table.synthesizeTable(this.intCell || 30, Date.now())
    - }
    - _getSchema() {
    - const schema = this.getNode("schema")
    - if (schema) return schema.toJTableColumnDefinitionMap()
    - const words = this.getWordsFrom(2)
    - if (words.length)
    - return words.map(word => {
    - const parts = word.split(":")
    - return {
    - name: parts[0],
    - type: parts[1]
    - }
    - })
    - }
    - }
    -
    - class dataAboutNode extends abstractTransformerNode {
    - _getDataSetInfo() {
    - const parentTile = this.getParent()
    - const def = parentTile.getDefinition()
    - return {
    - licenseSpecified: parentTile.isDataPublicDomain,
    - tags: def.get("tags"),
    - overviewDescription: parentTile.dataDescription || def.get("description"),
    - dataUrl: parentTile.dataUrl
    - }
    - }
    - _createOutputTable() {
    - return new Table([this._getDataSetInfo()])
    - }
    - }
    -
    - class dataUsabilityScoreNode extends dataAboutNode {
    - _createOutputTable() {
    - const row = this._getDataSetInfo()
    - // todo: a very simplistic approximation of Kaggle's data usability score
    - row.score = Object.values(row).filter(item => !!item).length * 2.5
    - return new Table([row])
    - }
    - }
    -
    - class fillMissingNode extends abstractTransformerNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - get anyCell() {
    - return this.getWord(2)
    - }
    - _createOutputTable() {
    - return this.getParentOrDummyTable().fillMissing(this.getWord(1), this.getWord(2))
    - }
    - }
    -
    - class genRangeNode extends abstractTransformerNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get newColumnNameCell() {
    - return this.getWord(1)
    - }
    - get minCell() {
    - return parseFloat(this.getWord(2))
    - }
    - get maxCell() {
    - return parseFloat(this.getWord(3))
    - }
    - get stepCell() {
    - return parseFloat(this.getWord(4))
    - }
    - _createOutputTable() {
    - const rows = []
    - // todo: protect against infinite loops
    - let currentValue = this.minCell
    - if (!this.stepCell) throw new Error("Step cannot be zero.")
    - while (currentValue <= this.maxCell) {
    - const row = []
    - row[this.newColumnNameCell] = currentValue
    - rows.push(row)
    - currentValue += this.stepCell
    - }
    - return new Table(rows)
    - }
    - }
    -
    - class groupByNode extends abstractTransformerNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { reduce: reduceNode }),
    - undefined
    - )
    - }
    - get columnNameCell() {
    - return this.getWordsFrom(0)
    - }
    - get placeholderMessage() {
    - return `Enter the column to groupby.`
    - }
    - _createOutputTable() {
    - const groupByColNames = this.getWordsFrom(1)
    - if (!groupByColNames.length) return this.getParentOrDummyTable().clone()
    - const newCols = this.findNodes("reduce").map(reduceNode => {
    - return {
    - source: reduceNode.getWord(1),
    - reduction: reduceNode.getWord(2),
    - name: reduceNode.getWord(3) || reduceNode.getWordsFrom(1).join("_")
    - }
    - })
    - return this.getParentOrDummyTable().makePivotTable(groupByColNames, newCols)
    - }
    - }
    -
    - class rowsSortByNode extends abstractTransformerNode {
    - get columnNameCell() {
    - return this.getWordsFrom(0)
    - }
    - get placeholderMessage() {
    - return `Columns you want to sort by`
    - }
    - _createOutputTable() {
    - const table = this.getParentOrDummyTable().sortBy(this.getWordsFrom(1))
    - if (this.getFirstWord().includes("Reverse")) return table.reverseRows()
    - return table
    - }
    - }
    -
    - class rowsSortByReverseNode extends rowsSortByNode {}
    -
    - class rowsAddOneNode extends abstractTransformerNode {
    - get anyCell() {
    - return this.getWordsFrom(0)
    - }
    - _createOutputTable() {
    - return this.getParentOrDummyTable().addRow(this.getWordsFrom(1))
    - }
    - }
    -
    - class textMatchesNode extends abstractTransformerNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get anyCell() {
    - return this.getWordsFrom(1)
    - }
    - _createOutputTable() {
    - return new Table([{ count: this.getPipishInput().match(new RegExp(this.getContent(), "g")).length }])
    - }
    - }
    -
    - class textCombineNode extends abstractTransformerNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - _createOutputTable() {
    - // todo: cleanup
    - const text = this.getParentOrDummyTable()
    - .getRows()
    - .map(row => row.getRowOriginalValue(this.columnNameCell))
    - .join("\n")
    - return new Table([{ text }])
    - }
    - }
    -
    - class dataInlineNode extends abstractProviderNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - undefined,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    - parser: parserNode,
    - treeLanguage: treeLanguageNode,
    - content: contentNode
    - }),
    - undefined
    - )
    - }
    - get bodyStumpTemplate() {
    - return `textarea
    - name content
    - changeCommand changeTileSettingMultilineCommand
    - placeholder Enter data in any format here. It will be saved directly in your document.
    - class TileTextArea savable
    - bern
    - {text}`
    - }
    - getDataContent() {
    - const node = this.getNode("content")
    - return node ? node.childrenToString() : ""
    - }
    - getTileBodyStumpCode() {
    - const text = lodash.escape(this.getDataContent())
    - return this.qFormat(this.bodyStumpTemplate, { text })
    - }
    - getRowClass() {
    - class InlineDataTileRow extends Row {}
    - return InlineDataTileRow
    - }
    - getParserId() {
    - return super.getParserId() || new TableParser().guessTableParserId(this.getDataContent())
    - }
    - async fetchTableInputs() {
    - return new TableParser().parseTableInputsFromString(this.getDataContent(), this.getParserId())
    - }
    - }
    -
    - class dataLocalStorageNode extends dataInlineNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get localStorageKeyCell() {
    - return this.getWord(1)
    - }
    - get bodyStumpTemplate() {
    - return `textarea
    - changeCommand triggerTileMethodCommand
    - placeholder Enter data in any format here. It will be saved in your browser's localStorage.
    - name storeValueCommand
    - class TileTextArea savable
    - bern
    - {text}`
    - }
    - // Note: for now, only way to clear a key is to do it manually through UI (select all delete) or console. That might be good enough.
    - _getStoreKey() {
    - return this.getContent()
    - }
    - getDataContent() {
    - const key = this._getStoreKey()
    - return key ? this.getWebApp().getFromStore(key) || "" : ""
    - }
    - storeValueCommand(value) {
    - let key = this._getStoreKey()
    - if (key) this.getWebApp().storeValue(key, value)
    - else this.setContent(this.getWebApp().initLocalDataStorage(this.constructor.name + ".data", value))
    - }
    - getTileBodyStumpCode() {
    - const text = lodash.escape(this.getDataContent())
    - return this.qFormat(this.bodyStumpTemplate, { text })
    - }
    - }
    -
    - class debugParserTestNode extends abstractProviderNode {
    - async fetchTableInputs() {
    - const parentTile = this.getParent()
    - if (parentTile.getWillowHttpResponse) {
    - const probs = new TableParser().guessProbabilitiesForAllTableParsers(parentTile.getWillowHttpResponse().text)
    - return {
    - rows: Object.keys(probs).map(key => {
    - return {
    - parser: key,
    - probability: probs[key]
    - }
    - })
    - }
    - }
    - return [{ rows: [] }]
    - }
    - }
    -
    - class debugGrammarNode extends abstractProviderNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - async fetchTableInputs() {
    - return { rows: [{ text: new ohayoNode("").getHandGrammarProgram().toString() }] }
    - }
    - }
    -
    - class debugGrammarTreeNode extends abstractProviderNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - async fetchTableInputs() {
    - return {
    - rows: [
    - {
    - text: new ohayoNode("")
    - .getHandGrammarProgram()
    - .getNodeTypeFamilyTree()
    - .toString()
    - }
    - ]
    - }
    - }
    - }
    -
    - class editorFilesNode extends abstractProviderNode {
    - get tileSize() {
    - return `140 120`
    - }
    - getRowClass() {
    - // todo: remove?
    - class FileRow extends Row {
    - destroyRow(app) {
    - return app.deleteFileCommand(this.getRowOriginalValue("link"))
    - }
    - }
    - return FileRow
    - }
    - async fetchTableInputs() {
    - const files = await this.getWebApp()
    - .getDefaultDisk()
    - .readFiles()
    - return { rows: files.map(file => file.toFileObject()) }
    - }
    - }
    -
    - class editorCommandHistoryNode extends abstractProviderNode {
    - get methodName() {
    - return `getCommandsBuffer`
    - }
    - async fetchTableInputs() {
    - return { rows: this.getWebApp()[this.methodName]() }
    - }
    - }
    -
    - class mathGenNode extends abstractProviderNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get mathFunctionNameCell() {
    - return this.getWord(1)
    - }
    - get fromCell() {
    - return parseFloat(this.getWord(2))
    - }
    - get toCell() {
    - return parseFloat(this.getWord(3))
    - }
    - get incrementCell() {
    - return parseFloat(this.getWord(4))
    - }
    - async fetchTableInputs() {
    - const rows = []
    - const fn = Math[this.getWord(1)]
    - for (let input = parseFloat(this.fromCell); input < parseFloat(this.toCell); input += parseFloat(this.incrementCell)) {
    - rows.push({ input, output: fn(input) })
    - }
    - return {
    - rows
    - }
    - }
    - }
    -
    - class abstractRandomTileNode extends abstractProviderNode {
    - async fetchTableInputs() {
    - let howMany = this.quantityCell || 30
    - const rows = []
    - for (let index = 1; index <= howMany; index++) {
    - rows.push(this._genRow(index))
    - }
    - return { rows }
    - }
    - }
    -
    - class randomFloatNode extends abstractRandomTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get quantityCell() {
    - return parseInt(this.getWord(1))
    - }
    - get minCell() {
    - return parseFloat(this.getWord(2))
    - }
    - get maxCell() {
    - return parseFloat(this.getWord(3))
    - }
    - get max() {
    - return 1
    - }
    - get min() {
    - return 0
    - }
    - _genRow(index) {
    - return { index, number: jtree.Utils.randomUniformFloat(this.minCell, this.maxCell, Math.random()) }
    - }
    - }
    -
    - class randomIntNode extends abstractRandomTileNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get quantityCell() {
    - return parseInt(this.getWord(1))
    - }
    - get minCell() {
    - return parseFloat(this.getWord(2))
    - }
    - get maxCell() {
    - return parseFloat(this.getWord(3))
    - }
    - get max() {
    - return 100
    - }
    - get min() {
    - return 0
    - }
    - _genRow(index) {
    - return { index, number: jtree.Utils.randomUniformInt(this.minCell, this.maxCell, Math.random()) }
    - }
    - }
    -
    - class samplesTinyIrisNode extends abstractProviderNode {
    - get bodyStumpTemplate() {
    - return `pre
    - class TileSelectable
    - style overflow: scroll; max-height: 100%;
    - bern
    - {text}`
    - }
    - get data() {
    - return `petal_length,petal_width,species
    - 4.9,1.8,virginica
    - 4.2,1.3,versicolor
    - 4.9,2,virginica
    - 1.5,0.2,setosa`
    - }
    - get isDataPublicDomain() {
    - return true
    - }
    - getDataContent() {
    - return this.data
    - }
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, { text: this.getDataContent() })
    - }
    - getParserId() {
    - return super.getParserId() || new TableParser().guessTableParserId(this.getDataContent())
    - }
    - async fetchTableInputs() {
    - return new TableParser().parseTableInputsFromString(this.getDataContent(), this.getParserId())
    - }
    - }
    -
    - class assertRowCountNode extends abstractTileTreeComponentNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get intCell() {
    - return parseInt(this.getWord(1))
    - }
    - get visible() {
    - return false
    - }
    - async execute() {
    - const num = this.getWord(1)
    - if (!num) return super.execute()
    - const expected = parseInt(num)
    - const actual = this.getParentOrDummyTable().getRowCount()
    - if (actual !== expected) throw new Error(`Expected ${expected} but got ${actual}`)
    - return super.execute()
    - }
    - }
    -
    - class printNode extends abstractTileTreeComponentNode {
    - execute() {
    - console.log(this._getMessage())
    - }
    - _getMessage() {
    - return this.getPipishInput()
    - }
    - }
    -
    - class printCsvNode extends printNode {
    - _getMessage() {
    - return this.getParentOrDummyTable().toDelimited(",")
    - }
    - }
    -
    - class abstractTileSettingNode extends jtree.GrammarBackedNode {
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - }
    -
    - class abstractTileSettingTerminalNode extends abstractTileSettingNode {
    - getSettingValue() {
    - return this.getContent()
    - }
    - }
    -
    - class abstractColumnNode extends abstractTileSettingTerminalNode {
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - getRunTimeEnumOptions(cell) {
    - // todo: only works if codemirror === tab
    - try {
    - // todo: handle at static time.
    - const mirrorNode = typeof app === "undefined" ? this : app.mountedProgram.nodeAtLine(this.getLineNumber() - 1)
    - const mirrorParent = mirrorNode && mirrorNode.getParent()
    - if (cell.getCellTypeId() === "columnNameCell" && mirrorParent && mirrorParent.isLoaded()) {
    - const options = mirrorParent.getParentOrDummyTable().getColumnNames()
    - return options
    - }
    - } catch (err) {
    - console.log(err)
    - }
    - }
    - }
    -
    - class columnNode extends abstractColumnNode {}
    -
    - class sourceColumnNode extends abstractColumnNode {}
    -
    - class labelNode extends abstractColumnNode {}
    -
    - class linkNode extends abstractColumnNode {}
    -
    - class sizeColumnNode extends abstractColumnNode {}
    -
    - class colorColumnNode extends abstractColumnNode {}
    -
    - class shapeColumnNode extends abstractColumnNode {}
    -
    - class valueNode extends abstractColumnNode {}
    -
    - class countNode extends abstractColumnNode {}
    -
    - class dayColumnNode extends abstractColumnNode {}
    -
    - class xColumnNode extends abstractColumnNode {}
    -
    - class yColumnNode extends abstractColumnNode {}
    -
    - class genderColumnNode extends abstractColumnNode {}
    -
    - class headSizeNode extends abstractColumnNode {}
    -
    - class radiusNode extends abstractColumnNode {}
    -
    - class emojiColumnNode extends abstractColumnNode {}
    -
    - class parserNode extends abstractTileSettingTerminalNode {
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - get parserIdsCell() {
    - return this.getWord(1)
    - }
    - }
    -
    - class useCacheNode extends abstractTileSettingTerminalNode {
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - get booleanCell() {
    - return this.getWord(1)
    - }
    - }
    -
    - class reductionNode extends abstractTileSettingTerminalNode {
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - get reductionTypeCell() {
    - return this.getWord(1)
    - }
    - }
    -
    - class abstractCoreTileSettingTerminalNode extends abstractTileSettingTerminalNode {}
    -
    - class hiddenNode extends abstractCoreTileSettingTerminalNode {}
    -
    - class visibleNode extends abstractCoreTileSettingTerminalNode {}
    -
    - class maximizedNode extends abstractCoreTileSettingTerminalNode {}
    -
    - class abstractPagePositionNode extends abstractCoreTileSettingTerminalNode {
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - get intCell() {
    - return parseInt(this.getWord(1))
    - }
    - }
    -
    - class leftNode extends abstractPagePositionNode {}
    -
    - class topNode extends abstractPagePositionNode {}
    -
    - class widthNode extends abstractPagePositionNode {}
    -
    - class heightNode extends abstractPagePositionNode {}
    -
    - class reduceNode extends abstractTileSettingTerminalNode {
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - get columnNameCell() {
    - return this.getWord(1)
    - }
    - get reductionTypeCell() {
    - return this.getWord(2)
    - }
    - get newColumnNameCell() {
    - return this.getWord(3)
    - }
    - }
    -
    - class styleNode extends abstractTileSettingTerminalNode {}
    -
    - class columnLimitNode extends abstractTileSettingTerminalNode {
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - get intCell() {
    - return parseInt(this.getWord(1))
    - }
    - }
    -
    - class howManyNode extends abstractTileSettingTerminalNode {
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - get quantityCell() {
    - return parseInt(this.getWord(1))
    - }
    - }
    -
    - class sizeNode extends abstractTileSettingTerminalNode {
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - get numberCell() {
    - return parseFloat(this.getWord(1))
    - }
    - }
    -
    - class rowDisplayLimitNode extends abstractTileSettingTerminalNode {
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - get intCell() {
    - return parseInt(this.getWord(1))
    - }
    - }
    -
    - class srcNode extends abstractTileSettingTerminalNode {
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - get urlCell() {
    - return this.getWord(1)
    - }
    - }
    -
    - class roughnessNode extends abstractTileSettingTerminalNode {
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - get roughnessCell() {
    - return parseInt(this.getWord(1))
    - }
    - }
    -
    - class colorsNode extends abstractTileSettingTerminalNode {
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - get anyCell() {
    - return this.getWordsFrom(1)
    - }
    - }
    -
    - class cameraPositionNode extends abstractTileSettingTerminalNode {
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - get cameraDistanceNumberCell() {
    - return parseFloat(this.getWord(1))
    - }
    - get horizontalNumberCell() {
    - return parseFloat(this.getWord(2))
    - }
    - get verticalNumberCell() {
    - return parseFloat(this.getWord(3))
    - }
    - }
    -
    - class treeLanguageNode extends abstractTileSettingTerminalNode {
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - get supportedTreeLanguageCell() {
    - return this.getWord(1)
    - }
    - }
    -
    - class abstractTileSettingNonTerminalNode extends abstractTileSettingNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(tileSettingNonTerminalContentNode, undefined, undefined)
    - }
    - getSettingValue() {
    - return this.childrenToString()
    - }
    - }
    -
    - class contentNode extends abstractTileSettingNonTerminalNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(lineOfContentNode, undefined, undefined)
    - }
    - }
    -
    - class catchAllNodesPostContentNode extends abstractTileSettingNonTerminalNode {
    - get anyCell() {
    - return this.getWordsFrom(0)
    - }
    - }
    -
    - class postNode extends abstractTileSettingNonTerminalNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(catchAllNodesPostContentNode, undefined, undefined)
    - }
    - }
    -
    - class abstractDocSettingNode extends jtree.GrammarBackedNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get visible() {
    - return false
    - }
    - }
    -
    - class docCategoriesNode extends abstractDocSettingNode {
    - get documentCategoryCell() {
    - return this.getWordsFrom(0)
    - }
    - }
    -
    - class docAuthorNode extends abstractDocSettingNode {
    - get stringCell() {
    - return this.getWordsFrom(0)
    - }
    - }
    -
    - class docDateNode extends abstractDocSettingNode {
    - get dateCell() {
    - return this.getWordsFrom(0)
    - }
    - }
    -
    - class abstractDocSectionComponentNode extends jtree.GrammarBackedNode {}
    -
    - class docSectionSubtitleNode extends abstractDocSectionComponentNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get stringCell() {
    - return this.getWordsFrom(1)
    - }
    - compile() {
    - return `h2 ${this.getContent()}`
    - }
    - }
    -
    - class docSectionParagraphNode extends abstractDocSectionComponentNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(docParagraphLineNode, undefined, undefined)
    - }
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get stringCell() {
    - return this.getWordsFrom(1)
    - }
    - get stumpTemplate() {
    - return `p
    - bern
    - {content}`
    - }
    - compile() {
    - return new jtree.TreeNode(this.stumpTemplate).templateToString({ content: this.getContentWithChildren() })
    - }
    - }
    -
    - class docSectionLinkNode extends abstractDocSectionComponentNode {
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get urlCell() {
    - return this.getWord(1)
    - }
    - get stringCell() {
    - return this.getWordsFrom(2)
    - }
    - get stumpTemplate() {
    - return `a {content}
    - href {url}`
    - }
    - compile() {
    - return new jtree.TreeNode(this.stumpTemplate).templateToString({ content: this.getWordsFrom(2).join(" "), url: this.getWord(1) })
    - }
    - }
    -
    - class docSectionCodeNode extends abstractDocSectionComponentNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(docLineOfCodeNode, undefined, undefined)
    - }
    - get tileKeywordCell() {
    - return this.getWord(0)
    - }
    - get programmingLanguageNameCell() {
    - return this.getWord(1)
    - }
    - get stumpTemplate() {
    - return `code
    - bern
    - {content}`
    - }
    - compile() {
    - return new jtree.TreeNode(this.stumpTemplate).templateToString({ content: this.childrenToString().replace(/
    - }
    - }
    -
    - class docLineOfCodeNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(docLineOfCodeNode, undefined, undefined)
    - }
    - get codeCell() {
    - return this.getWordsFrom(0)
    - }
    - }
    -
    - class docParagraphLineNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(docParagraphLineNode, undefined, undefined)
    - }
    - get stringCell() {
    - return this.getWordsFrom(0)
    - }
    - }
    -
    - class commentLineNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(commentLineNode, undefined, undefined)
    - }
    - get commentCell() {
    - return this.getWordsFrom(0)
    - }
    - }
    -
    - class docReferenceUrlNode extends jtree.GrammarBackedNode {
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - get urlCell() {
    - return this.getWord(1)
    - }
    - }
    -
    - class catchAllErrorNode extends jtree.GrammarBackedNode {
    - getErrors() {
    - return this._getErrorNodeErrors()
    - }
    - get errorCell() {
    - return this.getWordsFrom(0)
    - }
    - }
    -
    - class hashBangNode extends jtree.GrammarBackedNode {
    - get hashBangWordCell() {
    - return this.getWordsFrom(0)
    - }
    - }
    -
    - class ohayoNode extends AbstractTreeComponent {
    - createParser() {
    - return new jtree.TreeNode.Parser(
    - DidYouMeanTileNode,
    - Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    - "amazon.history": amazonHistoryNode,
    - "fitbit.all": fitbitAllNode,
    - "datawrapper.comingSoon": datawrapperComingSoonNode,
    - "dcjs.comingSoon": dcjsComingSoonNode,
    - "finos.perspective.comingSoon": finosPerspectiveComingSoonNode,
    - "fivethirtyeight.comingSoon": fivethirtyeightComingSoonNode,
    - "gov.comingSoon": GovNode,
    - "highcharts.comingSoon": highchartsComingSoonNode,
    - "re3data.comingSoon": re3dataComingSoonNode,
    - "zing.comingSoon": zingComingSoonNode,
    - "editor.helloWorld": editorHelloWorldNode,
    - "challenge.list": challengeListNode,
    - "samples.list": samplesListNode,
    - "vega.data.list": vegaDataListNode,
    - "vega.example.list": vegaExampleListNode,
    - "doc.picker": PickerTileNode,
    - "templates.list": templatesListNode,
    - "asciichart.line": asciiChartNode,
    - "calendar.heat": calendarHeatNode,
    - "challenge.play": challengePlayNode,
    - "debug.dump": debugDumpNode,
    - "web.dump": webDumpNode,
    - "debug.commands": debugCommandsNode,
    - "debug.sleep": debugSleepNode,
    - "debug.noop": debugNoOpNode,
    - "debug.throw": debugThrowNode,
    - "dtjs.basic": dtjsBasicNode,
    - "editor.gallery": editorGalleryNode,
    - "handsontable.basic": handsontableBasicNode,
    - "html.text": htmlTextNode,
    - "html.printAs": htmlPrintAsNode,
    - "html.h1": htmlH1Node,
    - "html.img": htmlImgNode,
    - "html.iframe": htmlIframeNode,
    - "html.custom": htmlCustomNode,
    - "icons.human": iconsHumanNode,
    - "icons.circle": iconsCircleNode,
    - "list.basic": listBasicNode,
    - "list.links": listLinksNode,
    - "markdown.toHtml": markdownToHtmlNode,
    - "roughjs.bar": roughJsBarNode,
    - "roughjs.pie": roughJsPieNode,
    - "roughjs.line": roughJsLineNode,
    - "show.rowCount": showRowCountNode,
    - "show.columnCount": showColumnCountNode,
    - "show.static": showStaticNode,
    - "show.value": showValueNode,
    - "show.median": showMedianNode,
    - "show.sum": showSumNode,
    - "show.mean": showMeanNode,
    - "show.min": showMinNode,
    - "show.max": showMaxNode,
    - "tables.basic": tablesBasicNode,
    - "tables.interesting": tablesInterestingNode,
    - "tables.dump": tablesDumpNode,
    - "text.wordcloud": textWordcloudNode,
    - "treenotation.3d": treenotation3dNode,
    - "treenotation.outline": treenotationOutlineNode,
    - "treenotation.dotline": treenotationDotlineNode,
    - "vega.bar": vegaBarNode,
    - "vega.line": vegaLineNode,
    - "vega.area": vegaAreaNode,
    - "vega.scatter": vegaScatterNode,
    - "vega.bubble": vegaBubbleNode,
    - "vega.emoji": vegaEmojiNode,
    - "vega.histogram": vegaHistogramNode,
    - "vega.example": vegaExampleNode,
    - "tiles.didyoumean": DidYouMeanTileNode,
    - "doc.title": docTitleNode,
    - "doc.subtitle": docSubtitleNode,
    - "doc.section": docSectionNode,
    - "doc.ref": docReferenceNode,
    - "doc.comment": docCommentNode,
    - "doc.tooling": docToolingNode,
    - "github.info": githubInfoNode,
    - "disk.browse": diskBrowseNode,
    - "disk.read": diskReadNode,
    - "hackernews.top": hackernewsTopNode,
    - "hackernews.submissions": hackernewsSubmissionsNode,
    - "publicapis.entries": publicApisNode,
    - "web.get": webGetNode,
    - "web.post": webPostNode,
    - "wikipedia.page": wikipediaContentNode,
    - "cancer.cases": cancerCasesNode,
    - "cdc.infants.weight": weightPercentilesNode,
    - "cdc.infants.length": lengthPercentilesNode,
    - "cdc.infants.headCircumference": headPercentilesNode,
    - "kaggle.datasets.heart": kaggleDatasetsHeartNode,
    - "moz.top500": mozTop500Node,
    - "owid.lifeExpectancy": lifeExpectancyNode,
    - "owid.list": owidListNode,
    - "samples.telescopes": samplesTelescopesNode,
    - "samples.mtcars": samplesMtcarsNode,
    - "samples.iris": samplesIrisNode,
    - "samples.flights14": samplesFlights14Node,
    - "samples.si": samplesSiNode,
    - "samples.portals": samplesPortalNode,
    - "samples.starWars": samplesStarWarsNode,
    - "samples.populations": samplesPopulationsNode,
    - "samples.babyNames": samplesBabyNamesNode,
    - "samples.declaration": samplesDeclarationNode,
    - "samples.periodicTable": samplesPeriodicTableNode,
    - "samples.letters": samplesLettersNode,
    - "samples.presidents": samplesPresidentsNode,
    - "ucimlr.datasets": ucimlrDatasetsNode,
    - "vega.data": vegaDataNode,
    - "reddit.all": redditAllNode,
    - "reddit.subs": redditSubsNode,
    - "reddit.sub": redditSubNode,
    - "samples.patients": samplesPatientsNode,
    - "samples.poem": samplesPoemNode,
    - "samples.outerSpace": samplesOuterSpaceNode,
    - "samples.treeProgram": samplesTreeProgramNode,
    - "samples.waterBill": samplesWaterBillNode,
    - "samples.gapMinder": samplesGapMinderNode,
    - "date.addColumns": dateAddColumnsNode,
    - "gen.constant": genConstantNode,
    - "gen.growth": genGrowthNode,
    - "math.log": mathLogNode,
    - "rows.addIndexColumn": rowsAddIndexColumnNode,
    - "rows.runningTotal": rowsRunningTotalNode,
    - "text.length": textLengthNode,
    - "text.split": textSplitNode,
    - "text.reverseSplit": reverseTextSplitNode,
    - "text.toLowerCase": textToLowerCaseNode,
    - "text.template": textTemplateNode,
    - "text.permalink": textPermalinkNode,
    - "text.replace": textReplaceNode,
    - "text.trim": textTrimNode,
    - "text.substring": textSubstringNode,
    - "text.firstLetter": testFirstLetterNode,
    - "columns.describe": columnsDescribeNode,
    - "columns.list": columnsListNode,
    - "data.eval": dataEvalNode,
    - "join.by": joinByNode,
    - "match.columnsFuzzy": matchColumnsFuzzyNode,
    - "schema.toTypescript": schemaTypeScriptNode,
    - "schema.toSimple": schemaSimpleNode,
    - "text.wordCount": textWordCountNode,
    - "text.lineCount": textLineCountNode,
    - "treenotation.wordTypes": treenotationWordTypesNode,
    - "columns.first": columnsFirstNode,
    - "columns.last": columnsLastNode,
    - "columns.drop": columnsDropNode,
    - "columns.dropConstants": columnsDropConstantsNode,
    - "columns.keep": columnsKeepNode,
    - "columns.keepNumerics": columnsKeepNumericsNode,
    - "rows.shuffle": rowsShuffleNode,
    - "rows.reverse": rowsReverseNode,
    - "filter.where": filterWhereNode,
    - "filter.with": filterWithNode,
    - "filter.without": filterWithoutNode,
    - "filter.withAny": filterAnyNode,
    - "rows.first": rowsFirstNode,
    - "rows.sample": rowsSampleNode,
    - "rows.dropIfMissing": rowsDropIfMissingNode,
    - "rows.last": rowsLastNode,
    - "bitanath.pca": pcaNode,
    - "columns.rename": columnsRenameNode,
    - "columns.cleanNames": columnsCleanNamesNode,
    - "columns.setType": columnsSetTypeNode,
    - "data.synth": dataSynthNode,
    - "data.about": dataAboutNode,
    - "data.usabilityScore": dataUsabilityScoreNode,
    - "fill.missing": fillMissingNode,
    - "gen.range": genRangeNode,
    - "group.by": groupByNode,
    - "rows.sortBy": rowsSortByNode,
    - "rows.sortByReverse": rowsSortByReverseNode,
    - "rows.addOne": rowsAddOneNode,
    - "text.matches": textMatchesNode,
    - "text.combine": textCombineNode,
    - "data.inline": dataInlineNode,
    - "data.localStorage": dataLocalStorageNode,
    - "debug.parserTest": debugParserTestNode,
    - "debug.ohayoGrammar": debugGrammarNode,
    - "debug.ohayoGrammarTree": debugGrammarTreeNode,
    - "editor.files": editorFilesNode,
    - "editor.commandHistory": editorCommandHistoryNode,
    - "math.gen": mathGenNode,
    - "random.float": randomFloatNode,
    - "random.int": randomIntNode,
    - "samples.tinyIris": samplesTinyIrisNode,
    - "assert.rowCount": assertRowCountNode,
    - "print.text": printNode,
    - "print.csv": printCsvNode,
    - "doc.categories": docCategoriesNode,
    - "doc.author": docAuthorNode,
    - "doc.date": docDateNode,
    - "#!": hashBangNode
    - }),
    - [{ regex: /^$/, nodeConstructor: tileBlankLineNode }]
    - )
    - }
    - getTileClosestToLine(lineIndex) {
    - let current = this.nodeAtLine(lineIndex)
    - while (current) {
    - if (current.doesExtend("abstractTileTreeComponentNode")) return current
    - current = current.getParent()
    - }
    - }
    - setTab(tab) {
    - this._tab = tab
    - }
    - getTheme() {
    - const tab = this.getTab()
    - return tab ? tab.getTheme() : super.getTheme()
    - }
    - getTab() {
    - return this._tab
    - }
    - async loadAndIncrementalRender() {
    - const app = this.getTab().getRootNode()
    - await Promise.all(this.getTiles().map(tile => tile.loadBrowserRequirements()))
    - await Promise.all(
    - this.getRootLevelTiles().map(async tile => {
    - await tile.execute()
    - app.renderApp()
    - })
    - )
    - app.renderApp() // this one might be superfluous
    - return this
    - }
    - getTiles() {
    - return this.getTopDownArray().filter(node => node.doesExtend("abstractTileTreeComponentNode"))
    - }
    - getRootLevelTiles() {
    - return this.filter(node => node.doesExtend("abstractTileTreeComponentNode"))
    - }
    - _getProjectRootDir() {
    - return this.isNodeJs() ? jtree.Utils.findProjectRoot(__dirname, "ohayo") : ""
    - }
    - toRunTimeStats() {
    - const tiles = this.getTiles()
    - const stats = {
    - tiles: tiles.length,
    - treeLanguage: this.getHandGrammarProgram().getExtensionName(),
    - url: this.getTab().getFileName()
    - }
    - stats.timeToLoad = this.getTiles()
    - .map(tile => tile.getTimeToLoad())
    - .sort()
    - .reverse()[0]
    - stats.timeToRender = this.getTiles()
    - .map(tile => tile.getNewestTimeToRender())
    - .sort()
    - .reverse()[0]
    - return stats
    - }
    - async execute() {
    - await Promise.all(this.map(node => node.execute()))
    - // Use shell tiles to do any outputs
    - }
    - _getProgramRowCount() {
    - return this.getAllRowsFromAllOutputTables().reduce((acc, curr) => acc + curr.length, 0)
    - }
    - getOutputOrInputTable() {
    - // todo: remove this?
    - if (!this._outputTable) this._outputTable = new Table()
    - return this._outputTable
    - }
    - getRowsFromLastTable() {
    - const tiles = this.getTopDownArray()
    - return tiles[tiles.length - 1].getOutputOrInputTable().getRows()
    - }
    - getAllRowsFromAllOutputTables() {
    - return jtree.Utils.flatten(
    - this.getTiles()
    - .map(tile => tile.getOutputTable())
    - .filter(table => table)
    - .map(table => table.getRows())
    - )
    - }
    - getHandGrammarProgram() {
    - if (!this._cachedHandGrammarProgramRoot)
    - this._cachedHandGrammarProgramRoot = new jtree.HandGrammarProgram(`emptyCell
    - quantityCell
    - extends intCell
    - minCell
    - extends numberCell
    - maxCell
    - extends numberCell
    - stepCell
    - extends numberCell
    - millisecondsCell
    - extends intCell
    - titleCell
    - extends stringCell
    - anyCell
    - todo remove
    - columnNameCell
    - highlightScope entity.other.attribute-name
    - newColumnNameCell
    - highlightScope entity.other.attribute-name
    - newColumnNamesCell
    - description When you are creating new columns.
    - highlightScope entity.other.attribute-name
    - primitiveTypeCell
    - highlightScope constant.numeric
    - description In Ohayo, all columns have a primitive type chosen from one of these. The type affects how the values in the column are understood and displayed. For example, a 0 could be interpretted as a "false", the number 0, or a string "0". Ohayo attempts to choose the correct type, but you can override the default with the columns.setType tile.
    - enum boolean code date day dir feet hour hourMinute html int millisecond minute month monthDay number numberString object path second string text url usd week year
    - programmingLanguageNameCell
    - enum javascript latex css html ruby rust python csv tsv xml php typescript lisp swift java c cpp markdown bash
    - highlightScope constant
    - codeCell
    - highlightScope string
    - documentCategoryCell
    - highlightScope constant
    - enum shopping biology chemistry programming socialMedia math parenting writing dataScience ohayo geography web history wikipedia
    - referenceIdCell
    - highlightScope string
    - commentCell
    - highlightScope comment
    - commentKeywordCell
    - highlightScope comment
    - errorCell
    - highlightScope invalid
    - hashBangWordCell
    - highlightScope comment
    - parserIdsCell
    - description Ohayo has these parsers which convert your raw data to tables.
    - enum csv tsv json treeRows tree ssv xml psv text spaced sections json list txt jsonMap jsonVector jsonCounts jsonDataTableWithHeader
    - highlightScope constant
    - booleanCell
    - enum false true
    - highlightScope constant.numeric
    - pathCell
    - highlightScope constant
    - description A filepath
    - alphanumericCell
    - regex [a-zA-Z0-9]+
    - extraWordCell
    - todo Remove this? It looks like its a standard cell type.
    - highlightScope invalid
    - stringCell
    - highlightScope string
    - urlCell
    - highlightScope constant
    - dateCell
    - highlightScope string
    - intCell
    - regex \\-?[0-9]+
    - numberCell
    - regex \\-?[0-9]*\\.?[0-9]*
    - reductionTypeCell
    - enum count sum mean min max median
    - highlightScope constant
    - tileKeywordCell
    - highlightScope keyword
    - intCell
    - tileSettingKeywordCell
    - highlightScope variable.language
    - challengeIdCell
    - extends intCell
    - challengeAnswerCell
    - extends numberCell
    - localStorageKeyCell
    - schemaSimpleCell
    - highlightScope string
    - examples name:string score:int
    - dateColumnTypeCell
    - enum day month year monthDay
    - highlightScope constant
    - dummyDataSetIdCell
    - enum ohayoPrograms waterBill gapMinder markdown webPages outerSpace wordCounts treeProgram poem playerGoals patients regionalMarkets stockPrice
    - tileEventNameCell
    - enum fetchTableInputs getTileBodyStumpCode treeComponentDidMount treeComponentDidUpdate
    - scalarValueCell
    - highlightScope constant.numeric
    - comparisonCell
    - enum < > <= >= = !=
    - highlightScope constant
    - growthRateCell
    - extends numberCell
    - githubRepoCell
    - extends anyCell
    - hackerNewsUserNameCell
    - highlightScope string
    - htmlTextTagCell
    - enum div pre p h1 h2 h3 h4 h5 h6 code
    - htmlCell
    - highlightScope string
    - needleColumnNameCell
    - extends columnNameCell
    - haystackColumnNameCell
    - extends columnNameCell
    - mathFunctionNameCell
    - enum sin cos tan log exp
    - fromCell
    - extends numberCell
    - toCell
    - extends numberCell
    - incrementCell
    - extends numberCell
    - subredditNameCell
    - roughnessCell
    - extends intCell
    - todo add min of 0 and max of 20
    - delimiterCell
    - startIndexCell
    - extends intCell
    - lengthCell
    - extends intCell
    - supportedTreeLanguageCell
    - enum ohayo
    - cameraDistanceNumberCell
    - extends numberCell
    - horizontalNumberCell
    - extends numberCell
    - verticalNumberCell
    - extends numberCell
    - vegaDataSetCell
    - highlightScope constant.numeric
    - enum 7zip.png airports.csv anscombe.json barley.json birdstrikes.json budget.json budgets.json burtin.json cars.json climate.json co2-concentration.csv countries.json crimea.json descriptions.json disasters.csv driving.json earthquakes.json ffox.png flare-dependencies.json flare.json flights-10k.json flights-200k.json flights-20k.json flights-2k.json flights-3m.csv flights-5k.json flights-airport.csv gapminder-health-income.csv gapminder.json gimp.png github.csv graticule.json income.json iowa-electricity.csv iris.json jobs.json la-riots.csv londonBoroughs.json londonCentroids.json londonTubeLines.json lookup_groups.csv lookup_people.csv miserables.json monarchs.json movies.json normal-2d.json obesity.json points.json population.json population_engineers_hurricanes.csv seattle-temps.csv seattle-weather.csv sf-temps.csv sp500.csv stocks.csv udistrict.json unemployment-across-industries.json unemployment.tsv us-10m.json us-employment.csv us-state-capitals.json weather.csv weather.json weball26.json wheat.json windvectors.csv world-110m.json zipcodes.csv
    - vegaExampleNameCell
    - highlightScope constant.numeric
    - enum airport_connections area area_cumulative_freq area_horizon area_overlay area_temperature_range area_vertical bar bar_1d bar_1d_rangestep_config bar_aggregate bar_aggregate_count bar_aggregate_format bar_aggregate_size bar_aggregate_sort_by_encoding bar_aggregate_sort_mean bar_aggregate_transform bar_aggregate_vertical bar_argmax bar_argmax_transform bar_array_aggregate bar_binned_data bar_color_disabled_scale bar_column_fold bar_custom_sort_full bar_custom_sort_partial bar_distinct bar_diverging_stack_transform bar_filter_calc bar_fit bar_gantt bar_grouped bar_grouped_horizontal bar_layered_transparent bar_layered_weather bar_month bar_month_temporal bar_size_default bar_size_explicit bar_size_explicit_bad bar_size_fit bar_size_rangestep_small bar_sort_by_count bar_swap_axes bar_swap_custom bar_title bar_title_start bar_tooltip bar_tooltip_multi bar_yearmonth bar_yearmonth_custom_format boxplot_1D_horizontal boxplot_1D_horizontal_custom_mark boxplot_1D_horizontal_explicit boxplot_1D_vertical boxplot_2D_horizontal boxplot_2D_horizontal_color_size boxplot_2D_vertical boxplot_minmax_2D_horizontal boxplot_minmax_2D_horizontal_custom_midtick_color boxplot_minmax_2D_vertical boxplot_tooltip_aggregate boxplot_tooltip_not_aggregate brush_table circle circle_binned circle_binned_maxbins_2 circle_binned_maxbins_20 circle_binned_maxbins_5 circle_bubble_health_income circle_flatten circle_github_punchcard circle_natural_disasters circle_opacity circle_scale_quantile circle_scale_quantize circle_scale_threshold concat_bar_layer_circle concat_bar_scales_discretize concat_bar_scales_discretize_2_cols concat_hover concat_hover_filter concat_layer_voyager_result_future concat_marginal_histograms concat_population_pyramid concat_weather connected_scatterplot embedded_csv errorband_2d_horizontal_color_encoding errorband_2d_vertical_borders errorbar_2d_vertical_ticks errorbar_aggregate errorbar_horizontal_aggregate facet_bullet facet_column_facet_column_point_future facet_column_facet_row_point_future facet_cross_independent_scale facet_custom facet_custom_header facet_independent_scale facet_independent_scale_layer_broken facet_row_facet_row_point_future geo_choropleth geo_circle geo_constant_value geo_custom_projection geo_graticule geo_graticule_object geo_layer geo_layer_line_london geo_layer_multi geo_line geo_point geo_repeat geo_rule geo_sphere geo_text geo_trellis hconcat_weather histogram histogram_bin_change histogram_bin_transform histogram_log histogram_no_spacing histogram_ordinal histogram_ordinal_sort interactive_area_brush interactive_bar_select_highlight interactive_brush interactive_concat_layer interactive_dashboard_europe_pop interactive_layered_crossfilter interactive_layered_crossfilter_discrete interactive_multi_line_label interactive_multi_line_tooltip interactive_overview_detail interactive_paintbrush interactive_paintbrush_color interactive_paintbrush_color_nearest interactive_paintbrush_interval interactive_paintbrush_simple_all interactive_paintbrush_simple_none interactive_panzoom_splom interactive_panzoom_vconcat_shared interactive_query_widgets interactive_seattle_weather interactive_splom interactive_stocks_nearest_index isotype_bar_chart isotype_bar_chart_emoji isotype_grid joinaggregate_mean_difference joinaggregate_mean_difference_by_year joinaggregate_percent_of_total joinaggregate_residual_graph layer_bar_annotations layer_bar_labels layer_bar_labels_style layer_bar_line layer_bar_line_union layer_bar_month layer_boxplot_circle layer_candlestick layer_circle_independent_color layer_color_legend_left layer_cumulative_histogram layer_dual_axis layer_falkensee layer_histogram layer_histogram_global_mean layer_line_co2_concentration layer_line_color_rule layer_line_errorband_2d_horizontal_borders_strokedash layer_line_errorband_ci layer_line_errorband_pre_aggregated layer_line_mean_point_raw layer_overlay layer_point_errorbar_1d_horizontal layer_point_errorbar_1d_vertical layer_point_errorbar_2d_horizontal layer_point_errorbar_2d_horizontal_ci layer_point_errorbar_2d_horizontal_color_encoding layer_point_errorbar_2d_horizontal_custom_ticks layer_point_errorbar_2d_horizontal_iqr layer_point_errorbar_2d_horizontal_stdev layer_point_errorbar_2d_vertical layer_point_errorbar_ci layer_point_errorbar_pre_aggregated_asymmetric_error layer_point_errorbar_pre_aggregated_symmetric_error layer_point_errorbar_pre_aggregated_upper_lower layer_point_errorbar_stdev layer_precipitation_mean layer_ranged_dot layer_rect_extent layer_scatter_errorband_1D_stdev_global_mean layer_scatter_errorband_1d_stdev layer_single_color layer_text_heatmap line line_calculate line_color line_color_binned line_detail line_encoding_impute_keyvals line_encoding_impute_keyvals_sequence line_impute_frame line_impute_keyvals line_impute_method line_impute_transform_frame line_impute_transform_value line_impute_value line_inside_domain_using_clip line_inside_domain_using_transform line_max_year line_mean_month line_mean_year line_monotone line_month line_outside_domain line_overlay line_overlay_stroked line_quarter_legend line_shape_overlay line_skip_invalid line_skip_invalid_mid line_skip_invalid_mid_cap_square line_skip_invalid_mid_overlay line_slope line_step line_timeunit_transform lookup parallel_coordinate point_1d point_1d_array point_2d point_2d_aggregate point_2d_array point_2d_array_named point_2d_tooltip_data point_aggregate_detail point_background point_binned_color point_binned_opacity point_binned_size point_bubble point_color point_color_custom point_color_ordinal point_color_quantitative point_color_shape_constant point_color_with_shape point_colorramp_size point_diverging_color point_dot_timeunit_color point_filled point_href point_invalid_color point_log point_no_axis_domain_grid point_ordinal_color point_overlap point_shape_custom point_tooltip rect_binned_heatmap rect_heatmap rect_heatmap_weather rect_lasagna_future rect_mosaic_labelled rect_mosaic_labelled_with_offset rect_mosaic_simple repeat_histogram repeat_histogram_flights repeat_independent_colors repeat_layer repeat_line_weather repeat_splom_cars repeat_splom_iris rule_color_mean rule_extent sample_scatterplot selection_bind_cylyr selection_bind_origin selection_brush_timeunit selection_clear_brush selection_composition_and selection_composition_or selection_concat selection_filter selection_filter_composition selection_heatmap selection_insert selection_interval_mark_style selection_layer_bar_month selection_multi_condition selection_project_binned_interval selection_project_interval selection_project_interval_x selection_project_interval_x_y selection_project_interval_y selection_project_multi selection_project_multi_cylinders selection_project_multi_cylinders_origin selection_project_multi_origin selection_project_single selection_project_single_cylinders selection_project_single_cylinders_origin selection_project_single_origin selection_resolution_global selection_resolution_intersect selection_resolution_union selection_toggle_altKey selection_toggle_altKey_shiftKey selection_toggle_shiftKey selection_translate_brush_drag selection_translate_brush_shift-drag selection_translate_scatterplot_drag selection_translate_scatterplot_shift-drag selection_type_interval selection_type_interval_invert selection_type_multi selection_type_single selection_type_single_dblclick selection_type_single_mouseover selection_zoom_brush_shift-wheel selection_zoom_brush_wheel selection_zoom_scatterplot_shift-wheel selection_zoom_scatterplot_wheel sequence_line square stacked_area stacked_area_normalize stacked_area_ordinal stacked_area_overlay stacked_area_stream stacked_bar_1d stacked_bar_count stacked_bar_h stacked_bar_h_order stacked_bar_h_order_custom stacked_bar_normalize stacked_bar_population stacked_bar_population_transform stacked_bar_size stacked_bar_sum_opacity stacked_bar_unaggregate stacked_bar_v stacked_bar_weather test_aggregate_nested test_field_with_spaces test_single_point_color test_subobject test_subobject_missing test_subobject_nested text_format text_scatterplot_colored tick_dot tick_dot_thickness tick_sort tick_strip time_output_utc_scale time_output_utc_timeunit time_parse_local time_parse_utc time_parse_utc_format trail_color trellis_anscombe trellis_area trellis_area_sort_array trellis_bar trellis_bar_histogram trellis_bar_histogram_label_rotated trellis_barley trellis_barley_independent trellis_barley_layer_median trellis_column_year trellis_cross_sort trellis_cross_sort_array trellis_line_quarter trellis_row_column trellis_scatter trellis_scatter_binned_row trellis_scatter_small trellis_selections trellis_stacked_bar vconcat_flatten vconcat_weather waterfall_chart wheat_wages window_cumulative_running_average window_percent_of_total window_rank window_top_k window_top_k_others
    - wikipediaPermalinkCell
    - extends anyCell
    - tileBlankLineNode
    - boolean visible false
    - pattern ^$
    - tags doNotSynthesize
    - cells emptyCell
    - abstractTileTreeComponentNode
    - abstract
    - cells tileKeywordCell
    - _extendsJsClass AbstractTreeComponent
    - inScope tileBlankLineNode abstractTileTreeComponentNode abstractCoreTileSettingTerminalNode
    - string settingKey setting
    - string rowDisplayLimitKey rowDisplayLimit
    - string contentKey content
    - string xColumnKey xColumn
    - string yColumnKey yColumn
    - string colorColumnKey colorColumn
    - string shapeColumnKey shapeColumn
    - string sizeColumnKey sizeColumn
    - string columnPredictionHintsKey columnPredictionHints
    - string ohayoFileExtensionKey .ohayo
    - string dayKey day
    - boolean needsData true
    - string monthKey month
    - string yearKey year
    - catchAllNodeType catchAllErrorNode
    - string hiddenKey hidden
    - string visibleKey visible
    - string tileLoadingTemplate
    - div
    - class abstractTileTreeComponentNode
    - id {id}
    - div Loading {name}...
    - class TileBody
    - div
    - class TileFooter
    - {footer}
    - string errorLogMessageStumpTemplate
    - div Error occurred. See console.
    - class OhayoError
    - string pencilStumpTemplate
    - span ➕
    - class TileInsertBetweenButton
    - clickCommand insertTileBetweenCommand
    - span ▼
    - class TileDropDownButton
    - clickCommand toggleTileMenuCommand
    - string errorStateStumpTemplate
    - div
    - class {classes}
    - id {id}
    - div
    - class TileBody
    - div ERROR
    - {content}
    - div
    - class TileFooter
    - {footer}
    - string tileStumpTemplate
    - div
    - class {classes}
    - id {id}
    - div
    - style {bodyStyle}
    - class TileBody
    - {body}
    - div
    - class TileFooter
    - {footer}
    - string inspectionStumpTemplate
    - div TileConstructor: {constructorName} ParentConstructor: {parentConstructorName}
    - div Messages:
    - ol
    - {messages}
    - div Tree:
    - pre
    - bern
    - {sourceCode}
    - div All Tile Settings:
    - pre
    - bern
    - {settings}
    - div Input rows: {inputCount} Output rows: {outputCount}
    - div Load time: {timeToLoad} Render time: {renderTime}
    - div Input Columns:
    - pre
    - bern
    - {inputColumnsAsTable}
    - div Output Columns
    - pre
    - bern
    - {outputColumnsAsTable}
    - div Output Numeric Values:
    - pre
    - bern
    - {outputNumericValues}
    - div TypeScript Interface:
    - pre
    - bern
    - {typeScriptInterface}
    - div Input Numeric Values:
    - pre
    - bern
    - {inputNumericValues}
    - javascript
    - // todo: ADD TYPINGS
    - getPipishInput() {
    - // todo: add placeholder property?
    - return this.getSettingsStruct().content || this.getParentOrDummyTable().getFirstColumnAsString() || ""
    - }
    - getDependencies() {
    - return [{ getLineModifiedTime: () => this.getParentOrDummyTable().getTableCTime() }] // todo: we removed this: this.getOutputOrInputTable().getTableCTime()...i think we had it because we want to return true to update children.
    - }
    - getRunTimeEnumOptions(cell) {
    - // todo: only works if codemirror === tab
    - try {
    - // todo: handle at static time.
    - if (cell.getCellTypeId() === "columnNameCell" && this.isLoaded()) {
    - const mirrorNode = typeof app === "undefined" ? this : app.mountedProgram.nodeAtLine(this.getLineNumber() - 1)
    - return mirrorNode.getParentOrDummyTable().getColumnNames()
    - }
    - } catch (err) {
    - console.log(err)
    - }
    - }
    - mapSettingNamesToColumnNames(settingNames) {
    - const tileStruct = this.getSettingsStruct()
    - return settingNames.map(name => tileStruct[name])
    - }
    - getOutputOrInputTable() {
    - return this._outputTable || this.getParentOrDummyTable()
    - }
    - getOutputTable() {
    - return this._outputTable
    - }
    - getParentOrDummyTable() {
    - // Returns: non-empty input table || dummy table || empty input table.
    - const parentTable = this.getParent().getOutputOrInputTable()
    - if (!parentTable.isBlankTable()) return parentTable
    - return this._getDummyTable() || parentTable
    - }
    - _getDummyTable() {
    - const dataSet = DummyDataSets[this.dummyDataSetName]
    - if (!this._dummyTable && dataSet) this._dummyTable = new Table(jtree.Utils.javascriptTableWithHeaderRowToObjects(dataSet))
    - return this._dummyTable
    - }
    - getRequiredTableWithHeader(headerSettingNames) {
    - const columnNames = this.mapSettingNamesToColumnNames(headerSettingNames)
    - const table = this.getParentOrDummyTable()
    - const columns = columnNames.map(name => table.getTableColumnByName(name))
    - if (columns.some(col => !col)) return []
    - return this.getRowsAsDataTableArrayWithHeader(table.getRows(), columnNames)
    - }
    - setIsDataLoaded(value) {
    - this._isDataLoaded = value
    - this.makeDirty() // todo: remove
    - return this
    - }
    - getRowsAsDataTableArrayWithHeader(rows, header) {
    - const data = rows.map(row => row.getAsArray(header))
    - data.unshift(header)
    - return data
    - }
    - getTileQualityCheck() {
    - const definition = this.getDefinition()
    - const name = this.getFirstWord()
    - let score = 0
    - return {
    - name: name,
    - namespace: name.split(".")[0],
    - description: definition.getDescription() ? 1 : 0,
    - dummyDataSetName: this.dummyDataSetName,
    - runTimeErrors: Object.values(this.getRunTimePhaseErrors()).length,
    - examples: definition.getExamples().length,
    - edgeTests: 0,
    - speedTests: 0,
    - roadMap: 0,
    - idealStyleUXDescription: 0,
    - secPriTests: 0,
    - userType: 0
    - }
    - }
    - _getCachedSettings() {
    - if (this._cache_settingsObject) return this._cache_settingsObject
    - this._cache_settingsObject = {}
    - this.filter(child => child.doesExtend("abstractTileSettingTerminalNode") || child.doesExtend("abstractTileSettingNonTerminalNode")).forEach(setting => {
    - this._cache_settingsObject[setting.getFirstWord()] = setting.getSettingValue()
    - })
    - return this._cache_settingsObject
    - }
    - // todo: ADD TYPINGS
    - getSettingsStruct() {
    - const settingsFromCache = this._getCachedSettings()
    - // todo: this wont work anymore
    - const hintsNode = this.getDefinition().getConstantsObject()[this.columnPredictionHintsKey]
    - if (hintsNode) Object.assign(settingsFromCache, this.getParentOrDummyTable().getPredictionsForAPropertyNameToColumnNameMapGivenHintsNode(new jtree.TreeNode(hintsNode), settingsFromCache))
    - return settingsFromCache
    - }
    - getProgramTemplate(id) {}
    - getSnippetTemplate(id) {}
    - getExampleTemplate(index) {
    - // todo: right now we only have 1 example per tile.
    - const exampleNode = this.getDefinition().getNode(jtree.GrammarConstants.example)
    - return exampleNode ? exampleNode.childrenToString() : ""
    - }
    - toStumpLoadingCode() {
    - return this.qFormat(this.tileLoadingTemplate, { classes: this.getCssClassNames().join(" "), id: this.getTreeComponentId(), name: this.getWord(0), footer: this.getTileMenuButtonStumpCode() })
    - }
    - emitLogMessage(message) {
    - const tab = this.getTab()
    - if (tab) tab.addStumpCodeMessageToLog(message)
    - else if (this.isNodeJs()) console.log(message)
    - }
    - getTheme() {
    - return this.getTab().getTheme()
    - }
    - qFormat(str, obj) {
    - return new jtree.TreeNode(str).templateToString(obj)
    - }
    - scrollIntoView() {
    - const el = this.getStumpNode()
    - .getShadow()
    - .getShadowElement()
    - if (el) el.scrollIntoView()
    - }
    - async loadBrowserRequirements() {
    - const loadingMap = this.getTab()
    - .getRootNode()
    - .getDefinitionLoadingPromiseMap()
    - if (!loadingMap.has(this.constructor)) loadingMap.set(this.constructor, this._makeBrowserLoadRequirementsPromise(loadingMap))
    - await loadingMap.get(this.constructor)
    - }
    - async _makeBrowserLoadRequirementsPromise(loadingMap) {
    - const app = this.getWebApp()
    - const cssScript = this[OhayoConstants.tileCssScript]
    - if (cssScript) this._loadTileCss(cssScript)
    - const def = this.getDefinition()
    - const scriptPaths = def.nodesThatStartWith("string " + OhayoConstants.tileScript).map(node => node.getWord(2))
    - const thisScript = this[OhayoConstants.tileScript]
    - if (thisScript && !scriptPaths.includes(thisScript)) scriptPaths.push(thisScript)
    - if (scriptPaths.length) await Promise.all(scriptPaths.map(scriptPath => app.getWillowBrowser().appendScript(scriptPath)))
    - loadingMap.set(this.constructor, true)
    - }
    - _loadTileCss(css) {
    - const app = this.getWebApp()
    - app
    - .getWillowBrowser()
    - .getBodyStumpNode()
    - .insertChildNode(
    - css
    - .split(" ")
    - .map(
    - url => \`link
    - rel stylesheet
    - media screen
    - href \${url}\`
    - )
    - .join("\\n")
    - )
    - }
    - _hasBrowserRequirements() {
    - return this.tileScript
    - }
    - _areBrowserRequirementsLoaded() {
    - if (this.isNodeJs()) return true
    - // todo: cleanup. assumes app is here in browser.
    - const loadingMap = app.getDefinitionLoadingPromiseMap()
    - return !this._hasBrowserRequirements() || loadingMap.get(this.constructor) === true
    - }
    - isLoaded() {
    - return this._areBrowserRequirementsLoaded() && (!this.needsData || this._isDataLoaded)
    - }
    - getErrorMessageHtml() {
    - const errors = Object.values(this.getRunTimePhaseErrors())
    - return errors.length ? \` \${errors.join(" ")}\` : "" //todo: cleanup
    - }
    - toStumpErrorStateCode(err) {
    - return this.qFormat(this.errorStateStumpTemplate, { classes: this.getCssClassNames().join(" "), id: this.getTreeComponentId(), content: \`div \` + err, footer: this.getTileMenuButtonStumpCode() })
    - }
    - // todo: delete this
    - makeDirty() {
    - delete this._cache_settingsObject
    - delete this._bodyStumpCodeCache // todo: cleanup
    - this._setLastRenderedTime(0)
    - }
    - getAllTileSettingsDefinitions() {
    - const def = this.getDefinition()
    - return Object.values(def.getFirstWordMapWithDefinitions()).filter(def => def.isOrExtendsANodeTypeInScope([OhayoConstants.abstractTileSetting]))
    - }
    - getTab() {
    - return this.getRootNode().getTab()
    - }
    - getChildTiles() {
    - return this.getChildInstancesOfNodeTypeId("abstractTileTreeComponentNode")
    - }
    - selectTile() {
    - this.selectNode()
    - if (this.isMounted()) this.getStumpNode().addClassToStumpNode(OhayoConstants.selectedClass)
    - }
    - unselectNode() {
    - super.unselectNode()
    - if (this.isMounted()) this.getStumpNode().removeClassFromStumpNode(OhayoConstants.selectedClass)
    - }
    - getCssClassNames() {
    - const classNames = super.getCssClassNames()
    - if (this._isMaximized()) classNames.push("TileMaximized")
    - return classNames
    - }
    - toStumpCode() {
    - return this.qFormat(this.tileStumpTemplate, {
    - classes: this.getCssClassNames().join(" "),
    - id: this.getTreeComponentId(),
    - bodyStyle: this.customBodyStyle || "",
    - body: this._getBodyStumpCodeCache() || "",
    - footer: this.getTileFooterStumpCode()
    - })
    - }
    - _getBodyStumpCodeCache() {
    - if (!this._bodyStumpCodeCache) this._bodyStumpCodeCache = this.getTileBodyStumpCode()
    - return this._bodyStumpCodeCache
    - }
    - getTileBodyStumpCode() {
    - return \`\`
    - }
    - _getCss() {
    - const selector = "#" + this.getTreeComponentId()
    - const theme = this.getTheme()
    - const visibleCss = this.isVisible() ? "" : "display: none"
    - const hakonCode = this.hakonTemplate ? new jtree.TreeNode(theme).evalTemplateString(this.hakonTemplate) : this.toHakonCode()
    - return \`\${selector} { \${visibleCss} }
    - \${theme.hakonToCss(hakonCode)}\`
    - }
    - handleTileError(err) {
    - if (!this._errorCount) this._errorCount = 0
    - this._errorCount++
    - this.getRootNode().goRed(err)
    - }
    - async insertTileBetweenCommand() {
    - const tab = this.getTab()
    - const newNode = this.appendLine("doc.picker")
    - this.getChildTiles().forEach(tile => {
    - if (tile === newNode) return true
    - newNode.appendNode(tile)
    - tile.unmountAndDestroy()
    - })
    - tab.autosaveTab()
    - await this.getRootNode().loadAndIncrementalRender()
    - }
    - getWall() {
    - return this.getWebApp().getAppWall()
    - }
    - getWebApp() {
    - return this.getTab().getRootNode()
    - }
    - async runAndrenderAndGetRenderReport() {
    - await this.execute()
    - return this.renderAndGetRenderReport()
    - }
    - getTimeToLoad() {
    - return this._timeToLoad || 0
    - }
    - toHakonCode() {
    - return ""
    - }
    - getTileFooterStumpCode() {
    - return this.getTileMenuButtonStumpCode()
    - }
    - getTileMenuButtonStumpCode() {
    - return this.qFormat(this.pencilStumpTemplate)
    - }
    - // Tile child rendering is done at the wall level.
    - _getChildTreeComponents() {
    - return []
    - }
    - getStumpNodeForChildren() {
    - // We render all Tiles on the Wall.
    - return this.getStumpNode().getParent()
    - }
    - toInspectionStumpCode() {
    - const messages = this.getMessageBuffer().map(message => \`li \${moment(message.getLineModifiedTime()).fromNow()} - \${message.childrenToString()}\`)
    - // const settings = this.getAllTileSettingsDefinitions()
    - // .map(setting => \`\${setting.getFirstWord()} \${setting.getDescription()}\`)
    - // .join("\\n")
    - const settings = JSON.stringify(this.getSettingsStruct(), null, 2)
    - const parentConstructorName = this.getParent().constructor.name
    - const constructorName = this.constructor.name
    - const sourceCode = this.toString()
    - const inputTable = this.getParentOrDummyTable()
    - const outputTable = this.getOutputOrInputTable()
    - const outputColumns = outputTable.getColumnsArrayOfObjects()
    - const inputCols = inputTable.getColumnsArrayOfObjects()
    - const inputCount = inputTable.getRowCount()
    - const outputCount = outputTable.getRowCount()
    - const timeToLoad = this.getTimeToLoad()
    - const renderTime = this.getNewestTimeToRender()
    - const inputColumnsAsTable = new jtree.TreeNode(inputCols).toTable()
    - const outputColumnsAsTable = new jtree.TreeNode(outputColumns).toTable()
    - const outputNumericValues = new jtree.TreeNode(outputTable.getJavascriptNativeTypedValues()).toTable()
    - const typeScriptInterface = outputTable.toTypeScriptInterface()
    - const inputNumericValues = new jtree.TreeNode(inputTable.getJavascriptNativeTypedValues()).toTable()
    - return this.qFormat(this.inspectionStumpTemplate, {
    - settings,
    - inputCount,
    - outputCount,
    - timeToLoad,
    - renderTime,
    - inputColumnsAsTable,
    - outputColumnsAsTable,
    - outputNumericValues,
    - typeScriptInterface,
    - inputNumericValues,
    - constructorName,
    - parentConstructorName,
    - sourceCode,
    - messages
    - })
    - }
    - isVisible() {
    - if (this.has(this.visibleKey)) return true
    - if (this.visible === false) return false
    - if (this.has(this.hiddenKey)) return false
    - return true
    - }
    - _isMaximized() {
    - return this.has(OhayoConstants.maximized)
    - }
    - async _executeChildNodes() {
    - await Promise.all(this.getChildTiles().map(tile => tile.execute()))
    - }
    - async _execute() {
    - this.setIsDataLoaded(true)
    - await this._executeChildNodes()
    - }
    - async execute() {
    - try {
    - this.setRunTimePhaseError("execute")
    - await this._execute()
    - } catch (err) {
    - this.setRunTimePhaseError("execute", err)
    - console.error(err)
    - this.emitLogMessage(this.errorLogMessageStumpTemplate)
    - }
    - return this
    - }
    - cloneTileCommand() {
    - this.duplicateLineCommand()
    - return this.getTab().autosaveAndRender()
    - }
    - duplicateLineCommand() {
    - return this.getParent().insertLineAndChildren(this.getLine(), undefined, this.getIndex() + 1)
    - }
    - async toggleTileMaximizeCommand() {
    - if (this.has(OhayoConstants.maximized)) this.delete(OhayoConstants.maximized)
    - else this.touchNode(OhayoConstants.maximized)
    - await this._runAfterTileUpdate(this)
    - }
    - async triggerTileMethodCommand(value, methodName) {
    - await thisethodName](value)
    - await this._runAfterTileUpdate(this)
    - }
    - // todo: refactor.
    - async changeTileTypeCommand(newValue) {
    - const tab = this.getTab()
    - this.setFirstWord(newValue)
    - const newNode = this.duplicate()
    - // todo: destroy or something? how do we reparse.
    - this.getChildTiles().forEach(tile => tile.unmountAndDestroy())
    - this.unmountAndDestroy()
    - tab.autosaveTab()
    - this.getRootNode().loadAndIncrementalRender()
    - }
    - changeParentCommand(pathVector) {
    - // if (tile.getFirstWordPath() === value) return; // todo: do we need this line?
    - const program = this.getRootNode()
    - const indexPath = pathVector ? pathVector.split(" ").map(num => parseInt(num)) : ""
    - const destinationTree = indexPath ? program.nodeAt(indexPath) : program
    - // todo: on jtree should we make copyTo second param optional?
    - this.copyTo(destinationTree, destinationTree.length)
    - this.unmountAndDestroy()
    - return this.getTab().autosaveAndRender()
    - }
    - async removeTileCommand() {
    - const tab = this.getTab()
    - this.getChildTiles().forEach(tile => {
    - tile.unmount()
    - tile.shiftLeft()
    - })
    - this.unmountAndDestroy()
    - tab.autosaveTab()
    - this.getRootNode().loadAndIncrementalRender()
    - }
    - getNewDataCommand() {
    - // todo: have some type of paging system to fetch new data.
    - }
    - async changeTileSettingAndRenderCommand(value, settingName) {
    - // note the unusual ordering of params.
    - this.touchNode(settingName).setContent(value.toString())
    - // todo: sometimes size needs to be redone (maximize, for example)
    - await this._runAfterTileUpdate(this)
    - }
    - // todo: remove
    - async changeTileSettingMultilineCommand(val, settingName) {
    - this.touchNode(settingName).setChildren(val)
    - await this._runAfterTileUpdate(this)
    - }
    - async changeTileSettingCommand(settingName, value) {
    - this.touchNode(settingName).setContent(value)
    - }
    - async changeWordAndRenderCommand(value, index) {
    - this.setWord(parseInt(index), value)
    - await this._runAfterTileUpdate(this)
    - }
    - async changeWordsAndRenderCommand(value, index) {
    - index = parseInt(index)
    - const edgeSymbol = this.getEdgeSymbol()
    - const words = this.getWords().slice(0, index)
    - this.setLine(words.concat(value.split(edgeSymbol)).join(edgeSymbol))
    - await this._runAfterTileUpdate(this)
    - }
    - async updateChildrenCommand(val) {
    - this.setChildren(val)
    - // reload the whole doc for now.
    - await this._runAfterTileUpdate(this)
    - }
    - async _runAfterTileUpdate(tile) {
    - tile.makeDirty() // ugly!
    - tile.getChildTiles().forEach(tile => {
    - tile.makeDirty() // todo: ugly!
    - })
    - // todo: what if you have a tile that has a contextare that allows editing of its children/
    - // if you edit a child, then that parent tile needs to update to...should we allow that or ban that?
    - await tile.getTab().autosaveTab()
    - await tile.runAndrenderAndGetRenderReport()
    - tile
    - .getTab()
    - .getRootNode()
    - .renderApp() // Need to render full app because of code editor
    - }
    - // todo: downstream data changes?
    - async changeTileContentAndRenderCommand(value) {
    - this.setContent(value)
    - await this._runAfterTileUpdate(this)
    - }
    - async copyTileCommand() {
    - // todo: remove cousin tiles?
    - this.getRootNode()
    - .getWillowBrowser()
    - .copyTextToClipboard(this.getFirstAncestor().toString())
    - }
    - async createProgramFromTileExampleCommand(index) {
    - const template = this.getExampleTemplate(index)
    - if (!template) return undefined
    - const fileExtension = "ohayo" // todo: generalize
    - const tab = await this.getTab()
    - .getRootNode()
    - ._createAndOpen(template, \`help-for-\${this.getFirstWord()}.\${fileExtension}\`)
    - tab.addStumpCodeMessageToLog(\`div Created '\${tab.getFullTabFilePath()}'\`)
    - }
    - async inspectTileCommand() {
    - if (!this.isNodeJs()) {
    - console.log("Tile available at window.tile")
    - window.tile = this
    - console.log(this)
    - }
    - this.getTab().addStumpCodeMessageToLog(this.toInspectionStumpCode())
    - this.getTab()
    - .getRootNode()
    - .renderApp()
    - }
    - async toggleTileMenuCommand() {
    - const app = this.getTab().getRootNode()
    - app.setTargetTile(this)
    - app.toggleAndRender(\`\${StudioConstants.tileMenu}\`)
    - }
    - async createProgramFromTemplateCommand(id) {
    - const programTemplate = this.getProgramTemplate(id)
    - if (!programTemplate) return undefined
    - const tab = await this.getTab()
    - .getRootNode()
    - ._createAndOpen(programTemplate.template, programTemplate.name)
    - tab.addStumpCodeMessageToLog(\`div Created '\${tab.getFullTabFilePath()}'\`)
    - }
    - async appendSnippetTemplateCommand(id) {
    - const snippet = this.getSnippetTemplate(id)
    - if (!snippet) return undefined
    - const tab = this.getTab()
    - const tabProgram = tab.getTabProgram()
    - const newNodes = tabProgram.concat(snippet)
    - const newTiles = newNodes.filter(tile => tile.doesExtend && tile.doesExtend("abstractTileTreeComponentNode"))
    - tab.autosaveTab()
    - tabProgram.clearSelection()
    - tab.getTabWall().unmount()
    - await tabProgram.loadAndIncrementalRender()
    - newTiles.forEach(tile => tile.selectTile())
    - newTiles[0].scrollIntoView()
    - }
    - async copyDataCommand(delimiter) {
    - this.getRootNode()
    - .getWillowBrowser()
    - .copyTextToClipboard(this.getOutputOrInputTable().toDelimited(delimiter))
    - }
    - async copyDataAsJavascriptCommand() {
    - const table = this.getOutputOrInputTable()
    - this.getRootNode()
    - .getWillowBrowser()
    - .copyTextToClipboard(JSON.stringify(table.toTree().toDataTable(table.getColumnNames()), null, 2))
    - }
    - async copyDataAsTreeCommand() {
    - const text = this.getOutputOrInputTable()
    - .toTree()
    - .toString()
    - this.getRootNode()
    - .getWillowBrowser()
    - .copyTextToClipboard(text)
    - }
    - async exportTileDataCommand(format = "csv") {
    - // todo: figure this out. use the browsers filename? tile title? id?
    - let extension = "csv"
    - let type = "text/csv"
    - let str = this.getOutputOrInputTable().toDelimited(",")
    - if (format === "tree") {
    - extension = "tree"
    - type = "text"
    - str = this.getOutputOrInputTable()
    - .toTree()
    - .toString()
    - }
    - this.getRootNode()
    - .getWillowBrowser()
    - .downloadFile(str, this.getTab().getFileName() + "." + extension, type)
    - }
    - abstractChartNode
    - inScope rowDisplayLimitNode
    - int rowDisplayLimit 10000
    - extends abstractTileTreeComponentNode
    - abstract
    - string tileFooterTemplate
    - span Rows: {rowCount} Columns Out: {columnCount}
    - {tileMenuButton}
    - javascript
    - getTileFooterStumpCode() {
    - const table = this.getParentOrDummyTable()
    - return this.qFormat(this.tileFooterTemplate, { rowCount: table.getRowCount(), columnCount: table.getColumnCount(), tileMenuButton: this.getTileMenuButtonStumpCode() })
    - }
    - getTileRunTimeWidth() {
    - return this.isNodeJs() ? 456 : jQuery(".WallTreeComponent").width() - 100
    - }
    - getTileRunTimeHeight() {
    - return 300
    - }
    - toDisplayString(value, columnName) {
    - // todo: remove.
    - if (value === undefined) return ""
    - return this.getParentOrDummyTable()
    - .getTableColumnByName(columnName)
    - .toDisplayString(value)
    - }
    - _getRowDisplayLimit() {
    - const limitStr = this.getSettingsStruct()[this.rowDisplayLimitKey] || this.rowDisplayLimit
    - const limit = parseInt(limitStr)
    - if (!limitStr || isNaN(limit)) return undefined
    - return limit
    - }
    - getRowsWithRowDisplayLimit() {
    - return this.getParentOrDummyTable()
    - .getRows()
    - .slice(0, this._getRowDisplayLimit())
    - }
    - abstractTextNode
    - catchAllCellType stringCell
    - frequency 0
    - description Prints a message
    - inScope contentNode
    - string bodyStumpTemplate
    - div
    - class TileSelectable
    - bern
    - {content}
    - javascript
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, { content: this.content ? jtree.Utils.linkify(this.content) : "" })
    - }
    - extends abstractChartNode
    - abstract
    - abstractInstructionsNode
    - string tileSize 600 240
    - string content Instructions go here.
    - extends abstractTextNode
    - abstract
    - amazonHistoryNode
    - description Instructions on how to get your Amazon order history.
    - string content Step 1. Go to https://www.amazon.com/gp/b2b/reports to download your Amazon order history.
    Step 2. Add the data here.
    - string dummyDataSetName amazonPurchases
    - extends abstractInstructionsNode
    - crux amazon.history
    - fitbitAllNode
    - description Instructions on how to get your Fitbit data.
    - string content Step 1. Go to https://www.fitbit.com/settings/data/export to download your Fitbit data.
    Step 2. Drop the CSV onto this page.
    - extends abstractInstructionsNode
    - crux fitbit.all
    - abstractComingSoonNode
    - frequency 0
    - description Coming soon
    - string tileSize 600 240
    - string content Instructions go here.
    - extends abstractTextNode
    - abstract
    - datawrapperComingSoonNode
    - string content We don't have support yet for https://www.datawrapper.de/
    - extends abstractComingSoonNode
    - crux datawrapper.comingSoon
    - dcjsComingSoonNode
    - string content We don't have support yet for https://github.com/dc-js/dc.js
    - extends abstractComingSoonNode
    - crux dcjs.comingSoon
    - finosPerspectiveComingSoonNode
    - string content We don't have support yet for https://perspective.finos.org/
    - extends abstractComingSoonNode
    - crux finos.perspective.comingSoon
    - fivethirtyeightComingSoonNode
    - string content We don't have support yet for https://github.com/fivethirtyeight/data/
    - extends abstractComingSoonNode
    - crux fivethirtyeight.comingSoon
    - GovNode
    - string content We don't have support yet for https://www.data.gov/
    - extends abstractComingSoonNode
    - crux gov.comingSoon
    - highchartsComingSoonNode
    - string content We don't have support yet for https://www.highcharts.com/blog/snippets/3d-solar-system/
    - extends abstractComingSoonNode
    - crux highcharts.comingSoon
    - re3dataComingSoonNode
    - string content We don't have support yet for https://www.re3data.org/
    - extends abstractComingSoonNode
    - crux re3data.comingSoon
    - zingComingSoonNode
    - string content We don't have support yet for https://www.zingchart.com/
    - extends abstractComingSoonNode
    - crux zing.comingSoon
    - editorHelloWorldNode
    - description Prints hello world
    - example Say hello.
    - editor.helloWorld
    - string content Ohayo world!
    - extends abstractTextNode
    - crux editor.helloWorld
    - abstractSnippetGalleryNode
    - string tileSize 600 240
    - extends abstractChartNode
    - abstract
    - string bodyStumpTemplate
    - h4 {title}
    - ol
    - class TileSelectable
    - {options}
    - string optionStumpTemplate
    - li
    - a {title}
    - value {value}
    - class appendSnippetButton
    - clickCommand appendSnippetTemplateCommand
    - javascript
    - getGalleryNodes() {}
    - async _execute() {
    - this._outputTable = new Table(
    - this.getGalleryNodes()
    - .toDataTable()
    - .slice(1)
    - )
    - this.setIsDataLoaded(true)
    - await this._executeChildNodes()
    - }
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, {
    - title: this.title,
    - options: new jtree.TreeNode(
    - this.getGalleryNodes()
    - .map(node => this.qFormat(this.optionStumpTemplate, { title: node.evalTemplateString(this.itemFormat), value: node.get("id") }))
    - .join("\\n")
    - ).toString()
    - })
    - }
    - abstractTemplateGalleryNode
    - extends abstractSnippetGalleryNode
    - abstract
    - string optionStumpTemplate
    - li
    - a {title}
    - value {value}
    - class createProgramButton
    - clickCommand createProgramFromTemplateCommand
    - challengeListNode
    - description View all challenges
    - string title Try a challenge:
    - string itemFormat {question}
    - extends abstractSnippetGalleryNode
    - crux challenge.list
    - javascript
    - getGalleryNodes() {
    - return typeof challengesTree === "undefined" ? jtree.TreeNode.fromDisk("ohayo/packages/challenge/challenges.tree") : new jtree.TreeNode(challengesTree)
    - }
    - getSnippetTemplate(id) {
    - return \`challenge.play \${id}\`
    - }
    - samplesListNode
    - description View all available sample tiles
    - string title All samples:
    - string itemFormat {id} - {description}
    - boolean isDataPublicDomain true
    - extends abstractSnippetGalleryNode
    - crux samples.list
    - javascript
    - getGalleryNodes() {
    - // todo: cleanup.
    - const ohayo = this.getWebApp().getOhayoGrammarAsTree()
    - const hits = ohayo.getNodesByRegex(/^samples/).map(node => {
    - return {
    - id: node.get("crux"),
    - description: node.get("description")
    - }
    - })
    - return new jtree.TreeNode(hits)
    - }
    - getSnippetTemplate(id) {
    - return id
    - }
    - vegaDataListNode
    - description View all available Vega datasets
    - frequency .001
    - string title All Vega datasets:
    - string itemFormat {id}
    - extends abstractSnippetGalleryNode
    - crux vega.data.list
    - javascript
    - getGalleryNodes() {
    - // todo: cleanup this line.
    - const node = this.getWebApp()
    - .getOhayoGrammarAsTree()
    - .getNodesByRegex(/^vegaDataSetCell/)[0]
    - return new jtree.TreeNode(
    - node
    - .get("enum")
    - .split(" ")
    - .map(item => {
    - return {
    - id: item
    - }
    - })
    - )
    - }
    - getSnippetTemplate(id) {
    - return \`vega.data \${id}\`
    - }
    - vegaExampleListNode
    - description View all available Vega examples
    - frequency .001
    - string title All Vega examples:
    - string itemFormat {id}
    - extends abstractSnippetGalleryNode
    - crux vega.example.list
    - javascript
    - getGalleryNodes() {
    - // todo: cleanup this line.
    - const node = this.getWebApp()
    - .getOhayoGrammarAsTree()
    - .getNodesByRegex(/^vegaExampleNameCell/)[0]
    - return new jtree.TreeNode(
    - node
    - .get("enum")
    - .split(" ")
    - .map(item => {
    - return {
    - id: item
    - }
    - })
    - )
    - }
    - getSnippetTemplate(id) {
    - return \`vega.example \${id}\`
    - }
    - abstractPickerTileNode
    - extends abstractChartNode
    - string tileSize 480 420
    - boolean needsData false
    - abstract
    - string hakonTemplate
    - .abstractPickerTileNode
    - .PickerCategory
    - width 100%
    - margin-top 20px
    - text-align center
    - .TileBody
    - display flex
    - flex-flow row wrap
    - a
    - &:hover
    - background-color {borderColor}
    - padding 10px
    - margin 5px
    - height 30px
    - background-color {backgroundColor}
    - border 1px solid {borderColor}
    - overflow hidden
    - text-align center
    - text-overflow ellipsis
    - font-size 14px
    - width 120px
    - span
    - font-size 70%
    - string itemStumpTemplate
    - {categoryBreak}
    - a {name}
    - br
    - span {description}
    - title {description}
    - tabindex -1
    - value {value}
    - class pickerItemButton
    - clickCommand {command}
    - string categoryBreakStumpTemplate
    - div {category}
    - class PickerCategory
    - javascript
    - async fetchTableInputs() {
    - return { rows: this.getChoices() }
    - }
    - getTileBodyStumpCode() {
    - let lastCat = ""
    - return this.getChoices()
    - .map(choice => {
    - choice.categoryBreak = lastCat !== choice.category ? this.qFormat(this.categoryBreakStumpTemplate, { category: choice.category }) : ""
    - lastCat = choice.category
    - return this.qFormat(this.itemStumpTemplate, choice)
    - })
    - .join("\\n")
    - }
    - PickerTileNode
    - extends abstractPickerTileNode
    - description Displays list of available tiles.
    - crux doc.picker
    - javascript
    - getChoices() {
    - const allChoices = this.getRootNode()
    - .getHandGrammarProgram()
    - .getTopNodeTypeDefinitions()
    - const filteredChoices = allChoices.filter(nodeDef => !(nodeDef.get(jtree.GrammarConstants.tags) || "").includes(OhayoConstants.noPicker))
    - const theChoices = filteredChoices.length ? filteredChoices : allChoices
    - return theChoices.map(nodeDefinition => {
    - const nodeId = nodeDefinition.get("crux") || nodeDefinition.getNodeTypeIdFromDefinition()
    - const name = nodeId.split(".")[1] || ""
    - const category = lodash.upperFirst(nodeId.split(".")[0])
    - const description = nodeDefinition.getDescription()
    - return { name, category, description, value: nodeId, command: "changeTileTypeCommand" }
    - })
    - }
    - templatesListNode
    - extends abstractPickerTileNode
    - description Displays templates.
    - frequency .22
    - crux templates.list
    - javascript
    - getChoices() {
    - // todo: cleanup.
    - const choices = this.getWebApp()
    - .getStandardTemplates()
    - .map(node => {
    - const id = node
    - .getWord(1)
    - .replace("templates/", "")
    - .replace(this.ohayoFileExtensionKey, "")
    - return {
    - command: "createProgramFromTemplateCommand",
    - name: node.get("data doc.title"),
    - value: id,
    - category: lodash.upperFirst(node.get("data doc.categories")),
    - description: ""
    - }
    - })
    - return lodash.sortBy(choices, "category")
    - }
    - getProgramTemplate(id) {
    - const node = this.getWebApp()
    - .getStandardTemplates()
    - .filter(node => node.getContent() === \`templates/\${id}\${this.ohayoFileExtensionKey}\`)[0]
    - return {
    - template: node.getNode("data").childrenToString(),
    - name: id + this.ohayoFileExtensionKey
    - }
    - }
    - asciiChartNode
    - description Lightweight ASCII line chart from the library https://github.com/kroitor/asciichart
    - string tileScript ohayo/packages/asciichart/asciichart.js
    - extends abstractChartNode
    - crux asciichart.line
    - catchAllCellType titleCell
    - inScope yColumnNode
    - example
    - samples.waterBill
    - asciichart.line Water Bill
    - string columnPredictionHints
    - yColumn isString=false
    - string bodyStumpTemplate
    - pre
    - class TileSelectable
    - style overflow: scroll; width: 100%; height: 100%; white-space: pre;
    - bern
    - {title}
    - {chart}
    - javascript
    - getTileBodyStumpCode() {
    - // todo: autodetect column
    - const columName = this.mapSettingNamesToColumnNames(["yColumn"])[0]
    - const column = this.getParentOrDummyTable().getColumnByName(columName)
    - const values = column.getValues()
    - const chart = asciichart.plot(values, { height: 15 })
    - const title = this.getContent() || ""
    - const leftPad = Math.max(0, Math.floor((chart.split("\\n")[0].length - title.length) / 2))
    - return this.qFormat(this.bodyStumpTemplate, { title: " ".repeat(leftPad) + title, chart })
    - }
    - calendarHeatNode
    - description Shows which days have higher counts.
    - inScope countNode dayColumnNode
    - string tileSize 750 200
    - string columnPredictionHints
    - count getPrimitiveTypeName=number
    - dayColumn getPrimitiveTypeName=day
    - string dummyDataSetName waterBill
    - extends abstractChartNode
    - crux calendar.heat
    - string bodyStumpTemplate
    - div
    - class heatCal
    - bern
    - {svg}
    - string hakonTemplate
    - .heatCal
    - rect
    - fill {darkerBackground}
    - shape-rendering crispedges
    - text
    - font-size 10px
    - fill #ddd
    - javascript
    - _getLegend(quins, squareSideWithPadding, position) {
    - const theme = this.getTheme()
    - const quinSvgs = quins
    - .map((quin, index) => {
    - const left = position.left + squareSideWithPadding * index
    - const style = "fill: " + theme.getHeatColor(1 - quin.percent)
    - return \`\`
    - })
    - .join("")
    - return \`
    - Less
    - \${quinSvgs}
    - More
    - \`
    - }
    - getTileBodyStumpCode() {
    - const svg = this._getSvg()
    - return this.qFormat(this.bodyStumpTemplate, { svg })
    - }
    - _getDayMap(quins, rows, dayColumnName, countColumnName) {
    - const getQuin = val => {
    - for (let index = 0; index < quins.length; index++) {
    - if (val <= quins[index].value) return quins[index].percent
    - }
    - }
    - const dayMap = {}
    - rows.forEach(row => {
    - dayMapoment(row[dayColumnName]).format("MM/DD/YYYY")] = {
    - Quin: getQuin(row[countColumnName]),
    - count: row[countColumnName],
    - row: row
    - }
    - })
    - return dayMap
    - }
    - _getDaysArray(startDay, daysToShow) {
    - const days = []
    - const firstDay = parseInt(startDay.format("e"))
    - for (let dayIndex = 0; dayIndex <= daysToShow; dayIndex++) {
    - const day = startDay.clone().add(dayIndex, "days")
    - days.push({
    - day: day,
    - row: parseInt(day.format("e")),
    - col: Math.floor((firstDay + dayIndex) / 7)
    - })
    - }
    - return days
    - }
    - _getDayNamesG(squareSideWithPadding) {
    - const dayNames = [{ day: "Mon", row: 2 }, { day: "Wed", row: 4 }, { day: "Fri", row: 6 }]
    - .map(day => {
    - const _top = 20 + day.row * squareSideWithPadding - 3
    - return \`\${day.day}\`
    - })
    - .join("")
    - return \`\${dayNames}\`
    - }
    - _getMonthNamesG(daysArray, squareSideWithPadding) {
    - const _usedMonths = {}
    - const monthNames = daysArray
    - .map(day => {
    - const monthName = day.day.format("MMM")
    - const monthYear = day.day.format("MM/YYYY")
    - if (_usedMonthsonthYear]) return ""
    - _usedMonthsonthYear] = true
    - const left = 40 + day.col * squareSideWithPadding
    - return \`\${monthName}\`
    - })
    - .join("")
    - return \`\${monthNames}\`
    - }
    - _getDataSquaresG(daysArray, squareSideWithPadding, dayMap) {
    - const dayFormat = "MM/DD/YYYY"
    - const today = moment(Date.now()).format(dayFormat)
    - const theme = this.getTheme()
    - const dataSquares = daysArray
    - .map(day => {
    - const dayKey = day.day.format(dayFormat)
    - const _top = 20 + day.row * squareSideWithPadding
    - const left = 40 + day.col * squareSideWithPadding
    - const value = dayMap[dayKey]
    - const todayStyle = dayKey === today ? "stroke-width:2;stroke:rgb(0,0,0);" : ""
    - const style = (value ? "fill: " + theme.getHeatColor(1 - value.Quin) : "") + ";" + todayStyle
    - const title = \`\${dayKey}: \${value ? value.count : 0}\`
    - return \`\${title}\`
    - })
    - .join("")
    - return \`\${dataSquares}\`
    - }
    - _getSvg() {
    - const inputTable = this.getParentOrDummyTable()
    - const rows = inputTable.getJavascriptNativeTypedValues()
    - if (!rows.length) return ""
    - const tileStruct = this.getSettingsStruct()
    - const dayColumnName = tileStruct.dayColumn
    - const countColumnName = tileStruct.count
    - if (!dayColumnName || !countColumnName) return ""
    - const dayCol = inputTable.getTableColumnByName(dayColumnName)
    - const countCol = inputTable.getTableColumnByName(countColumnName)
    - let daysToShow = 365 * 1 // todo: make configurable
    - let endDay = moment(Date.now())
    - let startDay = endDay.clone().subtract(daysToShow, "days")
    - // todo: make configurable
    - // reductions = dayCol.getReductions()
    - // startDay = moment(reductions.min)
    - // endDay = moment(reductions.max)
    - // daysToShow = endDay.diff(startDay, "days")
    - const squareSide = 10
    - const squarePadding = 2
    - const squareSideWithPadding = squareSide + squarePadding
    - const width = squareSideWithPadding * (daysToShow / 6)
    - const height = 7 * squareSideWithPadding + 100
    - const quins = countCol.getQuins()
    - const dayMap = this._getDayMap(quins, rows, dayColumnName, countColumnName)
    - const daysArray = this._getDaysArray(startDay, daysToShow)
    - const dayNamesG = this._getDayNamesG(squareSideWithPadding)
    - const monthNamesG = this._getMonthNamesG(daysArray, squareSideWithPadding)
    - const squaresG = this._getDataSquaresG(daysArray, squareSideWithPadding, dayMap)
    - const keyG = this._getLegend(quins, squareSideWithPadding, { top: 110, left: 60 })
    - return \`\${dayNamesG + squaresG + monthNamesG + keyG}\`
    - }
    - challengePlayNode
    - cells tileKeywordCell challengeIdCell
    - description Learn ohayo by trying a challenge.
    - catchAllCellType challengeAnswerCell
    - tags aTileThatCreatesPrograms
    - example
    - challenge.list
    - challenge.play 1
    - challenge.play 2
    - string tileSize 640 240
    - extends abstractChartNode
    - crux challenge.play
    - javascript
    - getProgramTemplate(id) {
    - const challengeNode = this._getChallengeNode(parseInt(id))
    - return {
    - template: challengeNode.getNode("solution").childrenToString(),
    - name: "challenge-" + id + "-solution.ohayo"
    - }
    - }
    - _getChallengeNode(challengeId) {
    - const challenges = typeof challengesTree === "undefined" ? jtree.TreeNode.fromDisk("ohayo/packages/challenge/challenges.tree") : new jtree.TreeNode(challengesTree)
    - return challenges.nodeAt(challengeId - 1) || challenges.nodeAt(0)
    - }
    - getTileBodyStumpCode() {
    - const challengeId = parseInt(this.getWord(1))
    - const answer = this.getWord(2)
    - const challengeNode = this._getChallengeNode(challengeId)
    - const isCorrect = answer === challengeNode.get("answer")
    - const theme = this.getTheme()
    - const color = answer ? (isCorrect ? theme.successColor : theme.errorColor) : theme.warningColor
    - const answerMessage = answer !== undefined ? (isCorrect ? "CORRECT!" : "Wrong.") : ""
    - return \`h3 Challenge #\${challengeId}
    - style color:\${color}
    - br
    - div \${challengeNode.evalTemplateString(\`Question: {question}\`)}
    - class TileSelectable
    - br
    - input
    - placeholder Enter your answer here. All answers are a number.
    - value \${answer !== undefined ? answer : ""}
    - style width: 300px;
    - name 2
    - changeCommand changeWordAndRenderCommand
    - span \${answerMessage}
    - style color: \${color};
    - br
    - div
    - a See a solution
    - clickCommand createProgramFromTemplateCommand
    - value \${challengeId}\`
    - }
    - debugDumpNode
    - description Dumps data from content or dump's first column input as 1 concatenated string.
    - example Print a poem.
    - samples.poem
    - debug.dump
    - extends abstractChartNode
    - crux debug.dump
    - string bodyStumpTemplate
    - div
    - style overflow: scroll; width: 100%; height: 100%; white-space: pre;
    - bern
    - {text}
    - javascript
    - _getCharacterLimit() {
    - // Todo: great example of a scale test. I found it to be slow with:
    - /*
    - vega.sample movies.json
    - web.dump
    - So some tiles will have characterLimit, rowDisplayLimit, et cetera. And have "speedTestExamples" .
    - */
    - return 20000
    - }
    - getTileBodyStumpCode() {
    - const text = this._getTextToDump()
    - const characterLimit = this._getCharacterLimit()
    - let sub = text.substr(0, characterLimit)
    - if (text.length > characterLimit)
    - // todo: Show standardized truncation warning
    - sub = \`(Notice: Results truncated to \${characterLimit} characters)
    \` + sub
    - return this.qFormat(this.bodyStumpTemplate, { text: sub || "No data to dump" })
    - }
    - _getTextToDump() {
    - return this.getPipishInput()
    - }
    - webDumpNode
    - frequency .02
    - description Dump the raw text from the web request.
    - extends debugDumpNode
    - javascript
    - _getTextToDump() {
    - return this.getParent().getWillowHttpResponse ? this.getParent().getWillowHttpResponse().text : \`\${this.constructor.name} requires a parent web tile.\`
    - }
    - crux web.dump
    - debugCommandsNode
    - description Tools for ohayo developers.
    - tags noPicker
    - example Show debug commands
    - debug.commands
    - extends abstractChartNode
    - crux debug.commands
    - string bodyStumpTemplate
    - a Run Speed Test on all Templates
    - clickCommand _runTemplateSpeedTestCommand
    - br
    - a Open all Templates Command
    - clickCommand _openAllTemplatesCommand
    - br
    - a Run Tile Quality Check
    - clickCommand _doTileQualityCheckCommand
    - javascript
    - getTileBodyStumpCode() {
    - return this.bodyStumpTemplate
    - }
    - _runTemplateSpeedTestCommand() {
    - return this.getWebApp()._runTemplateSpeedTestCommand()
    - }
    - _openAllTemplatesCommand() {
    - return this.getWebApp()._openAllTemplatesCommand()
    - }
    - _doTileQualityCheckCommand() {
    - return this.getWebApp()._doTileQualityCheckCommand()
    - }
    - debugSleepNode
    - cells tileKeywordCell millisecondsCell dummyDataSetIdCell
    - description Sleeps for a few seconds and then loads data. Useful for testing and development.
    - example Sleep for 1 second then load data
    - debug.sleep 100 waterBill
    - tables.basic
    - string dummyDataSetName waterBill
    - extends abstractChartNode
    - crux debug.sleep
    - javascript
    - async fetchTableInputs() {
    - const ms = parseInt(this.getWord(1) || 1)
    - await this.getWebApp().sleepCommand(ms)
    - return { rows: jtree.Utils.javascriptTableWithHeaderRowToObjects(DummyDataSets[this.getWord(2) || "stockPrice"]) }
    - }
    - debugNoOpNode
    - cells tileKeywordCell
    - catchAllCellType anyCell
    - description A noop.
    - boolean visible false
    - crux debug.noop
    - extends abstractChartNode
    - debugThrowNode
    - description Throws an error during load. Used for testing.
    - cells tileKeywordCell tileEventNameCell
    - example Throw an error
    - samples.poem
    - debug.throw fetchTableInputs
    - extends abstractChartNode
    - crux debug.throw
    - javascript
    - async fetchTableInputs() {
    - this._throwIfMethodNameIs("fetchTableInputs")
    - return {
    - rows: []
    - }
    - }
    - _throwIfMethodNameIs(name) {
    - // Never throw if no word provided. That ensures it wont throw during testing.
    - const lookingFor = this.getContent()
    - if (lookingFor === name) throw new Error(\`DebugTile threw an error on purpose on event: "\${lookingFor}"\`)
    - }
    - getTileBodyStumpCode() {
    - this._throwIfMethodNameIs("getTileBodyStumpCode")
    - }
    - treeComponentDidMount() {
    - this._throwIfMethodNameIs("treeComponentDidMount")
    - }
    - treeComponentDidUpdate() {
    - this._throwIfMethodNameIs("treeComponentDidUpdate")
    - }
    - dtjsBasicNode
    - description A spreadsheet-like table.
    - string tileSize 1200 500
    - string tileCssScript ohayo/packages/dtjs/datatables.min.css
    - string tileScript ohayo/packages/dtjs/datatables.min.js
    - extends abstractChartNode
    - crux dtjs.basic
    - string bodyStumpTemplate
    - div
    - table
    - class DataTable
    - thead
    - tr
    - {headerRows}
    - tbody
    - {rows}
    - string cellStumpTemplate
    - td
    - bern
    - {box}
    - string rowStumpTemplate
    - tr
    - {cols}
    - javascript
    - getTileBodyStumpCode() {
    - const columnDefs = this.getParentOrDummyTable()
    - .getColumnsArray()
    - .slice(0, 10)
    - const headerRows = this._getHeaderRowsStumpCode(columnDefs.map(col => col.getColumnName()))
    - const rows = this._getTableRowsStumpCode(columnDefs)
    - return this.qFormat(this.bodyStumpTemplate, { headerRows, rows })
    - }
    - _getHeaderRowsStumpCode(columns) {
    - return columns.map(colName => \`th \${colName}\`).join("\\n")
    - }
    - _getTableRowsStumpCode(columns) {
    - return this.getRowsWithRowDisplayLimit()
    - .slice(0, 10)
    - .map((row, index) => {
    - const cols = columns
    - .map(column => {
    - const box = row.getRowHtmlSafeValue(column.getColumnName()) // todo: cache?
    - return this.qFormat(this.cellStumpTemplate, { box })
    - })
    - .join("\\n")
    - return this.qFormat(this.cellStumpTemplate, { cols })
    - })
    - .join("\\n")
    - }
    - treeComponentWillUnmount() {
    - // cleanup
    - }
    - treeComponentDidUpdate() {
    - super.treeComponentDidUpdate()
    - const table = this.getParentOrDummyTable()
    - const columnDefs = this.getParentOrDummyTable()
    - .getColumnsArray()
    - .slice(0, 10)
    - const container = this.getStumpNode().findStumpNodeByChild("class DataTable")
    - if (this.isNodeJs()) return undefined
    - const width = this.getTileRunTimeWidth()
    - const height = this.getTileRunTimeHeight()
    - const shadow = container.getShadow()
    - const el = shadow.getShadowElement()
    - shadow.setShadowCss({ width, height })
    - const rows = this.getRowsWithRowDisplayLimit()
    - // todo: note, this is only works with jQuery
    - jQuery.fn.dataTable.ext.errMode = "throw"
    - this._dataTables = jQuery(el).DataTable({
    - data: this.getRowsAsDataTableArrayWithHeader(rows, columnDefs.map(col => col.getColumnName())).slice(1),
    - pageLength: 10,
    - scrollY: height
    - //"scrollCollapse": true,
    - //"paging": false
    - })
    - }
    - treeComponentDidMount() {
    - this.treeComponentDidUpdate()
    - }
    - editorGalleryNode
    - description Show a thumbnail of all the Ohayo documents in the input table.
    - example
    - editor.files
    - editor.gallery
    - string tileSize 1080 600
    - string dummyDataSetName ohayoPrograms
    - extends abstractChartNode
    - crux editor.gallery
    - string hakonTemplate
    - .MiniMapTile
    - .miniMap
    - background {backgroundColor}
    - width 120px
    - height 90px
    - margin 6px
    - position relative
    - overflow hidden
    - box-sizing border-box
    - display inline-block
    - &:hover
    - border 1px solid {boxShadow}
    - &:active
    - border 2px solid {boxShadow}
    - .miniFooter
    - font-size 12px
    - position absolute
    - bottom 0
    - width 100%
    - height 15px
    - line-height 15px
    - white-space nowrap
    - text-align center
    - .miniPreview
    - position absolute
    - width 100%
    - height calc(100% - 15px)
    - top 0
    - overflow hidden
    - div
    - background {linkColor}
    - height 5px
    - margin 1px
    - string miniStumpTemplate
    - a
    - class miniMap
    - {onClick}
    - {value}
    - {href}
    - div
    - class miniPreview
    - {theTiles}
    - div {filename}
    - class miniFooter
    - string bodyStumpTemplate
    - div
    - class MiniMapTile
    - {minis}
    - string miniStyleTemplate
    - div
    - javascript
    - async openFullPathInNewTabAndFocusCommand(url) {
    - return this.getTab()
    - .getRootNode()
    - .openFullPathInNewTabAndFocusCommand(url)
    - }
    - _getMiniStumpCode(sourceCode, filename, permalink, width = 120, height = 75) {
    - const ohayoProgram = new ohayoNode(sourceCode)
    - const theTiles = ohayoProgram
    - .getTiles()
    - .filter(tile => tile.isVisible())
    - .map(tile => this.qFormat(this.miniStyleTemplate, {}))
    - .join("\\n")
    - const onClick = permalink ? "clickCommand openFullPathInNewTabAndFocusCommand" : ""
    - const value = permalink ? \`value \${permalink}\` : ""
    - const href = permalink ? \`href \${permalink}\` : ""
    - return this.qFormat(this.miniStumpTemplate, { filename, theTiles, onClick, value, href })
    - }
    - getTileBodyStumpCode() {
    - // todo: cache.
    - const minis = this.getRowsWithRowDisplayLimit()
    - .map(row => this._getMiniStumpCode(row.getRowOriginalValue("bytes"), row.getRowOriginalValue("filename"), row.getRowOriginalValue("link")))
    - .join("\\n")
    - return this.qFormat(this.bodyStumpTemplate, { minis })
    - }
    - handsontableBasicNode
    - description A spreadsheet-like table.
    - string tileSize 1200 500
    - string tileCssScript ohayo/packages/handsontable/handsontable.min.css
    - string tileScript ohayo/packages/handsontable/handsontable.full.min.js
    - string hakonTemplate
    - .hot
    - color black
    - string bodyStumpTemplate
    - div
    - class hot
    - javascript
    - getTileBodyStumpCode() {
    - return this.bodyStumpTemplate
    - }
    - // todo: allow editing
    - treeComponentWillUnmount() {
    - if (this._hot) this._hot.destroy()
    - delete this._hot
    - }
    - treeComponentDidUpdate() {
    - super.treeComponentDidUpdate()
    - const table = this.getParentOrDummyTable()
    - const columnDefs = table.getColumnsByImportance()
    - const colNames = columnDefs.map(col => col.getColumnName())
    - const rows = this.getRowsWithRowDisplayLimit()
    - const data = this.getRowsAsDataTableArrayWithHeader(rows, colNames)
    - const container = this.getStumpNode().findStumpNodeByChild("class hot")
    - const app = this.getWebApp()
    - if (this.isNodeJs()) return undefined
    - const width = this.getTileRunTimeWidth()
    - const height = this.getTileRunTimeHeight()
    - this._hot = new Handsontable(container.getShadow().getShadowElement(), {
    - data: data,
    - rowHeaders: true,
    - colHeaders: true,
    - stretchH: "all",
    - width,
    - minSpareCols: 10,
    - minSpareRows: 30,
    - afterSelection: () => app.pauseShortcutListener(),
    - afterDeselect: () => app.startShortcutListener(),
    - height
    - })
    - return this._hot
    - }
    - treeComponentDidMount() {
    - this.treeComponentDidUpdate()
    - }
    - extends abstractChartNode
    - crux handsontable.basic
    - abstractHtmlNode
    - catchAllCellType htmlCell
    - frequency 0
    - description An HTML element
    - inScope styleNode contentNode
    - extends abstractChartNode
    - string hakonTemplate
    - .abstractHtmlNode
    - code
    - user-select text
    - abstract
    - string bodyStumpTemplate
    - {tag}
    - {style}
    - {src}
    - bern
    - {content}
    - javascript
    - getTileFooterStumpCode() {
    - return this.getTileMenuButtonStumpCode()
    - }
    - async fetchTableInputs() {
    - return { rows: [{ text: this.getHtmlContent() }] }
    - }
    - getHtmlContent() {
    - return this.getWordsFrom(2).join(" ") || "No html content to show."
    - }
    - getTag() {
    - return this.getWord(1) || "div" // todo: verify this is legal tag.
    - }
    - getSrc() {
    - return this.getSettingsStruct().src
    - }
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, { tag: this.getTag(), style: this.style ? \`style \${this.style}\` : "", src: this.getSrc() ? \`src \${this.getSrc()}\` : "", content: this.getHtmlContent() || "" })
    - }
    - htmlTextNode
    - description Displays fixed text in the given HTML element.
    - cells tileKeywordCell htmlTextTagCell
    - catchAllCellType htmlCell
    - frequency .002
    - extends abstractHtmlNode
    - crux html.text
    - htmlPrintAsNode
    - description Displays input table in the given HTML element.
    - cells tileKeywordCell htmlTextTagCell
    - frequency .002
    - javascript
    - getHtmlContent() {
    - return this.getPipishInput()
    - }
    - extends abstractHtmlNode
    - crux html.printAs
    - abstractHTMLFixedTagTileNode
    - abstract
    - extends abstractHtmlNode
    - javascript
    - getHtmlContent() {
    - return this.getContent()
    - }
    - getTag() {
    - return this.htmlTagName
    - }
    - htmlH1Node
    - catchAllCellType htmlCell
    - description Displays an H1 Header with fixed text
    - example A title
    - html.h1 Hello world
    - frequency .002
    - string tileSize 600 75
    - string htmlTagName h1
    - string style text-align:center;
    - extends abstractHTMLFixedTagTileNode
    - crux html.h1
    - abstractHTMLContentIsSrcTileNode
    - abstract
    - extends abstractHTMLFixedTagTileNode
    - javascript
    - getHtmlContent() {
    - return ""
    - }
    - getSrc() {
    - return this.getContent() || super.getSrc()
    - }
    - htmlImgNode
    - description Displays an image from given url.
    - cells tileKeywordCell urlCell
    - frequency .002
    - string htmlTagName img
    - string style width:100%;
    - extends abstractHTMLContentIsSrcTileNode
    - crux html.img
    - htmlIframeNode
    - description Displays an iframe from given url.
    - cells tileKeywordCell urlCell
    - string htmlTagName iframe
    - extends abstractHTMLContentIsSrcTileNode
    - crux html.iframe
    - htmlCustomNode
    - description Display custom HTML.
    - example Hello world
    - html.custom
    - content
    -

    Hello world

    - inScope contentNode
    - extends abstractChartNode
    - crux html.custom
    - string bodyStumpTemplate
    - div
    - bern
    - {content}
    - javascript
    - getTileBodyStumpCode() {
    - // https://meta.stackexchange.com/questions/1777/what-html-tags-are-allowed-on-stack-exchange-sites
    - // todo: sanitize tags
    - const contentNode = this.getNode("content")
    - const content = contentNode ? contentNode.childrenToString() : "No HTML content to show"
    - return this.qFormat(this.bodyStumpTemplate, { content })
    - }
    - iconsIconNode
    - extends abstractChartNode
    - abstract
    - iconsHumanNode
    - description Assuming each row in your data represents a human, creates a human icon.
    - example
    - samples.patients
    - icons.human
    - inScope genderColumnNode headSizeNode
    - string columnPredictionHints
    - headSize isString=false
    - genderColumn isString=true
    - string bodyStumpTemplate
    - div
    - bern
    - {bern}
    - javascript
    - getTileBodyStumpCode() {
    - // Now, what if there is no input table?
    - const table = this.getParentOrDummyTable()
    - const rows = table.getRows()
    - // Now, what if we are using dummy input table?
    - const headSizeColumn = this.getSettingsStruct().headSize
    - const genderColumn = this.getSettingsStruct().genderColumn
    - const reducts = table.getColumnByName(headSizeColumn).getReductions()
    - const headColMax = reducts.max
    - const bern = rows
    - .map(row => {
    - const typedRow = row.rowToObjectWithOnlyNativeJavascriptTypes()
    - const value = typedRow[headSizeColumn]
    - // TODO: ADD TYPINGS
    - const genderVal = typedRow[genderColumn].toLowerCase()
    - const gender = genderVal === "male" ? "blue" : "pink"
    - let character = "O"
    - let percent = value / headColMax
    - if (isNaN(value)) {
    - character = "x"
    - percent = reducts.median / headColMax
    - }
    - const title = row.getHoverTitle()
    - percent = Math.round(18 * percent)
    - return \`\${character}\`
    - })
    - .join(" ")
    - return this.qFormat(this.bodyStumpTemplate, { bern: bern })
    - }
    - string dummyDataSetName patients
    - extends iconsIconNode
    - crux icons.human
    - iconsCircleNode
    - description Displays a simple icon for each row of your data.
    - example
    - samples.iris
    - icons.circle
    - radius Petal.Length
    - inScope radiusNode
    - string columnPredictionHints
    - radius isString=false
    - string dummyDataSetName playerGoals
    - extends iconsIconNode
    - crux icons.circle
    - string bodyStumpTemplate
    - div
    - bern
    - {bern}
    - javascript
    - getTileBodyStumpCode() {
    - const column = this.getSettingsStruct().radius
    - const bern = this.getParentOrDummyTable()
    - .getRows()
    - .map(row => \`O\`)
    - .join(" ")
    - return this.qFormat(this.bodyStumpTemplate, { bern: bern })
    - }
    - listBasicNode
    - catchAllCellType columnNameCell
    - description Show 1 column as a text list.
    - example List of world's telescopes
    - samples.telescopes
    - list.basic
    - inScope labelNode
    - string bodyStumpTemplate
    - ol
    - {items}
    - string listItemStumpTemplate
    - li
    - span {label}
    - javascript
    - _getListItem(label) {
    - return this.qFormat(this.listItemStumpTemplate, { label })
    - }
    - _getLabelColumnName() {
    - // todo: more automatic! Need to fix our columns/keywords issues
    - return this.getWord(1) || this.getSettingsStruct().label
    - }
    - getTileBodyStumpCode() {
    - const labelColumnName = this._getLabelColumnName()
    - const items = this.getRowsWithRowDisplayLimit()
    - .map(row => this._getListItem(jtree.Utils.stripHtml(row.getRowOriginalValue(labelColumnName)), row))
    - .join("\\n")
    - return this.qFormat(this.bodyStumpTemplate, { items })
    - }
    - string tileSize 400 400
    - string dummyDataSetName telescopes
    - string columnPredictionHints
    - label getTitlePotential
    - extends abstractChartNode
    - crux list.basic
    - listLinksNode
    - description Show 1 column as a list of links, using 1 column for the url.
    - catchAllCellType columnNameCell
    - example List of world's telescopes with links
    - samples.telescopes
    - list.links
    - inScope labelNode linkNode
    - string dummyDataSetName telescopes
    - string listItemHakonTemplate
    - li
    - a {label}
    - href {link}
    - javascript
    - _getUrlColumnName() {
    - // todo: more automatic! Need to fix our columns/keywords issues
    - return this.getWord(2) || this.getSettingsStruct().link
    - }
    - _getListItem(label, row) {
    - const urlColumnName = this._getUrlColumnName()
    - if (!urlColumnName) return super._getListItem(label, row)
    - return this.qFormat(this.listItemHakonTemplate, { label, link: jtree.Utils.stripHtml(row.getRowOriginalValue(urlColumnName)) })
    - }
    - string columnPredictionHints
    - label getTitlePotential
    - link isLink
    - extends listBasicNode
    - crux list.links
    - markdownToHtmlNode
    - description Displays Markdown rendered as HTML.
    - example Show a text editor and some rendered Markdown.
    - data.inline
    - parser text
    - content
    - # My header
    - ## My subheader
    -
    - Hello world
    - markdown.toHtml
    - inScope contentNode
    - string bodyStumpTemplate
    - div
    - class TileSelectable
    - bern
    - {md}
    - javascript
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, { md: marked(this.getPipishInput()) })
    - }
    - string tileSize 400 400
    - string dummyDataSetName markdown
    - extends abstractChartNode
    - crux markdown.toHtml
    - abstractRoughJsChartNode
    - description Create sketchy/hand-drawn styled charts https://github.com/jwilber/roughViz
    - string tileScript ohayo/packages/roughjs/roughviz.min.js
    - extends abstractChartNode
    - abstract
    - catchAllCellType titleCell
    - inScope roughnessNode
    - javascript
    - _getRoughId() {
    - return \`rough\${this._getUid()}\`
    - }
    - treeComponentDidUpdate() {
    - super.treeComponentDidUpdate()
    - if (this.isNodeJs()) return undefined
    - this._drawRough()
    - }
    - treeComponentDidMount() {
    - this.treeComponentDidUpdate()
    - }
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, { id: this._getRoughId() })
    - }
    - get _roughness() {
    - const value = this.get("roughness")
    - return value ? parseInt(value) : 1
    - }
    - _getOptions() {
    - return {}
    - }
    - _drawRough() {
    - const colors = this.get("colors") ? this.get("colors").split(" ") : undefined
    - const options = Object.assign(this._getOptions(), {
    - title: this.getContent() || "",
    - element: "#" + this._getRoughId(),
    - roughness: this._roughness,
    - width: this.getTileRunTimeWidth(),
    - height: this.getTileRunTimeHeight(),
    - colors,
    - data: this._getRoughData()
    - })
    - const roughEl = new roughViz[this.roughChartType](options)
    - }
    - _getValues(settingName) {
    - const columName = this.mapSettingNamesToColumnNames([settingName])[0]
    - return this.getParentOrDummyTable()
    - .getColumnByName(columName)
    - .getValues()
    - }
    - string bodyStumpTemplate
    - div
    - id {id}
    - abstractRoughJsLabelValueNode
    - extends abstractRoughJsChartNode
    - string dummyDataSetName stockPrice
    - abstract
    - string columnPredictionHints
    - value getPrimitiveTypeName=number
    - javascript
    - _getRoughData() {
    - const data = { labels: this._getValues("label"), values: this._getValues("value") }
    - console.log(data)
    - return data
    - }
    - roughJsBarNode
    - crux roughjs.bar
    - inScope labelNode valueNode
    - extends abstractRoughJsLabelValueNode
    - string roughChartType Bar
    - example
    - samples.waterBill
    - roughjs.bar Past Year's Water Bill
    - label PaidOn
    - value Amount
    - roughJsPieNode
    - inScope labelNode valueNode
    - crux roughjs.pie
    - extends abstractRoughJsLabelValueNode
    - string roughChartType Pie
    - roughJsLineNode
    - inScope colorsNode
    - crux roughjs.line
    - extends abstractRoughJsChartNode
    - string roughChartType Line
    - example
    - samples.waterBill
    - roughjs.line Water Bill
    - javascript
    - _getNumericColumns() {
    - return Object.values(this.getParentOrDummyTable().getColumnsMap()).filter(col => col.isNumeric())
    - }
    - _getRoughData() {
    - const data = {}
    - const numerics = this._getNumericColumns()
    - numerics.forEach(col => {
    - data[col.getColumnName()] = col.getValues()
    - })
    - return data
    - }
    - _getOptions() {
    - const options = {}
    - const numerics = this._getNumericColumns()
    - numerics.forEach((col, index) => {
    - options["y" + index] = col.getColumnName()
    - })
    - return options
    - }
    - abstractShowTileNode
    - cells tileKeywordCell columnNameCell
    - catchAllCellType titleCell
    - frequency .02
    - example A dashboard for a Seattle family's water bill.
    - samples.waterBill
    - hidden
    - vega.scatter
    - tables.basic
    - show.mean Amount
    - show.median Amount
    - show.sum Amount
    - show.min Amount
    - show.max Amount
    - string tileSize 140 120
    - string dummyDataSetName stockPrice
    - extends abstractChartNode
    - abstract
    - string hakonTemplate
    - .abstractShowTileNode
    - h3
    - text-align center
    - h6
    - text-align center
    - height 40px
    - overflow hidden
    - string bodyStumpTemplate
    - h6 {title}
    - h3 {number}
    - javascript
    - getTileBodyStumpCode() {
    - const columnName = this.getWord(1)
    - if (!columnName) return \`No data for \${this.getFirstWord()}\`
    - const table = this.getParentOrDummyTable()
    - const col = table.getTableColumnByName(columnName)
    - if (!col) {
    - console.log(\`No column named \${columnName}\`)
    - return ""
    - }
    - const reductionName = this.reductionName || this.getWord(0).split(".")[1]
    - const title = this.getWordsFrom(2).join(" ") || [columnName, reductionName].join(" ")
    - const number = this.toDisplayString(col.getReductions()[reductionName], columnName)
    - return this.qFormat(this.bodyStumpTemplate, { title, number })
    - }
    - showRowCountNode
    - catchAllCellType titleCell
    - description Show the total number of rows
    - frequency .02
    - string tileSize 140 120
    - string dummyDataSetName stockPrice
    - cells tileKeywordCell
    - extends abstractShowTileNode
    - string defaultTitle Total rows
    - crux show.rowCount
    - javascript
    - getTileBodyStumpCode() {
    - const title = this.getWordsFrom(1).join(" ") || this.defaultTitle
    - return this.qFormat(this.bodyStumpTemplate, { title, number: this._getNumber() })
    - }
    - _getNumber() {
    - return this.getParentOrDummyTable().getRowCount()
    - }
    - showColumnCountNode
    - extends showRowCountNode
    - string defaultTitle Total columns
    - description Show the total number of columns
    - crux show.columnCount
    - javascript
    - _getNumber() {
    - return this.getParentOrDummyTable().getColumnNames().length
    - }
    - showStaticNode
    - description Show a hard coded number
    - extends abstractShowTileNode
    - example
    - show.static 20 Sales
    - cells tileKeywordCell numberCell
    - catchAllCellType titleCell
    - crux show.static
    - javascript
    - getTileBodyStumpCode() {
    - const title = this.getWordsFrom(2).join(" ")
    - return this.qFormat(this.bodyStumpTemplate, { title, number: this.getWord(1) || "" })
    - }
    - showValueNode
    - description Show the value of a column with 1 row
    - extends abstractShowTileNode
    - crux show.value
    - string reductionName median
    - showMedianNode
    - description Show the median value of a column
    - extends abstractShowTileNode
    - crux show.median
    - showSumNode
    - description Show the sum of a column
    - extends abstractShowTileNode
    - crux show.sum
    - showMeanNode
    - description Show the mean of a column
    - extends abstractShowTileNode
    - crux show.mean
    - showMinNode
    - description Show the min value of a column
    - extends abstractShowTileNode
    - crux show.min
    - showMaxNode
    - description Show the max value of a column
    - extends abstractShowTileNode
    - crux show.max
    - tablesBasicNode
    - frequency .1
    - description Basic table with sorting.
    - example Basic table with Iris data
    - samples.iris
    - tables.basic
    - inScope columnLimitNode
    - int rowDisplayLimit 100
    - int columnLimit 20
    - string tileSize 750 300
    - todo added the below to allow custom body styling in tables
    - string customBodyStyle padding:0px;
    - string hakonTemplate
    - .tablesBasicNode
    - font-size 14px
    - box-sizing border-box
    - {enableTextSelect1}
    - table
    - width 100%
    - tr
    - white-space nowrap
    - padding 0
    - td
    - border 1px solid {lineColor}
    - tr:nth-child(even)
    - background-color {veryLightGrey}
    - td,th
    - padding 2px 3px
    - text-align left
    - overflow hidden
    - text-overflow ellipsis
    - max-width 250px
    - td:hover,th:hover
    - overflow visible
    - td:first-child,th:first-child
    - padding-left 5px
    - color {greyish}
    - width 60px
    - th
    - cursor pointer
    - background-color {lightGrey}
    - border 1px solid {lineColor}
    - border-bottom-color {greyish}
    - string cellStumpTemplate
    - td
    - bern
    - {content}
    - string cellLinkStumpTemplate
    - td
    - a
    - href {content}
    - bern
    - {content}
    - string rowStumpTemplate
    - tr
    - class tableRow
    - value {value}
    - td {number}
    - {cols}
    - javascript
    - _getTableRowsStumpCode(columns) {
    - return this.getRowsWithRowDisplayLimit()
    - .map((row, index) => {
    - const cols = columns
    - .map(column => {
    - return this.qFormat(column.isLink() ? this.cellLinkStumpTemplate : this.cellStumpTemplate, { content: row.getRowHtmlSafeValue(column.getColumnName()) })
    - })
    - .join("\\n")
    - return this.qFormat(this.rowStumpTemplate, { number: index + 1, value: row.getPuid(), cols })
    - })
    - .join("\\n")
    - }
    - _getHeaderRowsStumpCode(columns) {
    - // todo: can we get a copy column command?
    - return ["Row"]
    - .concat(columns)
    - .map(colName => this.qFormat(this.headerRowStumpTemplate, { colName }))
    - .join("\\n")
    - }
    - getTileBodyStumpCode() {
    - const tileStruct = this.getSettingsStruct()
    - const table = this.getParentOrDummyTable()
    - if (table.isBlankTable()) return \`div No data to show\`
    - let columnDefs = tileStruct.columnOrder === "importance" ? table.getColumnsByImportance() : table.getColumnsArray()
    - columnDefs = columnDefs.slice(0, tileStruct.columnLimit || this.columnLimit)
    - const columnNames = columnDefs.map(col => col.getColumnName())
    - // todo: if the types for a column are all equal, add a total row to the bottom.
    - // todo: if the types for a row are all equal, add a total column to the right.
    - const headerRows = this._getHeaderRowsStumpCode(columnNames)
    - const bodyRows = this._getTableRowsStumpCode(columnDefs)
    - return this.qFormat(this.bodyStumpTemplate, { headerRows, bodyRows })
    - }
    - string headerRowStumpTemplate
    - th
    - value {colName}
    - span {colName}
    - value {colName}
    - string bodyStumpTemplate
    - div
    - class tablesBasicNode
    - table
    - thead
    - {headerRows}
    - tbody
    - {bodyRows}
    - extends abstractChartNode
    - crux tables.basic
    - tablesInterestingNode
    - frequency .01
    - description Prints most interesting columns.
    - string columnOrder importance
    - extends tablesBasicNode
    - crux tables.interesting
    - tablesDumpNode
    - description Prints data with no formatting or column reordering.
    - frequency .01
    - string columnOrder default
    - extends tablesBasicNode
    - crux tables.dump
    - textWordcloudNode
    - description Turn text into a word cloud.
    - inScope columnNode countNode
    - example A poem analyzed
    - samples.poem
    - text.wordCount
    - text.wordcloud
    - string bodyStumpTemplate
    - div
    - class divWhereWordCloudWillGo
    - style height: 300px;
    - javascript
    - getTileBodyStumpCode() {
    - return this.bodyStumpTemplate
    - }
    - _getAllWords() {
    - return this.getRequiredTableWithHeader(["name", "count"])
    - }
    - treeComponentDidUpdate() {
    - this._draw()
    - }
    - treeComponentDidMount() {
    - this._draw()
    - }
    - _draw() {
    - if (this.isNodeJs()) return undefined
    - const tileStruct = this.getSettingsStruct()
    - const words = this._getAllWords()
    - if (!words.length) return
    - words.shift() // drop header
    - const shadow = this.getStumpNode().getShadow()
    - const width = shadow.getShadowOuterWidth()
    - const powConstant = 10 / Math.log(words.length) // breaks if too hgih.
    - const options = {
    - list: words.map(word => [word[0], word[1]]),
    - shuffle: false,
    - gridSize: Math.round((16 * width) / 1024),
    - weightFactor: size => (Math.pow(size, powConstant) * width) / 1024,
    - backgroundColor: "transparent",
    - random: jtree.Utils.makeSemiRandomFn(),
    - wait: 0
    - }
    - Object.assign(options, tileStruct)
    - const element = this.getStumpNode()
    - .findStumpNodeByChild("class divWhereWordCloudWillGo")
    - .getShadow()
    - .getShadowElement()
    - WordCloud(element, options)
    - }
    - string tileScript ohayo/packages/text/wordcloud2.min.js
    - string dummyDataSetName wordCounts
    - string columnPredictionHints
    - name isString=true
    - count isString=false
    - extends abstractChartNode
    - crux text.wordcloud
    - treenotation3dNode
    - description A 3D visualization of Ohayo source code.
    - example 3D vis of a Ohayo Program.
    - samples.treeProgram
    - treenotation.3d
    - inScope contentNode sizeNode cameraPositionNode
    - string tileSize 800 500
    - string tileScript ohayo/packages/treenotation/vis.min.js
    - string dummyDataSetName treeProgram
    - extends abstractChartNode
    - crux treenotation.3d
    - javascript
    - getTileBodyStumpCode() {
    - return \`div
    - class visjs\`
    - }
    - treeComponentDidMount() {
    - super.treeComponentDidMount()
    - this.treeComponentDidUpdate()
    - }
    - // Called when the Visualization API is loaded.
    - treeComponentDidUpdate() {
    - super.treeComponentDidUpdate()
    - if (this.isNodeJs()) return undefined
    - try {
    - this._tryVis()
    - } catch (err) {
    - // log error
    - console.error(err)
    - }
    - }
    - _tryVis() {
    - const tileStruct = this.getSettingsStruct()
    - const source = this.getPipishInput()
    - const app = this.getWebApp()
    - const program = new ohayoNode(source)
    - const rows = this._treeTo3D(program)
    - // Create and populate a data table.
    - const data = new vis.DataSet()
    - rows.forEach(row => data.add(row))
    - const dotSize = tileStruct.size
    - const showGrid = tileStruct.showGrid
    - // specify options
    - // docs: http://visjs.org/docs/graph3d/
    - const cameraPositionNode = this.getNode("cameraPosition") || new jtree.TreeNode("cameraPosition 4 .1 1.5").getNode("cameraPosition")
    - const distance = parseFloat(cameraPositionNode.getWord(1))
    - const horizontal = parseFloat(cameraPositionNode.getWord(2))
    - const vertical = parseFloat(cameraPositionNode.getWord(3))
    - const options = {
    - width: this.getTileRunTimeWidth() + "px",
    - height: this.getTileRunTimeHeight() - 80 + "px",
    - style: "dot-color", // dot?
    - showPerspective: false,
    - showLegend: false,
    - showShadow: false,
    - keepAspectRatio: true,
    - xStep: 1,
    - yStep: 1,
    - zStep: 1,
    - zMax: 5,
    - showGrid: true,
    - showZAxis: false,
    - showXAxis: false,
    - showYAxis: false,
    - dotSizeRatio: dotSize,
    - dotSizeMinFraction: 1,
    - cameraPosition: {
    - distance: distance,
    - horizontal: horizontal,
    - vertical: vertical
    - },
    - verticalRatio: 1.0,
    - // parameter point contains properties x, y, z, and data
    - // data is the original object passed to the point constructor
    - tooltip: point => point.data.line
    - }
    - // create a graph3d
    - const element = this.getStumpNode()
    - .findStumpNodeByChild("class visjs")
    - .getShadow()
    - .getShadowElement()
    - this._graph3d = new vis.Graph3d(element, data, options)
    - const throttled = lodash.throttle(evt => this._onCameraPositionChange(evt), 100)
    - this._graph3d.on("cameraPositionChange", throttled)
    - }
    - async _onCameraPositionChange(evt) {
    - // todo: throttle
    - const pos = this._graph3d.getCameraPosition()
    - const str = \`\${pos.distance} \${pos.horizontal} \${pos.vertical}\`
    - this.touchNode("cameraPosition").setContent(str)
    - await this.getTab().autosaveTab()
    - }
    - _treeTo3D(program) {
    - // getCameraPosition
    - // setCameraPosition
    - // onCameraPositionChange
    - const theme = this.getWebApp().getTheme()
    - // todo: use node type for color.
    - const tagMap = {}
    - const tagTree = new jtree.TreeNode(program.toCellTypeTree())
    - // const outlineFn = node => node.getIndex()
    - // use language to get dict, use dict to get type overlay to get tag types.
    - const randomFn = jtree.Utils.makeSemiRandomFn()
    - const makeColor = word => {
    - if (!tagMap[word]) tagMap[word] = randomFn() // todo: give word types certain colors. green for keword, red for error, etc
    - const color = tagMap[word]
    - //console.log(color)
    - return color
    - }
    - const points = []
    - const nodeToPoint = (node, index) => {
    - const nodePath = node.getPathVector(program)
    - const tagNode = tagTree.nodeAt(nodePath)
    - node.getWords().forEach((word, wordIndex) => {
    - const wordType = tagNode.getWord(wordIndex)
    - const colorNumber = makeColor(wordType)
    - const xcc = node.getIndentLevel(program) + wordIndex
    - const ycc = -node.getLineNumber()
    - const zcc = 0
    - points.push({
    - x: xcc,
    - y: ycc,
    - z: zcc,
    - line: \`cellType: \${wordType} | word: \${word}\`,
    - style: colorNumber
    - })
    - })
    - }
    - program.getTopDownArray().forEach(nodeToPoint)
    - return points
    - }
    - treenotationOutlineNode
    - description A simple pretty text-only view of a Tree Notation document.
    - example Outer space
    - samples.outerSpace
    - treenotation.outline
    - string dummyDataSetName outerSpace
    - string tileSize 800 500
    - extends abstractChartNode
    - crux treenotation.outline
    - string bodyStumpTemplate
    - pre
    - style overflow: scroll; width: 100%; height: 100%; margin: 0; box-sizing: border-box; font-family: monospace; line-height: 13px;
    - bern
    - {bern}
    - javascript
    - _getTheBern() {
    - return new jtree.TreeNode(this.getPipishInput()).toOutline()
    - }
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, { bern: this._getTheBern() })
    - }
    - treenotationDotlineNode
    - description A simple pretty icon-only visualization of the structure of a Tree Notation doc.
    - example Outer space
    - samples.outerSpace
    - treenotation.dotline
    - boolean dots true
    - string dummyDataSetName outerSpace
    - javascript
    - _getTheBern() {
    - return new jtree.TreeNode(this.getPipishInput()).toMappedOutline(
    - node =>
    - "o" +
    - node
    - .getLine()
    - .split(" ")
    - .map(word => "º")
    - .join("")
    - )
    - }
    - extends treenotationOutlineNode
    - crux treenotation.dotline
    - abstractVegaNode
    - frequency .1
    - catchAllCellType titleCell
    - string tileSize 800 300
    - string tileScript ohayo/packages/vega/vega.combined.min.js
    - string dummyDataSetName stockPrice
    - string markName bar
    - extends abstractChartNode
    - abstract
    - string bodyStumpTemplate
    - div
    - class divForExternalLibrary
    - javascript
    - // todo: I don't think vega handles . in column names.
    - getTileBodyStumpCode() {
    - return this.bodyStumpTemplate
    - }
    - _getColumnToField(columnName) {
    - if (!columnName) return undefined
    - const columnsMap = this.getParentOrDummyTable().getColumnsMap()
    - const col = columnsMap[columnName]
    - const obj = { field: columnName, type: col.getVegaType() }
    - if (col.isTemporal()) {
    - const timeUnit = col.getVegaTimeUnit()
    - if (timeUnit) obj.timeUnit = timeUnit
    - }
    - return obj
    - }
    - _getElementForVega() {
    - return this.getStumpNode()
    - .findStumpNodeByChild("class divForExternalLibrary")
    - .getShadow()
    - .getShadowElement()
    - }
    - async _drawVega() {
    - // todo: don't rerun this if we dont need to.
    - await vegaEmbed(this._getElementForVega(), this._getVegaSpec())
    - }
    - treeComponentDidUpdate() {
    - super.treeComponentDidUpdate()
    - if (this.isNodeJs()) return undefined
    - this._drawVega()
    - }
    - treeComponentDidMount() {
    - this.treeComponentDidUpdate()
    - }
    - _getVegaData() {
    - return {
    - values: this.getParentOrDummyTable()
    - .cloneNativeJavascriptTypedRows()
    - .slice(0, this._getRowDisplayLimit())
    - }
    - }
    - _getVegaTitle() {
    - return this.getContent()
    - }
    - _getVegaSpec() {
    - return {
    - description: "A simple bar chart with embedded data.",
    - data: this._getVegaData(),
    - width: this.getTileRunTimeWidth(),
    - height: this.getTileRunTimeHeight(),
    - mark: this._getVegaMarkObj(),
    - encoding: this._getEncodingMap(),
    - transform: this._getVegaTransform(),
    - title: this._getVegaTitle(),
    - config: this._getVegaConfig()
    - }
    - }
    - _getVegaTransform() {
    - return undefined
    - }
    - _getVegaConfig() {
    - return undefined
    - }
    - _getEncodingMap() {
    - return {}
    - }
    - // todo: add type
    - _getVegaMarkObj() {
    - return { type: this._getVegaMark(), tooltip: { content: "data" } }
    - }
    - _getVegaMark() {
    - return this.markName
    - }
    - vegaBarNode
    - description A bar chart
    - inScope xColumnNode yColumnNode colorColumnNode shapeColumnNode
    - javascript
    - _getEncodingMap() {
    - const columnNames = this.mapSettingNamesToColumnNames([this.xColumnKey, this.yColumnKey, this.colorColumnKey])
    - return {
    - x: this._getColumnToField(columnNames[0]),
    - y: this._getColumnToField(columnNames[1]),
    - color: this._getColumnToField(columnNames[2])
    - }
    - }
    - string columnPredictionHints
    - xColumn
    - yColumn isString=false,!xColumn
    - extends abstractVegaNode
    - crux vega.bar
    - vegaLineNode
    - description A line chart
    - string markName line
    - extends vegaBarNode
    - crux vega.line
    - vegaAreaNode
    - description An area chart
    - string markName area
    - extends vegaLineNode
    - crux vega.area
    - vegaScatterNode
    - description A scatterplot
    - string markName point
    - extends vegaBarNode
    - crux vega.scatter
    - javascript
    - _getEncodingMap() {
    - const columnNames = this.mapSettingNamesToColumnNames([this.xColumnKey, this.yColumnKey, this.colorColumnKey, this.shapeColumnKey])
    - return {
    - x: this._getColumnToField(columnNames[0]),
    - y: this._getColumnToField(columnNames[1]),
    - color: this._getColumnToField(columnNames[2]),
    - shape: this._getColumnToField(columnNames[3])
    - }
    - }
    - vegaBubbleNode
    - description A bubble plot
    - inScope sizeColumnNode colorColumnNode
    - string markName circle
    - string dummyDataSetName gapMinder
    - string columnPredictionHints
    - sizeColumn isString=false
    - xColumn isString=false
    - extends vegaScatterNode
    - crux vega.bubble
    - javascript
    - _getEncodingMap() {
    - const columnNames = this.mapSettingNamesToColumnNames([this.xColumnKey, this.yColumnKey, this.sizeColumnKey, this.colorColumnKey])
    - return {
    - y: {
    - field: columnNames[1],
    - type: "quantitative",
    - scale: { zero: false },
    - axis: { minExtent: 30 }
    - },
    - x: this._getColumnToField(columnNames[0]),
    - size: { field: columnNames[2], type: "quantitative" },
    - color: { value: "#000" }
    - }
    - }
    - vegaEmojiNode
    - description A bar chart with emojis
    - frequency .001
    - inScope yColumnNode emojiColumnNode
    - string columnPredictionHints
    - emojiColumn isString=true
    - yColumn isString=false
    - string dummyDataSetName emojis
    - javascript
    - _getVegaConfig() {
    - return { view: { stroke: "" } }
    - }
    - _getVegaMark() {
    - return { type: "text", baseline: "middle" }
    - }
    - _getEncodingMap() {
    - const columnNames = this.mapSettingNamesToColumnNames([this.yColumnKey, "emoji"])
    - return {
    - x: { field: columnNames[1], type: "nominal", axis: null },
    - y: { field: columnNames[0], type: "quantitative", axis: null, sort: null },
    - text: { field: columnNames[1], type: "nominal" },
    - size: { value: 65 }
    - }
    - }
    - extends vegaBarNode
    - crux vega.emoji
    - vegaHistogramNode
    - description A histogram
    - inScope xColumnNode
    - javascript
    - _getEncodingMap() {
    - const columnName = this.getContent() || this.mapSettingNamesToColumnNames([this.xColumnKey])[0]
    - return {
    - x: {
    - bin: true,
    - field: columnName,
    - type: "quantitative"
    - },
    - y: {
    - aggregate: "count",
    - type: "quantitative"
    - }
    - }
    - }
    - string columnPredictionHints
    - xColumn isString=false
    - string dummyDataSetName wordCounts
    - extends abstractVegaNode
    - crux vega.histogram
    - vegaExampleNode
    - description Shows a chart from the Vega Example Gallery
    - frequency .001
    - cells tileKeywordCell vegaExampleNameCell
    - example
    - vega.example trellis_anscombe
    - extends abstractVegaNode
    - crux vega.example
    - javascript
    - _getVegaSpec() {
    - return this._spec
    - }
    - async _fetchSpec() {
    - // todo: localtesting.
    - if (this.isNodeJs()) return undefined
    - const exampleName = this.getContent() || "area" // todo: pull this default from the gram?
    - const url = \`ohayo/packages/vega/ignore/vega-lite/examples/compiled/\${exampleName}.vg.json\`
    - const res = await this.getWebApp()
    - .getWillowBrowser()
    - .httpGetUrl(url)
    - const spec = JSON.parse(res.text)
    - // rewrite data urls
    - spec.data.forEach(row => {
    - if (row.url) row.url = row.url.replace("data/", "packages/vega/datasets/")
    - })
    - this._spec = spec
    - return spec
    - }
    - // todo: clean this up.
    - async fetchTableInputs() {
    - const spec = await this._fetchSpec()
    - if (this.isNodeJs()) return { rows: [] }
    - const el = jQuery("
    ")[0]
    - const embedded = await vegaEmbed(el, spec)
    - const rows = await this._getVegaPostTransformOutputRows(spec, embedded)
    - return { rows: rows }
    - }
    - async _getVegaPostTransformOutputRows(spec, embedded) {
    - const tableName = spec.data[0] && spec.data[0].name
    - if (tableName) return embedded.view.data(tableName)
    - // const values = spec.data.values
    - // if (values && values.entries) return Array.from(values.entries())
    - // if (typeof values === "function") return []
    - // else if (values) return values
    - return []
    - }
    - DidYouMeanTileNode
    - tags noPicker
    - description Provides suggestions for misspelled tiles.
    - extends abstractTileTreeComponentNode
    - crux tiles.didyoumean
    - string bodyStumpTemplate
    - div
    - span No tile '{input}' found. Line {lineNo}. Did you mean
    - a {closestTile}
    - collapse
    - tabindex -1
    - value {closestTile}
    - clickCommand changeTileTypeCommand
    - span ?
    - javascript
    - getTileBodyStumpCode() {
    - const input = this.getFirstWord()
    - const lineNo = this.getLineNumber()
    - const closestTile = jtree.Utils.didYouMean(
    - input,
    - this.getRootNode()
    - .getHandGrammarProgram()
    - .getTopNodeTypeDefinitions()
    - .map(def => def.get("crux"))
    - )
    - if (!closestTile) {
    - if (!input) return \`div Your program has a blank line on line \${lineNo}.\`
    - return \`div No tile '\${input}' found.\`
    - }
    - return this.qFormat(this.bodyStumpTemplate, { input, lineNo, closestTile })
    - }
    - getErrors() {
    - return [new jtree.UnknownNodeTypeError(this)]
    - }
    - abstractDocTileNode
    - tags noPicker
    - cells tileKeywordCell
    - extends abstractTileTreeComponentNode
    - abstract
    - string bodyStumpTemplate
    - {tagName}
    - bern
    - {content}
    - string tileStumpTemplate
    - div
    - class {classes}
    - id {id}
    - div
    - class TileBody
    - {body}
    - div
    - class TileFooter
    - {footer}
    - javascript
    - _getBody() {
    - return this.qFormat(this.bodyStumpTemplate, { content: this.getContent() || "", tagName: this.tagName })
    - }
    - toStumpCode() {
    - return this.qFormat(this.tileStumpTemplate, { classes: this.getCssClassNames().join(" "), footer: this.getTileMenuButtonStumpCode(), id: this.getTreeComponentId(), body: this._getBody() })
    - }
    - docTitleNode
    - catchAllCellType stringCell
    - description A title
    - example A doc
    - doc.title A Tale of Two Cities
    - string tileSize 600 75
    - extends abstractDocTileNode
    - cells tileKeywordCell
    - crux doc.title
    - string tagName h1
    - docSubtitleNode
    - extends docTitleNode
    - description A subheader
    - string tagName h2
    - crux doc.subtitle
    - docSectionNode
    - description A section containing subtitles, paragraphs, code blocks, etc.
    - crux doc.section
    - extends abstractDocTileNode
    - inScope abstractDocSectionComponentNode
    - javascript
    - _getBody() {
    - return this.compile()
    - }
    - _getCompiledLine() {
    - return ""
    - }
    - example
    - doc.section
    - subtitle Subtitle
    - paragraph Paragraph
    - code python
    - # some code
    - docReferenceNode
    - extends abstractDocTileNode
    - crux doc.ref
    - cells tileKeywordCell referenceIdCell
    - inScope docReferenceUrlNode
    - string tagName p
    - example
    - doc.ref someRefId
    - url https://en.wikipedia.org/wiki/Note_(typography)
    - description A reference to an external source
    - docCommentNode
    - description A comment node
    - cells commentKeywordCell
    - extends abstractTileTreeComponentNode
    - boolean visible false
    - frequency 0
    - example An example program with comments
    - doc.comment get iris data
    - samples.iris
    - doc.comment filter is
    - filter.where Species = virginica
    - doc.comment display results
    - tables.basic
    - catchAllCellType commentCell
    - catchAllNodeType commentLineNode
    - crux doc.comment
    - docToolingNode
    - extends docCommentNode
    - crux doc.tooling
    - abstractProviderNode
    - string tileSize 140 60
    - extends abstractTileTreeComponentNode
    - abstract
    - string tileStumpTemplate
    - div
    - class {classes}
    - id {id}
    - div
    - class TileBody
    - {body}
    - div
    - class TileFooter
    - {footer}
    - string tileFooterTemplate
    - span Rows Out: {outputCount} Columns Out: {columnCount} Time: {time}s Parser: {parserId} {errorMessageHtml}
    - {tileMenuButton}
    - javascript
    - getTileFooterStumpCode() {
    - const table = this.getOutputOrInputTable()
    - const time = (this.getTimeToLoad() / 1000).toFixed(1)
    - const parserId = this.getParserId() || "?"
    - return this.qFormat(this.tileFooterTemplate, {
    - parserId,
    - errorMessageHtml: this.getErrorMessageHtml() || "",
    - time,
    - outputCount: table.getRowCount(),
    - columnCount: table.getColumnCount(),
    - tileMenuButton: this.getTileMenuButtonStumpCode()
    - })
    - }
    - getRowClass() {
    - return Row
    - }
    - getTileBodyStumpCode() {
    - const description = this._getDescription()
    - return "div " + (description ? jtree.Utils.linkify(description) : "")
    - }
    - _getDescription() {
    - return this.getDefinition().get("description")
    - }
    - toStumpCode() {
    - return this.qFormat(this.tileStumpTemplate, { classes: this.getCssClassNames().join(" "), id: this.getTreeComponentId(), body: this._getBodyStumpCodeCache(), footer: this.getTileFooterStumpCode() })
    - }
    - getParserId() {
    - return this.getSettingsStruct().parser
    - }
    - async fetchTableInputs() {
    - return {
    - rows: []
    - }
    - }
    - async _execute() {
    - const timeLoadStarted = this._getProcessTimeInMilliseconds()
    - this._timeLastLoadStarted = timeLoadStarted
    - const fetchedTableInputs = await this.fetchTableInputs()
    - // If a new request happened after this one, abort this one.
    - // todo: what happens to children?
    - // todo: add testing for this.
    - if (this._timeLastLoadStarted !== timeLoadStarted) {
    - console.log("superceded")
    - return null
    - }
    - this._outputTable = new Table(fetchedTableInputs.rows, fetchedTableInputs.columnDefinitions, this.getRowClass())
    - this._timeToLoad = this._getProcessTimeInMilliseconds() - timeLoadStarted
    - this.setIsDataLoaded(true)
    - await this._executeChildNodes()
    - }
    - abstractUrlNoCellsNode
    - boolean useCache true
    - inScope parserNode useCacheNode
    - string tileSize 300 150
    - extends abstractProviderNode
    - abstract
    - javascript
    - getUrl() {
    - const struct = Object.assign(this.getSettingsStruct(), this.getDefinition().getConstantsObject())
    - if (struct.urlTemplate && this.getContent()) return new jtree.TreeNode({ content: this.getContent() }).evalTemplateString(struct.urlTemplate)
    - if (struct.urlPrefix && this.getContent()) return struct.urlPrefix + this.getContent()
    - return struct.urlCell || this.getContent() || this.url || ""
    - }
    - getParserId() {
    - if (this.parser) return this.parser
    - const url = this.getUrl()
    - if (super.getParserId()) return super.getParserId()
    - const extension = jtree.Utils.getFileExtension(url)
    - if (new TableParser().getAllTableParserIds().includes(extension)) return extension
    - }
    - getWillowHttpResponse() {
    - return this._willowHttpResponse
    - }
    - _setWillowHttpResponse(willowHttpResponse) {
    - this._willowHttpResponse = willowHttpResponse
    - return this
    - }
    - // todo: add support for Arrow.
    - // todo: remove this cache. use higher level.
    - async _getData(url) {
    - const useCache = this.getSettingsStruct().useCache !== "false" || this.useCache
    - const willowBrowser = this.getWebApp().getWillowBrowser()
    - let response
    - if (useCache) response = await willowBrowser.httpGetUrlFromCache(url)
    - else response = await willowBrowser.httpGetUrl(url)
    - if (response.fromCache)
    - this.emitLogMessage(\`div
    - bern
    - Loading from cache: \${url}\`)
    - this._setWillowHttpResponse(response)
    - return response.getParsedDataOrText()
    - }
    - async fetchTableInputs() {
    - let url = this.getUrl()
    - if (!url) return { rows: [] }
    - url = encodeURI(url)
    - const parserId = this.getParserId()
    - this.setRunTimePhaseError("fetchUrl")
    - try {
    - const data = await this._getData(url)
    - const parser = new TableParser()
    - if (typeof data === "string") return parser.parseTableInputsFromString(data, parserId)
    - if (this.jsonPath) return parser.parseTableInputsFromObject(data[this.jsonPath], parserId)
    - return parser.parseTableInputsFromObject(data, parserId)
    - } catch (err) {
    - // todo: solve the superagent not throwing response message thing.
    - const txt = (err.text || err.toString()).substr(0, 280)
    - this.emitLogMessage(\`Error getting url: \${url}
    - \${txt}\`)
    - this.setRunTimePhaseError("fetchUrl", txt)
    - return { rows: [] }
    - }
    - }
    - abstractUrlNode
    - cells tileKeywordCell urlCell
    - string tileSize 300 100
    - extends abstractUrlNoCellsNode
    - abstract
    - abstractUrlsNode
    - extends abstractUrlNode
    - javascript
    - getUrls() {
    - return this.getWordsFrom(1).map(url => (this.urlPrefix || "") + url)
    - }
    - async fetchTableInputs() {
    - // todo: allow cache breaking.
    - const app = this.getWebApp()
    - const willowBrowser = app.getWillowBrowser()
    - let allResults = []
    - const urls = this.getUrls()
    - const fetchMethod = async url => (app.isUrlGetProxyAvailable() ? willowBrowser.httpGetUrlFromProxyCache(url) : willowBrowser.httpGetUrlFromCache(url))
    - for (let url of urls) {
    - const response = await fetchMethod(url)
    - allResults.push(response)
    - }
    - return { rows: allResults.map(res => res.asJson) }
    - }
    - githubInfoNode
    - frequency .01
    - tags internetConnectionRequired
    - extends abstractUrlsNode
    - string dataDomain github.com
    - catchAllCellType githubRepoCell
    - cells tileKeywordCell
    - description Get basic information on a GitHub repo(s)
    - string urlPrefix https://api.github.com/repos/
    - crux github.info
    - diskBrowseNode
    - frequency .01
    - tags localVersion
    - catchAllCellType pathCell
    - description An interactive list of files and folders.
    - string hakonTemplate
    - .DiskTile
    - table
    - width 100%
    - td,th
    - overflow hidden
    - text-overflow ellipsis
    - tr
    - white-space nowrap
    - javascript
    - getUrl() {
    - return this.getContent() ? "/disk?path=" + this.getContent() : "/disk"
    - }
    - getTileBodyStumpCode() {
    - const labelCol = "name"
    - const path = this.getContent() || ""
    - const parentPath = path.replace(/\\/[^\\/]*$/, "")
    - const rowDisplayLimit = 1000 // todo: adjustable?
    - let rows = this.getOutputTable()
    - .getRows()
    - .slice(0, rowDisplayLimit)
    - rows = lodash.sortBy(rows, row => row.getRowOriginalValue("isDirectory") === "false")
    - return \`input
    - placeholder Filepath
    - value \${path}
    - changeCommand changeTileContentAndRenderCommand
    - class LargeTileInput
    - table
    - tr
    - td
    - a ..
    - clickCommand changeTileContentAndRenderCommand
    - value \${parentPath}
    - \${rows
    - .map(row => {
    - const label = jtree.Utils.stripHtml(row.getRowOriginalValue(labelCol))
    - const isDir = row.getRowOriginalValue("isDirectory") === "true"
    - const size = row.getRowOriginalValue("bytes")
    - const mtime = row.getRowOriginalValue("mtime")
    - if (!isDir)
    - return \` tr
    - td \${label}
    - td \${numeral(size).format("0.0 b")}
    - td \${moment(parseFloat(mtime)).fromNow()}\`
    - return \` tr
    - td
    - a \${label}
    - clickCommand changeTileContentAndRenderCommand
    - value \${path.replace(/\\/$/, "") + "/" + label}\`
    - })
    - .join("\\n")}\`
    - }
    - string tileSize 500 500
    - extends abstractUrlNode
    - crux disk.browse
    - diskReadNode
    - frequency .01
    - tags localVersion
    - description Reads a file from disk.
    - string urlPrefix /disk.read?path=
    - extends abstractUrlNode
    - crux disk.read
    - abstractHackernewsNode
    - frequency .01
    - tags internetConnectionRequired
    - extends abstractUrlNode
    - string dataDomain news.ycombinator.com
    - abstract
    - hackernewsTopNode
    - cells tileKeywordCell quantityCell
    - description Get the top stories on hackernews
    - example A dashboard of the Hacker News homepage.
    - hackernews.top 10
    - rows.sortBy by
    - tables.basic
    - vega.scatter
    - xColumn time
    - yColumn score
    - javascript
    - async fetchTableInputs() {
    - // todo: allow cache breaking.
    - const willowBrowser = this.getWebApp().getWillowBrowser()
    - const firstUrls = this._getFirstUrls()
    - if (!firstUrls.length || this.isNodeJs()) return []
    - let allResults = []
    - const fetchMethod = async url => (this.getWebApp().isUrlGetProxyAvailable() ? willowBrowser.httpGetUrlFromProxyCache(url) : willowBrowser.httpGetUrlFromCache(url))
    - for (let mainUrl of firstUrls) {
    - const response = await fetchMethod(mainUrl)
    - const nextUrls = this._parseNextUrls(response)
    - const batchResults = await Promise.all(nextUrls.slice(0, this._getLimit()).map(url => fetchMethod(url)))
    - allResults = allResults.concat(batchResults)
    - }
    - return { rows: allResults.map(res => res.asJson) }
    - }
    - _getLimit() {
    - return parseInt(this.getContent() || 10)
    - }
    - _parseNextUrls(response) {
    - return response.asJson.map(id => \`https://hacker-news.firebaseio.com/v0/item/\${id}.json?print=pretty\`)
    - }
    - _getFirstUrls() {
    - return ["https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"]
    - }
    - extends abstractHackernewsNode
    - crux hackernews.top
    - hackernewsSubmissionsNode
    - description Get a user's comments and submissions
    - cells tileKeywordCell quantityCell
    - catchAllCellType hackerNewsUserNameCell
    - example View a users comment and story submissions
    - hackernews.submissions 100 breck
    - tables.basic
    - filter.where type = story
    - vega.scatter Stories
    - xColumn time
    - yColumn score
    - filter.where type = comment
    - vega.scatter Comments
    - xColumn time
    - yColumn score
    - javascript
    - _getFirstUrls() {
    - return this.getWordsFrom(2).map(username => \`https://hacker-news.firebaseio.com/v0/user/\${username}.json?print=pretty\`)
    - }
    - _getLimit() {
    - return parseInt(this.getWord(1) || 10)
    - }
    - _parseNextUrls(response) {
    - return response.asJson.submitted.map(id => \`https://hacker-news.firebaseio.com/v0/item/\${id}.json?print=pretty\`)
    - }
    - extends hackernewsTopNode
    - crux hackernews.submissions
    - publicApisNode
    - frequency .01
    - tags internetConnectionRequired
    - extends abstractUrlNode
    - string dataDomain publicapis.org
    - cells tileKeywordCell
    - description Get all public APIs
    - string url https://api.publicapis.org/entries
    - crux publicapis.entries
    - string parser json
    - string jsonPath entries
    - webGetNode
    - description Get a URL and parse the fetched data.
    - example Fetch a TSV from the web and show results
    - web.get https://raw.githubusercontent.com/treenotation/ohayo/master/ohayo/packages/samples/iris.tsv
    - tables.basic
    - frequency .1
    - string placeholderMessage Enter a url.
    - string bodyStumpTemplate
    - span {kind}
    - class LargeLabel
    - input
    - value {content}
    - placeholder {placeholderMessage}
    - changeCommand changeTileContentAndRenderCommand
    - class LargeTileInput
    - javascript
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, { kind: this.getFirstWord(), content: this.getContent() || "", placeholderMessage: this.placeholderMessage })
    - }
    - string tileSize 400 100
    - extends abstractUrlNode
    - crux web.get
    - webPostNode
    - frequency .02
    - description Post data to a URL and parse the returned data.
    - inScope postNode
    - string webPostBodyStumpTemplate
    - textarea
    - bern
    - {post}
    - placeholder This data will be sent as the value of the 'q' param
    - name post
    - changeCommand changeTileSettingMultilineCommand
    - class TileTextArea
    - javascript
    - getTileBodyStumpCode() {
    - return super.getTileBodyStumpCode() + this.qFormat(this.webPostBodyStumpTemplate, { post: jtree.Utils.stripHtml(this.getSettingsStruct().post || "") })
    - }
    - async _getData(url) {
    - const settings = this.getSettingsStruct()
    - // todo, but make a separate tile
    - // if (settings.pushButton) {
    - // if (!settings.pushed) return ""
    - // settings.pushed = false
    - // }
    - const postData = settings.post || ""
    - const res = await this.getWebApp()
    - .getWillowBrowser()
    - .httpPostUrl(url, { q: postData.trim() })
    - this._setWillowHttpResponse(res)
    - return res.getParsedDataOrText()
    - }
    - string tileSize 400 130
    - extends abstractUrlNode
    - crux web.post
    - wikipediaContentNode
    - frequency .01
    - tags internetConnectionRequired
    - extends abstractUrlNode
    - string dataDomain wikipedia.org
    - catchAllCellType wikipediaPermalinkCell
    - cells tileKeywordCell
    - description Get content of a wikipedia page(s)
    - javascript
    - getUrl() {
    - return this.urlPrefix + this.wikipediaPermalinkCell.join("|")
    - }
    - async fetchTableInputs() {
    - const inputs = await super.fetchTableInputs()
    - // todo: cleanup
    - return { rows: Object.values(inputs.rows[0].query.pages) }
    - }
    - string urlPrefix https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro&explaintext&redirects=1&origin=*&titles=
    - crux wikipedia.page
    - abstractFixedDatasetFromUrlNode
    - description A dataset that generally is fixed and will never change.
    - extends abstractUrlNoCellsNode
    - abstract
    - javascript
    - _getDescription() {
    - const desc = super._getDescription()
    - if (this.dataUrl) return (desc ? desc + " from " : "") + this.dataUrl
    - return desc
    - }
    - abstractFixedDatasetFromOhayoCollectionNode
    - description A dataset that ships with Ohayo.
    - string tileSize 300 150
    - javascript
    - async _getData(url) {
    - if (!this.isNodeJs()) return super._getData(url)
    - const fs = require("fs")
    - const filepath = __dirname + "/../" + url
    - return fs.readFileSync(filepath, "utf8")
    - }
    - extends abstractFixedDatasetFromUrlNode
    - abstract
    - cancerCasesNode
    - description Estimated new cancer cases in the U.S. in 2019 from https://cancerstatisticscenter.cancer.org/
    - string url ohayo/packages/cancer/cases.csv
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux cancer.cases
    - abstractCdcInfantPercentileNode
    - boolean isDataPublicDomain true
    - string dataUrl https://www.cdc.gov/growthcharts/percentile_data_files.htm
    - abstract
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - weightPercentilesNode
    - description Weight percentiles for birth to 36 months in kilograms, by sex and age
    - string url ohayo/packages/cdc/wtageinf.csv
    - extends abstractCdcInfantPercentileNode
    - crux cdc.infants.weight
    - lengthPercentilesNode
    - description Length percentiles for birth to 36 months in centimeters, by sex and age
    - string url ohayo/packages/cdc/lenageinf.csv
    - extends abstractCdcInfantPercentileNode
    - crux cdc.infants.length
    - headPercentilesNode
    - description Head circumference percentiles for birth to 36 months in centimeters, by sex and age
    - string url ohayo/packages/cdc/hcageinf.csv
    - extends abstractCdcInfantPercentileNode
    - crux cdc.infants.headCircumference
    - kaggleDatasetsHeartNode
    - tags internetConnectionRequired
    - description Heart Disease dataset from https://www.kaggle.com/ronitf/heart-disease-uci
    - string url ohayo/packages/kaggle/heart.csv
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux kaggle.datasets.heart
    - mozTop500Node
    - description Moz's list of the most popular 500 websites on the internet.
    - string dataUrl https://moz.com/top500
    - boolean isDataPublicDomain true
    - string url ohayo/packages/moz/top500Domains.csv
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux moz.top500
    - lifeExpectancyNode
    - description Life expectancy data.
    - string url ohayo/packages/owid/life-expectancy.csv
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux owid.lifeExpectancy
    - owidListNode
    - string parser treeRows
    - description Gets all datasets on Our World in Data.
    - string url ohayo/packages/owid/owid.tree
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux owid.list
    - samplesTelescopesNode
    - description A partial list of humankind's largest telescopes.
    - string dataDescription
    - ## Provenance
    - This list was put together by a group of remote workers in a Google spreadsheet in 2017 and hasn't been updated in a while.
    - boolean isDataPublicDomain true
    - string dataUrl https://github.com/treenotation/ohayo/blob/master/ohayo/packages/samples/telescopes.tsv
    - tags astronomy
    - frequency .03
    - example Display list of links to telescope websites.
    - samples.telescopes
    - list.links Name Url
    - string url ohayo/packages/samples/telescopes.tsv
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux samples.telescopes
    - samplesMtcarsNode
    - description Dataset from 1974 Motor Trend US magazine.
    - boolean isDataPublicDomain true
    - string dataUrl https://stat.ethz.ch/R-manual/R-devel/library/datasets/html/mtcars.html
    - frequency .03
    - string url ohayo/packages/samples/mtcars.tsv
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux samples.mtcars
    - samplesIrisNode
    - description The famous Iris flower data set.
    - string dataUrl https://archive.ics.uci.edu/ml/datasets/iris
    - boolean isDataPublicDomain true
    - frequency .15
    - string url ohayo/packages/samples/iris.tsv
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux samples.iris
    - samplesFlights14Node
    - description On-Time flights data from the Bureau of Transportation Statistics for all the flights that departed from New York City airports in 2014. The data is available only for Jan-Oct'14.
    - string dataUrl https://github.com/Rdatatable/data.table/blob/master/vignettes/flights14.csv
    - boolean isDataPublicDomain true
    - string url ohayo/packages/samples/flights14-sample.csv
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux samples.flights14
    - samplesSiNode
    - description A description of The International System of Units (SI) aka the metric system.
    - boolean isDataPublicDomain true
    - string dataUrl https://github.com/treenotation/ohayo/blob/master/ohayo/packages/samples/si.tree
    - example View outline of SI system.
    - samples.si
    - treenotation.outline
    - frequency .03
    - string url ohayo/packages/samples/si.tree
    - string parser text
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux samples.si
    - samplesPortalNode
    - description A list of online data portals.
    - boolean isDataPublicDomain true
    - string dataUrl https://github.com/treenotation/ohayo/blob/master/ohayo/packages/samples/portals.ssv
    - frequency .03
    - string url ohayo/packages/samples/portals.ssv
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux samples.portals
    - samplesStarWarsNode
    - description All Star Wars characters. Data comes from https://swapi.co/
    - frequency .03
    - boolean isDataPublicDomain false
    - string dataLicense BSD
    - string url ohayo/packages/samples/starwars.json
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux samples.starWars
    - samplesPopulationsNode
    - description Countries of the world and their populations.
    - frequency .15
    - string url ohayo/packages/samples/populations.tsv
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux samples.populations
    - samplesBabyNamesNode
    - description 30 rows of a much larger dataset of baby name popularity over time in the U.S.
    - frequency .03
    - string url ohayo/packages/samples/baby-names-sample.csv
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux samples.babyNames
    - samplesDeclarationNode
    - description The 1776 Declaration of Independence
    - boolean isDataPublicDomain true
    - frequency .02
    - string url ohayo/packages/samples/declaration-of-independence.text
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux samples.declaration
    - samplesPeriodicTableNode
    - description Periodic table from https://gist.github.com/GoodmanSciences
    - string dataUrl https://gist.github.com/GoodmanSciences/c2dd862cd38f21b0ad36b8f96b4bf1ee
    - frequency .15
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - string url ohayo/packages/samples/periodic-table.csv
    - crux samples.periodicTable
    - samplesLettersNode
    - description Letter usage frequency in English from mobostock.
    - frequency .03
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - string url ohayo/packages/samples/letters.tsv
    - crux samples.letters
    - samplesPresidentsNode
    - boolean isDataPublicDomain true
    - description CSV of president's of United States.
    - frequency .03
    - string url ohayo/packages/samples/presidents.csv
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux samples.presidents
    - ucimlrDatasetsNode
    - description A list of datasets from the UC Irvine Machine Learning Repository at http://archive.ics.uci.edu/ml/index.php.
    - frequency .001
    - example Display list of datasets from UCIMLR
    - ucimlr.datasets
    - tables.basic
    - string url ohayo/packages/ucimlr/datasets.tsv
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux ucimlr.datasets
    - vegaDataNode
    - cells tileKeywordCell vegaDataSetCell
    - frequency .001
    - description Fetchs a Vega sample dataset
    - string urlPrefix ohayo/packages/vega/datasets/
    - extends abstractFixedDatasetFromOhayoCollectionNode
    - crux vega.data
    - redditAllNode
    - tags internetConnectionRequired
    - string dataDomain reddit.com
    - description Fetches top stories from r/all.
    - example A simple reddit dashboard
    - reddit.all
    - hidden
    - columns.keep title created_utc score subreddit url
    - hidden
    - rows.sortBy score
    - rows.reverse
    - tables.basic
    - vega.scatter
    - yColumn score
    - xColumn created_utc
    - frequency .05
    - javascript
    - async fetchTableInputs() {
    - const inputs = await super.fetchTableInputs()
    - // Todo: add tests/external dependency, as reddit API changes.
    - // Here it looks like we have the equivalent of a custom parser just for a Reddit Data source.
    - // todo: explore/define/typescriptAPI this custom parser pattern more. probably will be common.
    - return inputs.rows.length ? { rows: inputs.rows[0].data.children.map(obj => obj.data) } : inputs
    - }
    - getParserId() {
    - return "json"
    - }
    - string url https://www.reddit.com/r/all/top/.json?sort=top
    - string offlineDataSet ohayo/packages/reddit/all.json
    - extends abstractUrlNoCellsNode
    - crux reddit.all
    - redditSubsNode
    - description Fetches top subreddits.
    - frequency .005
    - string url https://www.reddit.com/reddits.json
    - extends redditAllNode
    - crux reddit.subs
    - redditSubNode
    - cells tileKeywordCell subredditNameCell
    - frequency .006
    - description Fetches top stories in a subreddit.
    - javascript
    - getUrl() {
    - const subreddit = this.getContent() || "all"
    - return \`https://www.reddit.com/r/\${subreddit}/top/.json?sort=top\`
    - }
    - extends redditAllNode
    - crux reddit.sub
    - abstractDummyNode
    - javascript
    - async _execute() {
    - this.setIsDataLoaded(true)
    - await this._executeChildNodes()
    - }
    - string tileSize 300 150
    - extends abstractProviderNode
    - abstract
    - samplesPatientsNode
    - description A row for each patient in a sample clinical dataset.
    - string dummyDataSetName patients
    - boolean isDataPublicDomain true
    - extends abstractDummyNode
    - crux samples.patients
    - samplesPoemNode
    - description The Road Not Taken by Robert Frost
    - string dummyDataSetName poem
    - boolean isDataPublicDomain true
    - extends abstractDummyNode
    - crux samples.poem
    - samplesOuterSpaceNode
    - description A simple text document of major structures in the universe.
    - string dummyDataSetName outerSpace
    - extends abstractDummyNode
    - crux samples.outerSpace
    - samplesTreeProgramNode
    - description A simple program in a Tree Language.
    - string dummyDataSetName treeProgram
    - boolean isDataPublicDomain true
    - extends abstractDummyNode
    - crux samples.treeProgram
    - samplesWaterBillNode
    - description A family's water bill.
    - frequency .15
    - string dummyDataSetName waterBill
    - boolean isDataPublicDomain true
    - extends abstractDummyNode
    - crux samples.waterBill
    - samplesGapMinderNode
    - description Health and income data from gapMinder
    - frequency .15
    - string dummyDataSetName gapMinder
    - extends abstractDummyNode
    - crux samples.gapMinder
    - abstractTransformerNode
    - string tileSize 160 100
    - extends abstractProviderNode
    - string placeholderMessage
    - abstract
    - string bodyStumpTemplate
    - span {kind}
    - class LargeLabel
    - input
    - value {content}
    - placeholder {placeholderMessage}
    - changeCommand changeTileContentAndRenderCommand
    - class LargeTileInput
    - string tileFooterTemplate
    - span Rows In: {inputCount} Rows Out: {outputCount} Columns Out: {columnCount}
    - {tileMenuButton}
    - javascript
    - getTileFooterStumpCode() {
    - const table = this.getParentOrDummyTable()
    - const inputCount = table.getRowCount()
    - const outputTable = this.getOutputOrInputTable()
    - return this.qFormat(this.tileFooterTemplate, { inputCount, outputCount: table.getRowCount(), columnCount: outputTable.getColumnCount(), tileMenuButton: this.getTileMenuButtonStumpCode() })
    - }
    - async _execute() {
    - this._outputTable = this._createOutputTable()
    - this.setIsDataLoaded(true)
    - await this._executeChildNodes()
    - }
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, { kind: this.getFirstWord(), content: this.getContent() || "", placeholderMessage: this.placeholderMessage })
    - }
    - abstractColumnAdderTileNode
    - abstract
    - extends abstractTransformerNode
    - javascript
    - _createOutputTable() {
    - return this.getParentOrDummyTable().addColumns(this.getNewColumns())
    - }
    - dateAddColumnsNode
    - description Takes an input table with a time column and adds a day, month and year column.
    - catchAllCellType dateColumnTypeCell
    - inScope sourceColumnNode
    - string columnPredictionHints
    - sourceColumn isTemporal=true
    - extends abstractColumnAdderTileNode
    - crux date.addColumns
    - string placeholderMessage Enter the source column and new date columns you want, or leave blank to get 'day month year'.
    - javascript
    - getNewColumns() {
    - const inputColumnName = this.getSettingsStruct().sourceColumn // todo: this is probably broken. need to fix settings timing issues.
    - if (!inputColumnName) return []
    - const addColumns = this.getContent() ? this.getWordsFrom(1) : ["day", "week", "month"]
    - // what happened to dayName? timeOfDay?
    - return addColumns.map(outputCol => {
    - return {
    - source: inputColumnName,
    - name: outputCol,
    - type: outputCol
    - }
    - })
    - }
    - genConstantNode
    - crux gen.constant
    - example
    - gen.range year -1000 2020 1
    - gen.constant birthRate number 0.035
    - cells tileKeywordCell columnNameCell primitiveTypeCell anyCell
    - description Add a column that contains a constant for each row.
    - extends abstractColumnAdderTileNode
    - javascript
    - getNewColumns() {
    - return [
    - {
    - name: this.columnNameCell,
    - type: this.primitiveTypeCell,
    - accessorFn: row => this.anyCell
    - }
    - ]
    - }
    - genGrowthNode
    - crux gen.growth
    - example
    - gen.range year -1000 2020 1
    - gen.constant birthRate number 0.035
    - gen.growth population 4 0.01
    - cells tileKeywordCell columnNameCell minCell growthRateCell
    - description Add a column that contains a constant for each row.
    - extends abstractColumnAdderTileNode
    - javascript
    - getNewColumns() {
    - let total = this.minCell
    - return [
    - {
    - name: this.columnNameCell,
    - accessorFn: (row, rowIndex) => {
    - total = total * (1 + this.growthRateCell)
    - return total
    - }
    - }
    - ]
    - }
    - mathLogNode
    - description Add a column that is the natural log (base e) of another column.
    - cells tileKeywordCell columnNameCell
    - extends abstractColumnAdderTileNode
    - crux math.log
    - javascript
    - getNewColumns() {
    - const inputColumnName = this.getWord(1)
    - if (!inputColumnName) return []
    - const inputCol = this.getParentOrDummyTable().getColumnByName(inputColumnName)
    - return [
    - {
    - source: inputColumnName,
    - name: inputColumnName + "Log",
    - type: inputCol.getPrimitiveTypeName(),
    - mathFn: Math.log
    - }
    - ]
    - }
    - rowsAddIndexColumnNode
    - description Add an index column to the data.
    - extends abstractColumnAdderTileNode
    - crux rows.addIndexColumn
    - javascript
    - getNewColumns() {
    - let index = 0
    - return [
    - {
    - name: "index",
    - accessorFn: row => index++
    - }
    - ]
    - }
    - rowsRunningTotalNode
    - cells tileKeywordCell columnNameCell
    - description Add a column that accumulates the running total of a column.
    - extends abstractColumnAdderTileNode
    - crux rows.runningTotal
    - javascript
    - getNewColumns() {
    - const sourceColumnName = this.getWord(1)
    - let total = 0
    - return [
    - {
    - source: sourceColumnName,
    - name: "total",
    - accessorFn: row => {
    - total += row[sourceColumnName]
    - return total
    - }
    - }
    - ]
    - }
    - textLengthNode
    - cells tileKeywordCell columnNameCell
    - description Add a column which contains the string length of the given column.
    - example Show the largest words in declaration of independence
    - samples.declaration
    - text.wordCount
    - text.length word
    - filter.where wordLength > 5
    - rows.sortByReverse wordLength
    - tables.basic
    - javascript
    - getNewColumns() {
    - const sourceColumnName = this.getWord(1)
    - const destinationColumnName = sourceColumnName + "Length"
    - return [
    - {
    - source: sourceColumnName,
    - name: destinationColumnName,
    - accessorFn: row => row[sourceColumnName].length
    - }
    - ]
    - }
    - extends abstractColumnAdderTileNode
    - crux text.length
    - textSplitNode
    - description Split one column into multiple by a string
    - cells tileKeywordCell columnNameCell delimiterCell
    - catchAllCellType newColumnNamesCell
    - example Split a filename into name and extension
    - vega.data descriptions.json
    - text.split filename . name extension
    - tables.basic
    - string dummyDataSetName poem
    - javascript
    - // note: delimiter can probably be ""
    - // todo: how would we split on a space???
    - // perhaps its better to use getContent() as delimiter, and if you want to name the columns, you can do that later?
    - getNewColumns() {
    - const sourceColumnName = this.getWord(1)
    - const delimiter = this.getWord(2)
    - const destinationColumns = this.getWordsFrom(3)
    - return destinationColumns.map((destinationColumnName, index) => {
    - return {
    - source: sourceColumnName,
    - name: destinationColumnName,
    - accessorFn: row => {
    - const words = row[sourceColumnName].split(delimiter)
    - return this.reverseSplit ? words.reverse()[index] : words[index]
    - }
    - }
    - })
    - return [
    - {
    - source: sourceColumnName,
    - name: destinationColumnName,
    - accessorFn: row => row[sourceColumnName].length
    - }
    - ]
    - }
    - extends abstractColumnAdderTileNode
    - crux text.split
    - reverseTextSplitNode
    - extends textSplitNode
    - crux text.reverseSplit
    - description Split one column into multiple by a string reversing the order.
    - boolean reverseSplit true
    - textToLowerCaseNode
    - description Convert all cells in a column to LowerCase text
    - cells tileKeywordCell columnNameCell
    - example Select the first character of someone's name
    - samples.declaration
    - text.wordCount
    - tables.basic
    - text.toLowerCase text
    - tables.basic
    - string dummyDataSetName poem
    - javascript
    - getNewColumns() {
    - const sourceColumnName = this.getWord(1) || "text"
    - return [
    - {
    - source: sourceColumnName,
    - name: sourceColumnName,
    - accessorFn: row => row[sourceColumnName].toLowerCase()
    - }
    - ]
    - }
    - extends abstractColumnAdderTileNode
    - crux text.toLowerCase
    - textTemplateNode
    - inScope contentNode
    - description Evaluates a common programming template string and generates a new cell for each row.
    - cells tileKeywordCell
    - catchAllCellType newColumnNameCell
    - string bodyStumpTemplate
    - textarea
    - name content
    - changeCommand changeTileSettingMultilineCommand
    - placeholder Enter template here.
    - class TileTextArea savable
    - bern
    - {text}
    - example
    - samples.presidents
    - text.template
    - content
    - Hello {name}!
    - How did you like being born in {HomeState}?
    - tables.basic
    - javascript
    - getNewColumns() {
    - const contentNode = this.getNode("content")
    - const templateString = contentNode ? contentNode.childrenToString() : ""
    - const destColumnName = this.getWord(1) || "Output"
    - return [
    - {
    - name: destColumnName,
    - accessorFn: row => new jtree.TreeNode(templateString).templateToString(row)
    - }
    - ]
    - }
    - getDataContent() {
    - const node = this.getNode("content")
    - return node ? node.childrenToString() : ""
    - }
    - getTileBodyStumpCode() {
    - const text = lodash.escape(this.getDataContent())
    - return this.qFormat(this.bodyStumpTemplate, { text })
    - }
    - extends abstractColumnAdderTileNode
    - crux text.template
    - textPermalinkNode
    - description Convert all cells in a column to a url friendly permalink.
    - cells tileKeywordCell columnNameCell newColumnNameCell
    - example
    - samples.presidents
    - text.permalink name Permalink
    - tables.basic
    - javascript
    - getNewColumns() {
    - const sourceColumnName = this.getWord(1) || "text"
    - const destinationColumnName = this.getWord(2) || "Permalink"
    - return [
    - {
    - source: sourceColumnName,
    - name: destinationColumnName,
    - accessorFn: row => jtree.Utils.stringToPermalink(row[sourceColumnName])
    - }
    - ]
    - }
    - extends abstractColumnAdderTileNode
    - crux text.permalink
    - textReplaceNode
    - description Does a global search/replace across all cells in a column.
    - cells tileKeywordCell columnNameCell
    - catchAllCellType anyCell
    - example
    - samples.presidents
    - text.replace name George Georgette
    - tables.basic
    - javascript
    - getNewColumns() {
    - const sourceColumnName = this.getWord(1) || "text"
    - const simpleSearch = this.getWord(2)
    - const simpleReplace = this.getWord(3)
    - const destinationColumnName = sourceColumnName
    - return [
    - {
    - source: sourceColumnName,
    - name: destinationColumnName,
    - accessorFn: row => row[sourceColumnName].replace(new RegExp(simpleSearch, "g"), simpleReplace)
    - }
    - ]
    - }
    - extends abstractColumnAdderTileNode
    - crux text.replace
    - textTrimNode
    - description Trims whitespace or a provided sequence from both sides of a string in all cells in a column.
    - cells tileKeywordCell columnNameCell
    - catchAllCellType anyCell
    - example
    - samples.presidents
    - text.trim HomeState New
    - tables.basic
    - javascript
    - getNewColumns() {
    - const sourceColumnName = this.getWord(1) || "text"
    - const trimChar = this.getWord(2)
    - const destinationColumnName = sourceColumnName
    - return [
    - {
    - source: sourceColumnName,
    - name: destinationColumnName,
    - accessorFn: row => (trimChar ? row[sourceColumnName].replace(new RegExp(\`(^\${trimChar}|\${trimChar}$)\`, "g"), "") : row[sourceColumnName].trim())
    - }
    - ]
    - }
    - extends abstractColumnAdderTileNode
    - crux text.trim
    - textSubstringNode
    - description Extract parts of one column into another column called "substring".
    - cells tileKeywordCell columnNameCell startIndexCell lengthCell
    - example Select the first character of someone's name
    - samples.presidents
    - text.substring name 0 1
    - tables.basic
    - string dummyDataSetName poem
    - extends abstractColumnAdderTileNode
    - crux text.substring
    - string destinationColumnName substring
    - javascript
    - getNewColumns() {
    - const sourceColumnName = this.getWord(1)
    - const startPosition = typeof this.startIndex !== undefined ? this.startIndex : parseInt(this.getWord(2))
    - const endPosition = typeof this.endIndex !== undefined ? this.endIndex : this.getWord(3) === undefined ? undefined : parseInt(this.getWord(3))
    - return [
    - {
    - source: sourceColumnName,
    - name: this.destinationColumnName,
    - accessorFn: row => (row[sourceColumnName] ? row[sourceColumnName].toString().substr(startPosition, endPosition) : "")
    - }
    - ]
    - }
    - testFirstLetterNode
    - extends textSubstringNode
    - crux text.firstLetter
    - description Extracts the first letter of a column into a new column called "firstLetter"
    - cells tileKeywordCell columnNameCell
    - string destinationColumnName firstLetter
    - int startIndex 0
    - int endIndex 1
    - abstractNewRowsTransformerTileNode
    - abstract
    - extends abstractTransformerNode
    - javascript
    - _createOutputTable() {
    - // todo: remove this
    - return new Table(this.makeNewRows())
    - }
    - columnsDescribeNode
    - description Computes statistics for each input column.
    - example List column information
    - samples.iris
    - columns.describe
    - extends abstractNewRowsTransformerTileNode
    - crux columns.describe
    - javascript
    - makeNewRows() {
    - return this.getParentOrDummyTable().getColumnNamesAndTypesAndReductions()
    - }
    - columnsListNode
    - description Provides a list of table columns and their types.
    - example List columns
    - samples.iris
    - columns.list
    - extends columnsDescribeNode
    - crux columns.list
    - javascript
    - makeNewRows() {
    - return this.getParentOrDummyTable().getColumnNamesAndTypes()
    - }
    - dataEvalNode
    - description Passes input rows, if any, to a Javascript function and returns transformed or new rows.
    - example Generate some data.
    - data.eval
    - content
    - inputRows => [{name: "Swift", year: 2015}, {name: "Kotlin", year: 2011}]
    - tables.basic
    - inScope contentNode
    - extends abstractNewRowsTransformerTileNode
    - crux data.eval
    - javascript
    - makeNewRows() {
    - const node = this.getNode(this.contentKey)
    - const code = node && node.childrenToString() // "rows => { return []}"
    - let fn
    - try {
    - fn = code && eval(code)
    - } catch (err) {
    - // todo: warn user
    - console.error(err)
    - }
    - const inputRows = this.getParentOrDummyTable().cloneNativeJavascriptTypedRows()
    - return fn ? fn(inputRows) : inputRows
    - }
    - joinByNode
    - catchAllCellType columnNameCell
    - description Combines multiple tables into one, linking the rows by the provided key column.
    - extends abstractNewRowsTransformerTileNode
    - crux join.by
    - javascript
    - makeNewRows() {
    - // Todo: move to table project
    - const parentTile = this.getParent()
    - if (parentTile.isRoot()) return []
    - const grandParentTile = parentTile.getParent()
    - if (grandParentTile.isRoot()) return parentTile.getOutputOrInputTable().cloneNativeJavascriptTypedRows()
    - const tiles = [parentTile, grandParentTile]
    - const arrays = tiles.map(tile => tile.getOutputOrInputTable().cloneNativeJavascriptTypedRows())
    - const joinOn = this.getContent()
    - if (!joinOn) return jtree.Utils.flatten(arrays)
    - const cols = tiles.map(tile => tile.getOutputOrInputTable().getColumnNames())
    - return jtree.Utils.joinArraysOn(joinOn, arrays, cols)
    - }
    - matchColumnsFuzzyNode
    - description Attempts to fuzzy match words in one column of parent table against words in a column in grandparent table.
    - cells tileKeywordCell needleColumnNameCell haystackColumnNameCell
    - example Try to match different spellings of country names.
    - samples.gapMinder
    - samples.populations
    - match.columnsFuzzy Country country
    - rows.sortBy confidence
    - rows.reverse
    - tables.basic
    - string tileScript ohayo/packages/match/fuse.min.js
    - extends abstractNewRowsTransformerTileNode
    - crux match.columnsFuzzy
    - javascript
    - makeNewRows() {
    - // Todo: move some of this logic to table project?
    - const parentTile = this.getParent()
    - if (parentTile.isRoot()) return []
    - const grandParentTile = parentTile.getParent()
    - if (grandParentTile.isRoot()) return parentTile.getOutputOrInputTable().cloneNativeJavascriptTypedRows()
    - const tiles = [parentTile, grandParentTile]
    - const arrays = tiles.map(tile => tile.getOutputOrInputTable().cloneNativeJavascriptTypedRows())
    - return this._addFuzz(arrays[0], arrays[1])
    - }
    - get fuse() {
    - return this.isNodeJs() ? require("fuse.js") : Fuse
    - }
    - _addFuzz(needles, haystacks) {
    - const needleColumnName = this.getWord(1) || "name"
    - const haystackColumnName = this.getWord(2) || "name"
    - const options = {
    - shouldSort: true,
    - includeScore: true,
    - threshold: 0.6,
    - location: 0,
    - distance: 100,
    - maxPatternLength: 32,
    - minMatchCharLength: 1,
    - keys: [haystackColumnName]
    - }
    - const fuse = new this.fuse(haystacks, options) // "list" is the item array
    - return needles.map(needle => {
    - const searchValue = needle[needleColumnName]
    - const result = fuse.search(searchValue)
    - if (!result.length)
    - return {
    - search: searchValue,
    - match: ""
    - }
    - const match = result[0]
    - return {
    - search: searchValue,
    - match: match.item[haystackColumnName],
    - confidence: parseFloat((1 - match.score).toFixed(3))
    - }
    - })
    - }
    - schemaTypeScriptNode
    - description Generates a TypeScript interface for the parent table.
    - extends abstractNewRowsTransformerTileNode
    - crux schema.toTypescript
    - example
    - samples.presidents
    - schema.toTypescript
    - html.printAs code
    - javascript
    - makeNewRows() {
    - return [{ text: this.getParentOrDummyTable().toTypeScriptInterface() }]
    - }
    - schemaSimpleNode
    - description Generate a simple schema of the parent table.
    - extends abstractNewRowsTransformerTileNode
    - crux schema.toSimple
    - example
    - samples.presidents
    - schema.toSimple
    - html.printAs code
    - javascript
    - makeNewRows() {
    - const schema = this.getParentOrDummyTable().toSimpleSchema()
    - const oneLiner = schema.replace(/ /g, ":").replace(/\\n/g, " ")
    - return [{ text: oneLiner + "\\n\\n" + schema }]
    - }
    - textWordCountNode
    - description Splits a string into words and counts the number of uses of each word.
    - string dummyDataSetName poem
    - extends abstractNewRowsTransformerTileNode
    - crux text.wordCount
    - javascript
    - makeNewRows() {
    - return this._getAllWords(this.getPipishInput())
    - }
    - _getAllWords(text) {
    - const rows = []
    - if (!text) return rows
    - const words = text
    - .split(/\\s/g)
    - .map(word => word.replace(/[^a-z0-9\\-]/gi, ""))
    - .filter(word => word)
    - const index = {}
    - words.forEach(word => {
    - if (!index[word]) index[word] = 1
    - else index[word]++
    - })
    - Object.keys(index).forEach(word => {
    - const trimmedWord = word.trim()
    - if (trimmedWord)
    - rows.push({
    - word: trimmedWord,
    - count: index[trimmedWord]
    - })
    - })
    - return rows
    - }
    - textLineCountNode
    - description Counts the number of lines in the input data.
    - string dummyDataSetName poem
    - javascript
    - makeNewRows() {
    - return [{ lines: this.getPipishInput().split(/\\n/g).length }]
    - }
    - extends abstractNewRowsTransformerTileNode
    - crux text.lineCount
    - example
    - text.lineCount
    - tables.basic
    - treenotationWordTypesNode
    - description Generates the word types for a Ohayo Language program.
    - example See counts of word types in a Ohayo Language program.
    - treenotation.wordTypes
    - treenotation.outline
    - text.wordCount
    - tables.basic
    - string dummyDataSetName treeProgram
    - extends abstractNewRowsTransformerTileNode
    - crux treenotation.wordTypes
    - javascript
    - makeNewRows() {
    - return [{ text: new ohayoNode(this.getPipishInput()).toCellTypeTree() }]
    - }
    - abstractColumnFilterTileNode
    - abstract
    - extends abstractTransformerNode
    - javascript
    - _createOutputTable() {
    - return this.getParentOrDummyTable().dropAllColumnsExcept(this.getColumnNamesToKeep())
    - }
    - columnsFirstNode
    - cells tileKeywordCell intCell
    - description Keeps only the first N columns.
    - example Drop all but first column
    - samples.iris
    - columns.first 1
    - tables.basic
    - extends abstractColumnFilterTileNode
    - crux columns.first
    - string placeholderMessage Enter the number of columns you want to keep
    - javascript
    - getColumnNamesToKeep() {
    - return this.getParentOrDummyTable()
    - .getColumnsArrayOfObjects()
    - .slice(0, parseInt(this.getContent()))
    - .map(col => col.name)
    - }
    - columnsLastNode
    - cells tileKeywordCell intCell
    - description Keeps only the last N columns.
    - example Drop all but 1 column
    - samples.iris
    - columns.last 1
    - tables.basic
    - extends abstractColumnFilterTileNode
    - crux columns.last
    - string placeholderMessage Enter the number of columns you want to keep
    - javascript
    - getColumnNamesToKeep() {
    - const cols = this.getParentOrDummyTable().getColumnsArrayOfObjects()
    - return cols.slice(cols.length - parseInt(this.getContent())).map(col => col.name)
    - }
    - columnsDropNode
    - description Drop certain columns. Inverse of columns.keep.
    - extends abstractColumnFilterTileNode
    - example
    - samples.iris
    - show.columnCount
    - columns.drop Petal.Length
    - show.columnCount
    - crux columns.drop
    - catchAllCellType columnNameCell
    - javascript
    - getColumnNamesToKeep() {
    - const colsToDrop = this.getWordsFrom(1)
    - return this.getParentOrDummyTable()
    - .getColumnsArrayOfObjects()
    - .filter(col => !colsToDrop.includes(col.name))
    - .map(col => col.name)
    - }
    - columnsDropConstantsNode
    - description Drop any columns that contain only a single value.
    - extends abstractColumnFilterTileNode
    - example
    - data.inline
    - content
    - state,country
    - hawaii,usa
    - maine,usa
    - show.columnCount
    - columns.dropConstants
    - show.columnCount
    - crux columns.dropConstants
    - javascript
    - getColumnNamesToKeep() {
    - return this.getParentOrDummyTable()
    - .getColumnsArray()
    - .filter(col => col.getReductions().uniqueValues > 1)
    - .map(col => col.getColumnName())
    - }
    - columnsKeepNode
    - catchAllCellType columnNameCell
    - description Keep only the named columns
    - example Show 2 columns
    - samples.iris
    - columns.keep Species Petal.Length
    - tables.basic
    - extends abstractColumnFilterTileNode
    - crux columns.keep
    - string placeholderMessage Enter the column names to keep.
    - javascript
    - getColumnNamesToKeep() {
    - const colsToKeep = this.getWordsFrom(1)
    - return this.getParentOrDummyTable()
    - .getColumnsArrayOfObjects()
    - .filter(col => colsToKeep.includes(col.name))
    - .map(col => col.name)
    - }
    - columnsKeepNumericsNode
    - description Keep only numeric columns
    - crux columns.keepNumerics
    - extends abstractColumnFilterTileNode
    - example Show 2 columns
    - samples.presidents
    - columns.keepNumerics
    - tables.basic
    - javascript
    - getColumnNamesToKeep() {
    - return Object.values(this.getParentOrDummyTable().getColumnsMap())
    - .filter(col => col.isNumeric())
    - .map(col => col.getColumnName())
    - }
    - abstractTransformerNoParamsTileNode
    - abstract
    - extends abstractTransformerNode
    - javascript
    - getTileBodyStumpCode() {
    - return \`span \${this.getFirstWord()}
    - class LargeLabel\`
    - }
    - rowsShuffleNode
    - description Shuffle the rows into a random order.
    - extends abstractTransformerNoParamsTileNode
    - crux rows.shuffle
    - javascript
    - _createOutputTable() {
    - return this.getParentOrDummyTable().shuffleRows()
    - }
    - rowsReverseNode
    - description Reverse the order of the rows
    - extends abstractTransformerNoParamsTileNode
    - crux rows.reverse
    - javascript
    - _createOutputTable() {
    - return this.getParentOrDummyTable().reverseRows()
    - }
    - abstractRowFilterTileNode
    - abstract
    - extends abstractTransformerNode
    - string placeholderMessage Enter a string to filter by.
    - javascript
    - // todo: pass thru.
    - // todo: remove this?
    - _createOutputTable() {
    - const fn = this.getRowFilterFn()
    - if (!fn) return this.getParentOrDummyTable().clone()
    - return this.getParentOrDummyTable().filterRowsByFn(fn)
    - }
    - filterWhereNode
    - description Each row must meet a certain condition
    - cells tileKeywordCell columnNameCell comparisonCell scalarValueCell
    - example Select rows by a certain text column
    - samples.iris
    - show.rowCount
    - filter.where Species = setosa
    - show.rowCount
    - frequency .01
    - string tileSize 250 100
    - extends abstractRowFilterTileNode
    - crux filter.where
    - javascript
    - _createOutputTable() {
    - // todo: use cells here.
    - const columnName = this.getWord(1)
    - const comparison = this.getWord(2)
    - let untypedScalarValue = this.getWord(3)
    - const table = this.getParentOrDummyTable()
    - if (!columnName || !comparison || untypedScalarValue === undefined) return table.clone()
    - const column = table.getColumnByName(columnName)
    - if (!column) return table
    - return table.filterClonedRowsByScalar(columnName, comparison, untypedScalarValue)
    - }
    - filterWithNode
    - description Each row must contain all of these words
    - frequency .01
    - catchAllCellType stringCell
    - string tileSize 250 100
    - extends abstractRowFilterTileNode
    - crux filter.with
    - boolean expectedBooleanValue true
    - javascript
    - getRowFilterFn() {
    - const words = this.getWordsFrom(1)
    - // todo: problem here is, getRows has too many columns if after a transformed column.
    - if (!words.length) return undefined
    - const len = words.length
    - const expectedValue = this.expectedBooleanValue
    - return row => {
    - const str = JSON.stringify(row)
    - for (let index = 0; index < len; index++) {
    - if (str.includes(words[index]) !== expectedValue) return false
    - }
    - return true
    - }
    - }
    - filterWithoutNode
    - description Each row CANNOT contain any of these words
    - extends filterWithNode
    - crux filter.without
    - boolean expectedBooleanValue false
    - filterAnyNode
    - description Each row much contain any of these words
    - extends filterWithNode
    - crux filter.withAny
    - javascript
    - getRowFilterFn() {
    - const words = this.getWordsFrom(1)
    - if (!words.length) return undefined
    - const len = words.length
    - // todo: problem here is, getRows has too many columns if after a transformed column.
    - return row => {
    - const str = JSON.stringify(row)
    - for (let index = 0; index < len; index++) {
    - if (str.includes(words[index])) return true
    - }
    - return false
    - }
    - }
    - rowsFirstNode
    - cells tileKeywordCell intCell
    - description Return the first N rows.
    - extends abstractRowFilterTileNode
    - crux rows.first
    - javascript
    - getRowFilterFn() {
    - const limit = parseInt(this.getContent())
    - if (isNaN(limit)) return undefined
    - return (row, rowIndex) => rowIndex < limit
    - }
    - rowsSampleNode
    - description Return N rows sampling uniformly in order.
    - extends abstractRowFilterTileNode
    - crux rows.sample
    - cells tileKeywordCell intCell
    - javascript
    - getRowFilterFn() {
    - // todo: move to jtable?
    - const sampleCount = parseInt(this.getContent())
    - if (isNaN(sampleCount)) return undefined
    - const totalCount = this.getParentOrDummyTable().getRowCount()
    - if (totalCount <= sampleCount) return undefined
    - const every = Math.floor(totalCount / sampleCount)
    - let total = 0
    - return (row, rowIndex) => {
    - if (total === totalCount) return false
    - if (rowIndex % every !== 0) return false
    - total++
    - return true
    - }
    - }
    - rowsDropIfMissingNode
    - cells tileKeywordCell
    - string placeholderMessage Leave blank to filter a row if it is missing any column, or specifiy column name(s).
    - description Drop a row if it is missing any values in any column, or missing a value in one of the specified columns.
    - extends abstractRowFilterTileNode
    - catchAllCellType columnNameCell
    - crux rows.dropIfMissing
    - example
    - data.inline
    - content
    - name,age
    - bob,
    - mike,55
    - assert.rowCount 2
    - rows.dropIfMissing
    - show.rowCount
    - assert.rowCount 1
    - javascript
    - getRowFilterFn() {
    - const column = this.getContent()
    - if (column) return row => !jtree.Utils.isValueEmpty(row[column])
    - return row => !Object.values(row).some(jtree.Utils.isValueEmpty)
    - }
    - rowsLastNode
    - cells tileKeywordCell intCell
    - description Return the last N rows.
    - extends abstractRowFilterTileNode
    - crux rows.last
    - javascript
    - getRowFilterFn() {
    - const limit = parseInt(this.getContent())
    - if (isNaN(limit)) return undefined
    - const start = this.getParentOrDummyTable().getRowCount() - limit
    - return (row, rowIndex) => rowIndex >= start
    - }
    - pcaNode
    - description Add Principal Component Columns to input table.
    - string github https://github.com/bitanath/pca
    - example
    - samples.iris
    - bitanath.pca
    - tables.basic
    - string tileScript ohayo/packages/bitanath/pca.js
    - string tileScript ohayo/packages/mathjs/math.min.js
    - extends abstractTransformerNode
    - crux bitanath.pca
    - javascript
    - get pcaLib() {
    - return this.isNodeJs() ? require(__dirname + "/packages/bitanath/pca.js") : PCA
    - }
    - get mathLib() {
    - return this.isNodeJs() ? require(__dirname + "/packages/mathjs/math.min.js") : math
    - }
    - _createOutputTable() {
    - const table = this.getParentOrDummyTable()
    - const matrix = table.toNumericMatrix()
    - const vectors = this.pcaLib.getEigenVectors(matrix)
    - const pcaRows = vectors.map(vec => vec.vector)
    - const rows = table.getRows().map((row, index) => {
    - const obj = row.rowToObjectWithOnlyNativeJavascriptTypes()
    - const vec = matrix[index]
    - obj.pc1 = this.mathLib.dot(vec, pcaRows[0])
    - obj.pc2 = this.mathLib.dot(vec, pcaRows[1])
    - obj.pc3 = this.mathLib.dot(vec, pcaRows[2])
    - return obj
    - })
    - return new Table(rows)
    - }
    - columnsRenameNode
    - crux columns.rename
    - cells tileKeywordCell columnNameCell newColumnNameCell
    - description Rename a column
    - extends abstractTransformerNode
    - javascript
    - _createOutputTable() {
    - const renameMap = {}
    - renameMap[this.getWord(1)] = this.getWord(2)
    - return this.getParentOrDummyTable().renameColumns(renameMap)
    - }
    - example
    - samples.iris
    - columns.rename Species Classification
    - columnsCleanNamesNode
    - crux columns.cleanNames
    - cells tileKeywordCell
    - description Simplifies column names by removing punctuation.
    - example
    - samples.iris
    - columns.describe
    - columns.cleanNames
    - columns.describe
    - extends abstractTransformerNode
    - javascript
    - _createOutputTable() {
    - return this.getParentOrDummyTable().cloneWithCleanColumnNames()
    - }
    - columnsSetTypeNode
    - cells tileKeywordCell columnNameCell primitiveTypeCell
    - description Ohayo attempts to choose the correct primitive type, but you can override the default with this tile.
    - example List column information
    - samples.waterBill
    - columns.keep Amount Gallons
    - columns.setType Gallons year
    - columns.describe
    - tables.basic
    - extends abstractTransformerNode
    - crux columns.setType
    - javascript
    - _createOutputTable() {
    - const colToChange = this.getWord(1)
    - const newType = this.getWord(2)
    - return this.getParentOrDummyTable().changeColumnType(colToChange, newType)
    - }
    - dataSynthNode
    - description Synthesizes new datasets based upon the parent tiles schema.
    - crux data.synth
    - catchAllCellType schemaSimpleCell
    - extends abstractTransformerNode
    - inScope schemaNode
    - javascript
    - _createOutputTable() {
    - const schema = this._getSchema()
    - const table = !schema ? this.getParentOrDummyTable() : new Table([], schema)
    - return table.synthesizeTable(this.intCell || 30, Date.now())
    - }
    - _getSchema() {
    - const schema = this.getNode("schema")
    - if (schema) return schema.toJTableColumnDefinitionMap()
    - const words = this.getWordsFrom(2)
    - if (words.length)
    - return words.map(word => {
    - const parts = word.split(":")
    - return {
    - name: parts[0],
    - type: parts[1]
    - }
    - })
    - }
    - cells tileKeywordCell intCell
    - example
    - samples.iris
    - data.synth 100
    - show.rowCount
    - example
    - data.synth 100
    - schema
    - name string
    - score int
    - finished boolean
    - show.columnCount
    - example
    - data.synth 100 name:string score:int finished:boolean
    - dataAboutNode
    - extends abstractTransformerNode
    - description Gets metadata about a dataset.
    - crux data.about
    - javascript
    - _getDataSetInfo() {
    - const parentTile = this.getParent()
    - const def = parentTile.getDefinition()
    - return {
    - licenseSpecified: parentTile.isDataPublicDomain,
    - tags: def.get("tags"),
    - overviewDescription: parentTile.dataDescription || def.get("description"),
    - dataUrl: parentTile.dataUrl
    - }
    - }
    - _createOutputTable() {
    - return new Table([this._getDataSetInfo()])
    - }
    - dataUsabilityScoreNode
    - extends dataAboutNode
    - description Generates a Data Usability Score for the input table.
    - crux data.usabilityScore
    - example
    - samples.iris
    - data.usabilityScore
    - tables.basic
    - show.max score
    - javascript
    - _createOutputTable() {
    - const row = this._getDataSetInfo()
    - // todo: a very simplistic approximation of Kaggle's data usability score
    - row.score = Object.values(row).filter(item => !!item).length * 2.5
    - return new Table([row])
    - }
    - fillMissingNode
    - cells tileKeywordCell columnNameCell anyCell
    - description Fill any missing cell in the provided column name with the provided value.
    - extends abstractTransformerNode
    - crux fill.missing
    - example
    - data.inline
    - content
    - name,score
    - bob,
    - mike,55
    - fill.missing score 0
    - javascript
    - _createOutputTable() {
    - return this.getParentOrDummyTable().fillMissing(this.getWord(1), this.getWord(2))
    - }
    - genRangeNode
    - crux gen.range
    - example
    - gen.range year -1000 2020 1
    - tables.basic
    - description Generate a table with a column from a range
    - extends abstractTransformerNode
    - cells tileKeywordCell newColumnNameCell minCell maxCell stepCell
    - javascript
    - _createOutputTable() {
    - const rows = []
    - // todo: protect against infinite loops
    - let currentValue = this.minCell
    - if (!this.stepCell) throw new Error("Step cannot be zero.")
    - while (currentValue <= this.maxCell) {
    - const row = []
    - row[this.newColumnNameCell] = currentValue
    - rows.push(row)
    - currentValue += this.stepCell
    - }
    - return new Table(rows)
    - }
    - groupByNode
    - frequency .01
    - catchAllCellType columnNameCell
    - inScope reduceNode
    - description Group rows with the same value for a column into one row and provide summary columns.
    - example Group rows and display counts for each group.
    - samples.iris
    - group.by Species
    - tables.basic
    - extends abstractTransformerNode
    - crux group.by
    - string placeholderMessage Enter the column to groupby.
    - javascript
    - _createOutputTable() {
    - const groupByColNames = this.getWordsFrom(1)
    - if (!groupByColNames.length) return this.getParentOrDummyTable().clone()
    - const newCols = this.findNodes("reduce").map(reduceNode => {
    - return {
    - source: reduceNode.getWord(1),
    - reduction: reduceNode.getWord(2),
    - name: reduceNode.getWord(3) || reduceNode.getWordsFrom(1).join("_")
    - }
    - })
    - return this.getParentOrDummyTable().makePivotTable(groupByColNames, newCols)
    - }
    - rowsSortByNode
    - catchAllCellType columnNameCell
    - description Sort the rows by a column(s) from smallest to largest.
    - example See cheaptest and most expensive months in a family's water bills
    - samples.waterBill
    - rows.sortBy Amount
    - rows.first 1
    - doc.subtitle Cheapest month
    - tables.basic
    - rows.reverse
    - rows.first 1
    - doc.subtitle Most expensive
    - tables.basic
    - extends abstractTransformerNode
    - crux rows.sortBy
    - string placeholderMessage Columns you want to sort by
    - javascript
    - _createOutputTable() {
    - const table = this.getParentOrDummyTable().sortBy(this.getWordsFrom(1))
    - if (this.getFirstWord().includes("Reverse")) return table.reverseRows()
    - return table
    - }
    - rowsSortByReverseNode
    - description Sort the rows by a column(s) from largest to smallest.
    - extends rowsSortByNode
    - crux rows.sortByReverse
    - rowsAddOneNode
    - description Add a single row to the parent table, in space-separated value format
    - catchAllCellType anyCell
    - extends abstractTransformerNode
    - crux rows.addOne
    - javascript
    - _createOutputTable() {
    - return this.getParentOrDummyTable().addRow(this.getWordsFrom(1))
    - }
    - textMatchesNode
    - description Scans the input text for a pattern and returns number of hits.
    - crux text.matches
    - cells tileKeywordCell
    - catchAllCellType anyCell
    - extends abstractTransformerNode
    - javascript
    - _createOutputTable() {
    - return new Table([{ count: this.getPipishInput().match(new RegExp(this.getContent(), "g")).length }])
    - }
    - textCombineNode
    - description Combine all cells in a column into 1 text block
    - extends abstractTransformerNode
    - crux text.combine
    - cells tileKeywordCell columnNameCell
    - javascript
    - _createOutputTable() {
    - // todo: cleanup
    - const text = this.getParentOrDummyTable()
    - .getRows()
    - .map(row => row.getRowOriginalValue(this.columnNameCell))
    - .join("\\n")
    - return new Table([{ text }])
    - }
    - dataInlineNode
    - inScope contentNode parserNode treeLanguageNode
    - frequency .2
    - description Store data in your doc, in CSV, TSV, JSON, and other formats.
    - example
    - data.inline
    - parser csv
    - content
    - petal_length,petal_width,species
    - 4.9,1.8,virginica
    - 4.9,2,virginica
    - 1.5,0.2,setosa
    - string bodyStumpTemplate
    - textarea
    - name content
    - changeCommand changeTileSettingMultilineCommand
    - placeholder Enter data in any format here. It will be saved directly in your document.
    - class TileTextArea savable
    - bern
    - {text}
    - javascript
    - getDataContent() {
    - const node = this.getNode("content")
    - return node ? node.childrenToString() : ""
    - }
    - getTileBodyStumpCode() {
    - const text = lodash.escape(this.getDataContent())
    - return this.qFormat(this.bodyStumpTemplate, { text })
    - }
    - getRowClass() {
    - class InlineDataTileRow extends Row {}
    - return InlineDataTileRow
    - }
    - getParserId() {
    - return super.getParserId() || new TableParser().guessTableParserId(this.getDataContent())
    - }
    - async fetchTableInputs() {
    - return new TableParser().parseTableInputsFromString(this.getDataContent(), this.getParserId())
    - }
    - extends abstractProviderNode
    - crux data.inline
    - dataLocalStorageNode
    - cells tileKeywordCell localStorageKeyCell
    - description Use your browser's localStorage for storing data.
    - string bodyStumpTemplate
    - textarea
    - changeCommand triggerTileMethodCommand
    - placeholder Enter data in any format here. It will be saved in your browser's localStorage.
    - name storeValueCommand
    - class TileTextArea savable
    - bern
    - {text}
    - example
    - data.localStorage a-dropped-file.csv
    - javascript
    - // Note: for now, only way to clear a key is to do it manually through UI (select all delete) or console. That might be good enough.
    - _getStoreKey() {
    - return this.getContent()
    - }
    - getDataContent() {
    - const key = this._getStoreKey()
    - return key ? this.getWebApp().getFromStore(key) || "" : ""
    - }
    - storeValueCommand(value) {
    - let key = this._getStoreKey()
    - if (key) this.getWebApp().storeValue(key, value)
    - else this.setContent(this.getWebApp().initLocalDataStorage(this.constructor.name + ".data", value))
    - }
    - getTileBodyStumpCode() {
    - const text = lodash.escape(this.getDataContent())
    - return this.qFormat(this.bodyStumpTemplate, { text })
    - }
    - extends dataInlineNode
    - crux data.localStorage
    - debugParserTestNode
    - description Dumps data on why a certain file parser was chosen.
    - example See why a certain file parser was chosen.
    - vega.data descriptions.json
    - debug.parserTest
    - tables.basic
    - extends abstractProviderNode
    - crux debug.parserTest
    - javascript
    - async fetchTableInputs() {
    - const parentTile = this.getParent()
    - if (parentTile.getWillowHttpResponse) {
    - const probs = new TableParser().guessProbabilitiesForAllTableParsers(parentTile.getWillowHttpResponse().text)
    - return {
    - rows: Object.keys(probs).map(key => {
    - return {
    - parser: key,
    - probability: probs[key]
    - }
    - })
    - }
    - }
    - return [{ rows: [] }]
    - }
    - debugGrammarNode
    - description Get the ohayo grammar
    - tags noPicker
    - cells tileKeywordCell
    - crux debug.ohayoGrammar
    - extends abstractProviderNode
    - example Print the ohayo grammar
    - debug.ohayoGrammar
    - treenotation.outline
    - javascript
    - async fetchTableInputs() {
    - return { rows: [{ text: new ohayoNode("").getHandGrammarProgram().toString() }] }
    - }
    - debugGrammarTreeNode
    - description Show the family tree for ohayo grammar.
    - tags noPicker
    - cells tileKeywordCell
    - example Show the family tree for ohayo grammar
    - debug.ohayoGrammarTree
    - treenotation.outline
    - extends abstractProviderNode
    - crux debug.ohayoGrammarTree
    - javascript
    - async fetchTableInputs() {
    - return {
    - rows: [
    - {
    - text: new ohayoNode("")
    - .getHandGrammarProgram()
    - .getNodeTypeFamilyTree()
    - .toString()
    - }
    - ]
    - }
    - }
    - editorFilesNode
    - description Fetch your files in the current working folder.
    - example
    - editor.files
    - editor.gallery
    - string tileSize 140 120
    - javascript
    - getRowClass() {
    - // todo: remove?
    - class FileRow extends Row {
    - destroyRow(app) {
    - return app.deleteFileCommand(this.getRowOriginalValue("link"))
    - }
    - }
    - return FileRow
    - }
    - async fetchTableInputs() {
    - const files = await this.getWebApp()
    - .getDefaultDisk()
    - .readFiles()
    - return { rows: files.map(file => file.toFileObject()) }
    - }
    - extends abstractProviderNode
    - crux editor.files
    - editorCommandHistoryNode
    - description Outputs row for each command executed in this Ohayo Studio session.
    - example Show what you've done in this tab session.
    - editor.commandHistory
    - tables.basic
    - javascript
    - async fetchTableInputs() {
    - return { rows: this.getWebApp()[this.methodName]() }
    - }
    - string methodName getCommandsBuffer
    - extends abstractProviderNode
    - crux editor.commandHistory
    - mathGenNode
    - description Generate a stream of numbers from common mathematical functions
    - cells tileKeywordCell mathFunctionNameCell fromCell toCell incrementCell
    - extends abstractProviderNode
    - example
    - math.gen sin 0 10 .1
    - vega.scatter
    - xColumn input
    - yColumn output
    - crux math.gen
    - javascript
    - async fetchTableInputs() {
    - const rows = []
    - const fn = Math[this.getWord(1)]
    - for (let input = parseFloat(this.fromCell); input < parseFloat(this.toCell); input += parseFloat(this.incrementCell)) {
    - rows.push({ input, output: fn(input) })
    - }
    - return {
    - rows
    - }
    - }
    - abstractRandomTileNode
    - abstract
    - extends abstractProviderNode
    - javascript
    - async fetchTableInputs() {
    - let howMany = this.quantityCell || 30
    - const rows = []
    - for (let index = 1; index <= howMany; index++) {
    - rows.push(this._genRow(index))
    - }
    - return { rows }
    - }
    - randomFloatNode
    - description Generates uniform random floats between min and max.
    - cells tileKeywordCell quantityCell minCell maxCell
    - example Get 10 random probabilities above .5
    - random.float 10 .5 1
    - float min 0
    - float max 1
    - javascript
    - _genRow(index) {
    - return { index, number: jtree.Utils.randomUniformFloat(this.minCell, this.maxCell, Math.random()) }
    - }
    - extends abstractRandomTileNode
    - crux random.float
    - randomIntNode
    - description Generates uniform random ints between min and max.
    - cells tileKeywordCell quantityCell minCell maxCell
    - example Get 30 random numbers between 0 and 100
    - random.int 30 0 100
    - int min 0
    - int max 100
    - javascript
    - _genRow(index) {
    - return { index, number: jtree.Utils.randomUniformInt(this.minCell, this.maxCell, Math.random()) }
    - }
    - crux random.int
    - extends abstractRandomTileNode
    - samplesTinyIrisNode
    - description A snippet of the Iris dataset.
    - boolean isDataPublicDomain true
    - string data
    - petal_length,petal_width,species
    - 4.9,1.8,virginica
    - 4.2,1.3,versicolor
    - 4.9,2,virginica
    - 1.5,0.2,setosa
    - extends abstractProviderNode
    - crux samples.tinyIris
    - string bodyStumpTemplate
    - pre
    - class TileSelectable
    - style overflow: scroll; max-height: 100%;
    - bern
    - {text}
    - javascript
    - getDataContent() {
    - return this.data
    - }
    - getTileBodyStumpCode() {
    - return this.qFormat(this.bodyStumpTemplate, { text: this.getDataContent() })
    - }
    - getParserId() {
    - return super.getParserId() || new TableParser().guessTableParserId(this.getDataContent())
    - }
    - async fetchTableInputs() {
    - return new TableParser().parseTableInputsFromString(this.getDataContent(), this.getParserId())
    - }
    - assertRowCountNode
    - description Throw an error if row count not correct.
    - tags noPicker
    - example Basics
    - data.inline
    - content
    - country
    - usa
    - assert.rowCount 1
    - extends abstractTileTreeComponentNode
    - cells tileKeywordCell intCell
    - crux assert.rowCount
    - boolean visible false
    - javascript
    - async execute() {
    - const num = this.getWord(1)
    - if (!num) return super.execute()
    - const expected = parseInt(num)
    - const actual = this.getParentOrDummyTable().getRowCount()
    - if (actual !== expected) throw new Error(\`Expected \${expected} but got \${actual}\`)
    - return super.execute()
    - }
    - printNode
    - description Print input table to console as text.
    - extends abstractTileTreeComponentNode
    - crux print.text
    - example
    - data.inline
    - parser text
    - content
    - Hello world
    - print.text
    - javascript
    - execute() {
    - console.log(this._getMessage())
    - }
    - _getMessage() {
    - return this.getPipishInput()
    - }
    - printCsvNode
    - description Print input table to console as csv.
    - extends printNode
    - crux print.csv
    - example
    - samples.presidents
    - filter.where HomeState = Illinois
    - print.csv
    - javascript
    - _getMessage() {
    - return this.getParentOrDummyTable().toDelimited(",")
    - }
    - abstractTileSettingNode
    - cells tileSettingKeywordCell
    - abstract
    - abstractTileSettingTerminalNode
    - javascript
    - getSettingValue() {
    - return this.getContent()
    - }
    - extends abstractTileSettingNode
    - abstract
    - abstractColumnNode
    - cells tileSettingKeywordCell columnNameCell
    - extends abstractTileSettingTerminalNode
    - abstract
    - javascript
    - getRunTimeEnumOptions(cell) {
    - // todo: only works if codemirror === tab
    - try {
    - // todo: handle at static time.
    - const mirrorNode = typeof app === "undefined" ? this : app.mountedProgram.nodeAtLine(this.getLineNumber() - 1)
    - const mirrorParent = mirrorNode && mirrorNode.getParent()
    - if (cell.getCellTypeId() === "columnNameCell" && mirrorParent && mirrorParent.isLoaded()) {
    - const options = mirrorParent.getParentOrDummyTable().getColumnNames()
    - return options
    - }
    - } catch (err) {
    - console.log(err)
    - }
    - }
    - columnNode
    - extends abstractColumnNode
    - crux column
    - sourceColumnNode
    - extends abstractColumnNode
    - crux sourceColumn
    - labelNode
    - extends abstractColumnNode
    - crux label
    - linkNode
    - extends abstractColumnNode
    - crux link
    - sizeColumnNode
    - extends abstractColumnNode
    - crux sizeColumn
    - colorColumnNode
    - extends abstractColumnNode
    - crux colorColumn
    - shapeColumnNode
    - extends abstractColumnNode
    - crux shapeColumn
    - valueNode
    - extends abstractColumnNode
    - crux value
    - countNode
    - extends abstractColumnNode
    - crux count
    - dayColumnNode
    - extends abstractColumnNode
    - crux dayColumn
    - xColumnNode
    - extends abstractColumnNode
    - crux xColumn
    - yColumnNode
    - extends abstractColumnNode
    - crux yColumn
    - genderColumnNode
    - extends abstractColumnNode
    - crux genderColumn
    - headSizeNode
    - extends abstractColumnNode
    - crux headSize
    - radiusNode
    - extends abstractColumnNode
    - crux radius
    - emojiColumnNode
    - extends abstractColumnNode
    - crux emojiColumn
    - parserNode
    - cells tileSettingKeywordCell parserIdsCell
    - description Ohayo tries to pick the best parser for your data, but you can also specify it, like "csv" or "tsv".
    - extends abstractTileSettingTerminalNode
    - crux parser
    - useCacheNode
    - cells tileSettingKeywordCell booleanCell
    - extends abstractTileSettingTerminalNode
    - crux useCache
    - reductionNode
    - cells tileSettingKeywordCell reductionTypeCell
    - extends abstractTileSettingTerminalNode
    - crux reduction
    - abstractCoreTileSettingTerminalNode
    - abstract
    - extends abstractTileSettingTerminalNode
    - hiddenNode
    - extends abstractCoreTileSettingTerminalNode
    - crux hidden
    - visibleNode
    - extends abstractCoreTileSettingTerminalNode
    - crux visible
    - maximizedNode
    - extends abstractCoreTileSettingTerminalNode
    - crux maximized
    - abstractPagePositionNode
    - frequency .2
    - cells tileSettingKeywordCell intCell
    - extends abstractCoreTileSettingTerminalNode
    - abstract
    - leftNode
    - extends abstractPagePositionNode
    - crux left
    - topNode
    - extends abstractPagePositionNode
    - crux top
    - widthNode
    - extends abstractPagePositionNode
    - crux width
    - heightNode
    - extends abstractPagePositionNode
    - crux height
    - reduceNode
    - description Provide information to correctly parse a column.
    - example 4 years of seattle weather
    - vega.data seattle-weather.csv
    - date.addColumns
    - group.by year
    - reduce temp_max mean average_max
    - reduce temp_max max max_max
    - reduce temp_min min min_min
    - tables.basic
    - cells tileSettingKeywordCell columnNameCell reductionTypeCell newColumnNameCell
    - extends abstractTileSettingTerminalNode
    - crux reduce
    - styleNode
    - extends abstractTileSettingTerminalNode
    - crux style
    - columnLimitNode
    - description How many columns to show
    - cells tileSettingKeywordCell intCell
    - extends abstractTileSettingTerminalNode
    - crux columnLimit
    - howManyNode
    - cells tileSettingKeywordCell quantityCell
    - extends abstractTileSettingTerminalNode
    - crux howMany
    - sizeNode
    - cells tileSettingKeywordCell numberCell
    - description Size of mark.
    - extends abstractTileSettingTerminalNode
    - crux size
    - rowDisplayLimitNode
    - cells tileSettingKeywordCell intCell
    - frequency .5
    - description Sets the maximum number of rows to show in a tile.
    - extends abstractTileSettingTerminalNode
    - crux rowDisplayLimit
    - srcNode
    - cells tileSettingKeywordCell urlCell
    - extends abstractTileSettingTerminalNode
    - crux src
    - roughnessNode
    - cells tileSettingKeywordCell roughnessCell
    - description Roughness level of chart. Default is 1.
    - extends abstractTileSettingTerminalNode
    - crux roughness
    - colorsNode
    - cells tileSettingKeywordCell
    - catchAllCellType anyCell
    - description Colors to use for the lines.
    - extends abstractTileSettingTerminalNode
    - crux colors
    - cameraPositionNode
    - cells tileSettingKeywordCell cameraDistanceNumberCell horizontalNumberCell verticalNumberCell
    - extends abstractTileSettingTerminalNode
    - crux cameraPosition
    - treeLanguageNode
    - cells tileSettingKeywordCell supportedTreeLanguageCell
    - extends abstractTileSettingTerminalNode
    - crux treeLanguage
    - abstractTileSettingNonTerminalNode
    - javascript
    - getSettingValue() {
    - return this.childrenToString()
    - }
    - extends abstractTileSettingNode
    - catchAllNodeType tileSettingNonTerminalContentNode
    - abstract
    - contentNode
    - catchAllNodeType lineOfContentNode
    - extends abstractTileSettingNonTerminalNode
    - crux content
    - catchAllNodesPostContentNode
    - catchAllCellType anyCell
    - extends abstractTileSettingNonTerminalNode
    - crux catchAllNodesPostContent
    - postNode
    - catchAllNodeType catchAllNodesPostContentNode
    - extends abstractTileSettingNonTerminalNode
    - crux post
    - abstractDocSettingNode
    - cells tileKeywordCell
    - abstract
    - boolean visible false
    - docCategoriesNode
    - extends abstractDocSettingNode
    - crux doc.categories
    - description Add some categories to the document for organization.
    - catchAllCellType documentCategoryCell
    - docAuthorNode
    - extends abstractDocSettingNode
    - catchAllCellType stringCell
    - crux doc.author
    - description Add one author per line.
    - docDateNode
    - description Date published.
    - extends abstractDocSettingNode
    - crux doc.date
    - catchAllCellType dateCell
    - abstractDocSectionComponentNode
    - abstract
    - docSectionSubtitleNode
    - extends abstractDocSectionComponentNode
    - crux subtitle
    - cells tileKeywordCell
    - catchAllCellType stringCell
    - javascript
    - compile() {
    - return \`h2 \${this.getContent()}\`
    - }
    - docSectionParagraphNode
    - extends abstractDocSectionComponentNode
    - crux paragraph
    - cells tileKeywordCell
    - catchAllCellType stringCell
    - catchAllNodeType docParagraphLineNode
    - string stumpTemplate
    - p
    - bern
    - {content}
    - javascript
    - compile() {
    - return new jtree.TreeNode(this.stumpTemplate).templateToString({ content: this.getContentWithChildren() })
    - }
    - docSectionLinkNode
    - extends abstractDocSectionComponentNode
    - crux link
    - cells tileKeywordCell urlCell
    - catchAllCellType stringCell
    - string stumpTemplate
    - a {content}
    - href {url}
    - javascript
    - compile() {
    - return new jtree.TreeNode(this.stumpTemplate).templateToString({ content: this.getWordsFrom(2).join(" "), url: this.getWord(1) })
    - }
    - example
    - doc.section
    - link http://ohayo.computer Ohayo
    - docSectionCodeNode
    - extends abstractDocSectionComponentNode
    - crux code
    - cells tileKeywordCell programmingLanguageNameCell
    - catchAllNodeType docLineOfCodeNode
    - string stumpTemplate
    - code
    - bern
    - {content}
    - javascript
    - compile() {
    - return new jtree.TreeNode(this.stumpTemplate).templateToString({ content: this.childrenToString().replace(/
    - }
    - example
    - doc.section
    - subtitle Some Code
    - code latex
    - E_0 &= mc^2
    - E &= \\frac{mc^2}{\\sqrt{1-\\frac{v^2}{c^2}}}
    - docLineOfCodeNode
    - catchAllCellType codeCell
    - catchAllNodeType docLineOfCodeNode
    - docParagraphLineNode
    - catchAllCellType stringCell
    - catchAllNodeType docParagraphLineNode
    - commentLineNode
    - catchAllCellType commentCell
    - catchAllNodeType commentLineNode
    - docReferenceUrlNode
    - crux url
    - cells tileSettingKeywordCell urlCell
    - description URL for the reference
    - catchAllErrorNode
    - catchAllCellType errorCell
    - baseNodeType errorNode
    - hashBangNode
    - crux #!
    - tags noPicker
    - description Standard bash hashBang line.
    - catchAllCellType hashBangWordCell
    - ohayoNode
    - root
    - _extendsJsClass AbstractTreeComponent
    - _rootNodeJsHeader
    - const projectRootDir = jtree.Utils.findProjectRoot(__dirname, "ohayo")
    - const { AbstractTreeComponent } = require(projectRootDir + "node_modules/jtree/products/TreeComponentFramework.node.js")
    - const OhayoConstants = require(projectRootDir + "studio/treeComponents/OhayoConstants.js")
    - const StudioConstants = require(projectRootDir + "studio/treeComponents/StudioConstants.js")
    - const Icons = require(projectRootDir + "studio/themes/Icons.js")
    - const lodash = require(projectRootDir + "node_modules/lodash")
    - const { Table, DummyDataSets, Row, TableParser } = require("jtree/products/jtable.node.js")
    - const marked = require("marked")
    - const moment = require("moment")
    - // https://github.com/gentooboontoo/js-quantities
    - // https://github.com/moment/moment/issues/2469
    - // todo: ugly. how do we ditch this or test?
    - moment.createFromInputFallback = function(momentConfig) {
    - momentConfig._d = new Date(momentConfig._i)
    - }
    - const numeral = require("numeral")
    - catchAllNodeType DidYouMeanTileNode
    - description Ohayo is a programming language for doing data science.
    - inScope abstractTileTreeComponentNode tileBlankLineNode abstractDocSettingNode hashBangNode
    - javascript
    - getTileClosestToLine(lineIndex) {
    - let current = this.nodeAtLine(lineIndex)
    - while (current) {
    - if (current.doesExtend("abstractTileTreeComponentNode")) return current
    - current = current.getParent()
    - }
    - }
    - setTab(tab) {
    - this._tab = tab
    - }
    - getTheme() {
    - const tab = this.getTab()
    - return tab ? tab.getTheme() : super.getTheme()
    - }
    - getTab() {
    - return this._tab
    - }
    - async loadAndIncrementalRender() {
    - const app = this.getTab().getRootNode()
    - await Promise.all(this.getTiles().map(tile => tile.loadBrowserRequirements()))
    - await Promise.all(
    - this.getRootLevelTiles().map(async tile => {
    - await tile.execute()
    - app.renderApp()
    - })
    - )
    - app.renderApp() // this one might be superfluous
    - return this
    - }
    - getTiles() {
    - return this.getTopDownArray().filter(node => node.doesExtend("abstractTileTreeComponentNode"))
    - }
    - getRootLevelTiles() {
    - return this.filter(node => node.doesExtend("abstractTileTreeComponentNode"))
    - }
    - _getProjectRootDir() {
    - return this.isNodeJs() ? jtree.Utils.findProjectRoot(__dirname, "ohayo") : ""
    - }
    - toRunTimeStats() {
    - const tiles = this.getTiles()
    - const stats = {
    - tiles: tiles.length,
    - treeLanguage: this.getHandGrammarProgram().getExtensionName(),
    - url: this.getTab().getFileName()
    - }
    - stats.timeToLoad = this.getTiles()
    - .map(tile => tile.getTimeToLoad())
    - .sort()
    - .reverse()[0]
    - stats.timeToRender = this.getTiles()
    - .map(tile => tile.getNewestTimeToRender())
    - .sort()
    - .reverse()[0]
    - return stats
    - }
    - async execute() {
    - await Promise.all(this.map(node => node.execute()))
    - // Use shell tiles to do any outputs
    - }
    - _getProgramRowCount() {
    - return this.getAllRowsFromAllOutputTables().reduce((acc, curr) => acc + curr.length, 0)
    - }
    - getOutputOrInputTable() {
    - // todo: remove this?
    - if (!this._outputTable) this._outputTable = new Table()
    - return this._outputTable
    - }
    - getRowsFromLastTable() {
    - const tiles = this.getTopDownArray()
    - return tiles[tiles.length - 1].getOutputOrInputTable().getRows()
    - }
    - getAllRowsFromAllOutputTables() {
    - return jtree.Utils.flatten(
    - this.getTiles()
    - .map(tile => tile.getOutputTable())
    - .filter(table => table)
    - .map(table => table.getRows())
    - )
    - }
    - tileSettingNonTerminalContentNode
    - baseNodeType blobNode
    - lineOfContentNode
    - catchAllNodeType lineOfContentNode
    - catchAllCellType stringCell
    - columnDefinitionNode
    - cells columnNameCell primitiveTypeCell
    - schemaNode
    - crux schema
    - description A basic schema language consisting of one column name followed by a primitive column type per line.
    - cells tileSettingKeywordCell
    - catchAllNodeType columnDefinitionNode
    - javascript
    - toJTableColumnDefinitionMap() {
    - return this.map(row => {
    - return {
    - name: row.getWord(0),
    - type: row.getWord(1)
    - }
    - })
    - }`)
    - return this._cachedHandGrammarProgramRoot
    - }
    - static getNodeTypeMap() {
    - return {
    - tileBlankLineNode: tileBlankLineNode,
    - abstractTileTreeComponentNode: abstractTileTreeComponentNode,
    - abstractChartNode: abstractChartNode,
    - abstractTextNode: abstractTextNode,
    - abstractInstructionsNode: abstractInstructionsNode,
    - amazonHistoryNode: amazonHistoryNode,
    - fitbitAllNode: fitbitAllNode,
    - abstractComingSoonNode: abstractComingSoonNode,
    - datawrapperComingSoonNode: datawrapperComingSoonNode,
    - dcjsComingSoonNode: dcjsComingSoonNode,
    - finosPerspectiveComingSoonNode: finosPerspectiveComingSoonNode,
    - fivethirtyeightComingSoonNode: fivethirtyeightComingSoonNode,
    - GovNode: GovNode,
    - highchartsComingSoonNode: highchartsComingSoonNode,
    - re3dataComingSoonNode: re3dataComingSoonNode,
    - zingComingSoonNode: zingComingSoonNode,
    - editorHelloWorldNode: editorHelloWorldNode,
    - abstractSnippetGalleryNode: abstractSnippetGalleryNode,
    - abstractTemplateGalleryNode: abstractTemplateGalleryNode,
    - challengeListNode: challengeListNode,
    - samplesListNode: samplesListNode,
    - vegaDataListNode: vegaDataListNode,
    - vegaExampleListNode: vegaExampleListNode,
    - abstractPickerTileNode: abstractPickerTileNode,
    - PickerTileNode: PickerTileNode,
    - templatesListNode: templatesListNode,
    - asciiChartNode: asciiChartNode,
    - calendarHeatNode: calendarHeatNode,
    - challengePlayNode: challengePlayNode,
    - debugDumpNode: debugDumpNode,
    - webDumpNode: webDumpNode,
    - debugCommandsNode: debugCommandsNode,
    - debugSleepNode: debugSleepNode,
    - debugNoOpNode: debugNoOpNode,
    - debugThrowNode: debugThrowNode,
    - dtjsBasicNode: dtjsBasicNode,
    - editorGalleryNode: editorGalleryNode,
    - handsontableBasicNode: handsontableBasicNode,
    - abstractHtmlNode: abstractHtmlNode,
    - htmlTextNode: htmlTextNode,
    - htmlPrintAsNode: htmlPrintAsNode,
    - abstractHTMLFixedTagTileNode: abstractHTMLFixedTagTileNode,
    - htmlH1Node: htmlH1Node,
    - abstractHTMLContentIsSrcTileNode: abstractHTMLContentIsSrcTileNode,
    - htmlImgNode: htmlImgNode,
    - htmlIframeNode: htmlIframeNode,
    - htmlCustomNode: htmlCustomNode,
    - iconsIconNode: iconsIconNode,
    - iconsHumanNode: iconsHumanNode,
    - iconsCircleNode: iconsCircleNode,
    - listBasicNode: listBasicNode,
    - listLinksNode: listLinksNode,
    - markdownToHtmlNode: markdownToHtmlNode,
    - abstractRoughJsChartNode: abstractRoughJsChartNode,
    - abstractRoughJsLabelValueNode: abstractRoughJsLabelValueNode,
    - roughJsBarNode: roughJsBarNode,
    - roughJsPieNode: roughJsPieNode,
    - roughJsLineNode: roughJsLineNode,
    - abstractShowTileNode: abstractShowTileNode,
    - showRowCountNode: showRowCountNode,
    - showColumnCountNode: showColumnCountNode,
    - showStaticNode: showStaticNode,
    - showValueNode: showValueNode,
    - showMedianNode: showMedianNode,
    - showSumNode: showSumNode,
    - showMeanNode: showMeanNode,
    - showMinNode: showMinNode,
    - showMaxNode: showMaxNode,
    - tablesBasicNode: tablesBasicNode,
    - tablesInterestingNode: tablesInterestingNode,
    - tablesDumpNode: tablesDumpNode,
    - textWordcloudNode: textWordcloudNode,
    - treenotation3dNode: treenotation3dNode,
    - treenotationOutlineNode: treenotationOutlineNode,
    - treenotationDotlineNode: treenotationDotlineNode,
    - abstractVegaNode: abstractVegaNode,
    - vegaBarNode: vegaBarNode,
    - vegaLineNode: vegaLineNode,
    - vegaAreaNode: vegaAreaNode,
    - vegaScatterNode: vegaScatterNode,
    - vegaBubbleNode: vegaBubbleNode,
    - vegaEmojiNode: vegaEmojiNode,
    - vegaHistogramNode: vegaHistogramNode,
    - vegaExampleNode: vegaExampleNode,
    - DidYouMeanTileNode: DidYouMeanTileNode,
    - abstractDocTileNode: abstractDocTileNode,
    - docTitleNode: docTitleNode,
    - docSubtitleNode: docSubtitleNode,
    - docSectionNode: docSectionNode,
    - docReferenceNode: docReferenceNode,
    - docCommentNode: docCommentNode,
    - docToolingNode: docToolingNode,
    - abstractProviderNode: abstractProviderNode,
    - abstractUrlNoCellsNode: abstractUrlNoCellsNode,
    - abstractUrlNode: abstractUrlNode,
    - abstractUrlsNode: abstractUrlsNode,
    - githubInfoNode: githubInfoNode,
    - diskBrowseNode: diskBrowseNode,
    - diskReadNode: diskReadNode,
    - abstractHackernewsNode: abstractHackernewsNode,
    - hackernewsTopNode: hackernewsTopNode,
    - hackernewsSubmissionsNode: hackernewsSubmissionsNode,
    - publicApisNode: publicApisNode,
    - webGetNode: webGetNode,
    - webPostNode: webPostNode,
    - wikipediaContentNode: wikipediaContentNode,
    - abstractFixedDatasetFromUrlNode: abstractFixedDatasetFromUrlNode,
    - abstractFixedDatasetFromOhayoCollectionNode: abstractFixedDatasetFromOhayoCollectionNode,
    - cancerCasesNode: cancerCasesNode,
    - abstractCdcInfantPercentileNode: abstractCdcInfantPercentileNode,
    - weightPercentilesNode: weightPercentilesNode,
    - lengthPercentilesNode: lengthPercentilesNode,
    - headPercentilesNode: headPercentilesNode,
    - kaggleDatasetsHeartNode: kaggleDatasetsHeartNode,
    - mozTop500Node: mozTop500Node,
    - lifeExpectancyNode: lifeExpectancyNode,
    - owidListNode: owidListNode,
    - samplesTelescopesNode: samplesTelescopesNode,
    - samplesMtcarsNode: samplesMtcarsNode,
    - samplesIrisNode: samplesIrisNode,
    - samplesFlights14Node: samplesFlights14Node,
    - samplesSiNode: samplesSiNode,
    - samplesPortalNode: samplesPortalNode,
    - samplesStarWarsNode: samplesStarWarsNode,
    - samplesPopulationsNode: samplesPopulationsNode,
    - samplesBabyNamesNode: samplesBabyNamesNode,
    - samplesDeclarationNode: samplesDeclarationNode,
    - samplesPeriodicTableNode: samplesPeriodicTableNode,
    - samplesLettersNode: samplesLettersNode,
    - samplesPresidentsNode: samplesPresidentsNode,
    - ucimlrDatasetsNode: ucimlrDatasetsNode,
    - vegaDataNode: vegaDataNode,
    - redditAllNode: redditAllNode,
    - redditSubsNode: redditSubsNode,
    - redditSubNode: redditSubNode,
    - abstractDummyNode: abstractDummyNode,
    - samplesPatientsNode: samplesPatientsNode,
    - samplesPoemNode: samplesPoemNode,
    - samplesOuterSpaceNode: samplesOuterSpaceNode,
    - samplesTreeProgramNode: samplesTreeProgramNode,
    - samplesWaterBillNode: samplesWaterBillNode,
    - samplesGapMinderNode: samplesGapMinderNode,
    - abstractTransformerNode: abstractTransformerNode,
    - abstractColumnAdderTileNode: abstractColumnAdderTileNode,
    - dateAddColumnsNode: dateAddColumnsNode,
    - genConstantNode: genConstantNode,
    - genGrowthNode: genGrowthNode,
    - mathLogNode: mathLogNode,
    - rowsAddIndexColumnNode: rowsAddIndexColumnNode,
    - rowsRunningTotalNode: rowsRunningTotalNode,
    - textLengthNode: textLengthNode,
    - textSplitNode: textSplitNode,
    - reverseTextSplitNode: reverseTextSplitNode,
    - textToLowerCaseNode: textToLowerCaseNode,
    - textTemplateNode: textTemplateNode,
    - textPermalinkNode: textPermalinkNode,
    - textReplaceNode: textReplaceNode,
    - textTrimNode: textTrimNode,
    - textSubstringNode: textSubstringNode,
    - testFirstLetterNode: testFirstLetterNode,
    - abstractNewRowsTransformerTileNode: abstractNewRowsTransformerTileNode,
    - columnsDescribeNode: columnsDescribeNode,
    - columnsListNode: columnsListNode,
    - dataEvalNode: dataEvalNode,
    - joinByNode: joinByNode,
    - matchColumnsFuzzyNode: matchColumnsFuzzyNode,
    - schemaTypeScriptNode: schemaTypeScriptNode,
    - schemaSimpleNode: schemaSimpleNode,
    - textWordCountNode: textWordCountNode,
    - textLineCountNode: textLineCountNode,
    - treenotationWordTypesNode: treenotationWordTypesNode,
    - abstractColumnFilterTileNode: abstractColumnFilterTileNode,
    - columnsFirstNode: columnsFirstNode,
    - columnsLastNode: columnsLastNode,
    - columnsDropNode: columnsDropNode,
    - columnsDropConstantsNode: columnsDropConstantsNode,
    - columnsKeepNode: columnsKeepNode,
    - columnsKeepNumericsNode: columnsKeepNumericsNode,
    - abstractTransformerNoParamsTileNode: abstractTransformerNoParamsTileNode,
    - rowsShuffleNode: rowsShuffleNode,
    - rowsReverseNode: rowsReverseNode,
    - abstractRowFilterTileNode: abstractRowFilterTileNode,
    - filterWhereNode: filterWhereNode,
    - filterWithNode: filterWithNode,
    - filterWithoutNode: filterWithoutNode,
    - filterAnyNode: filterAnyNode,
    - rowsFirstNode: rowsFirstNode,
    - rowsSampleNode: rowsSampleNode,
    - rowsDropIfMissingNode: rowsDropIfMissingNode,
    - rowsLastNode: rowsLastNode,
    - pcaNode: pcaNode,
    - columnsRenameNode: columnsRenameNode,
    - columnsCleanNamesNode: columnsCleanNamesNode,
    - columnsSetTypeNode: columnsSetTypeNode,
    - dataSynthNode: dataSynthNode,
    - dataAboutNode: dataAboutNode,
    - dataUsabilityScoreNode: dataUsabilityScoreNode,
    - fillMissingNode: fillMissingNode,
    - genRangeNode: genRangeNode,
    - groupByNode: groupByNode,
    - rowsSortByNode: rowsSortByNode,
    - rowsSortByReverseNode: rowsSortByReverseNode,
    - rowsAddOneNode: rowsAddOneNode,
    - textMatchesNode: textMatchesNode,
    - textCombineNode: textCombineNode,
    - dataInlineNode: dataInlineNode,
    - dataLocalStorageNode: dataLocalStorageNode,
    - debugParserTestNode: debugParserTestNode,
    - debugGrammarNode: debugGrammarNode,
    - debugGrammarTreeNode: debugGrammarTreeNode,
    - editorFilesNode: editorFilesNode,
    - editorCommandHistoryNode: editorCommandHistoryNode,
    - mathGenNode: mathGenNode,
    - abstractRandomTileNode: abstractRandomTileNode,
    - randomFloatNode: randomFloatNode,
    - randomIntNode: randomIntNode,
    - samplesTinyIrisNode: samplesTinyIrisNode,
    - assertRowCountNode: assertRowCountNode,
    - printNode: printNode,
    - printCsvNode: printCsvNode,
    - abstractTileSettingNode: abstractTileSettingNode,
    - abstractTileSettingTerminalNode: abstractTileSettingTerminalNode,
    - abstractColumnNode: abstractColumnNode,
    - columnNode: columnNode,
    - sourceColumnNode: sourceColumnNode,
    - labelNode: labelNode,
    - linkNode: linkNode,
    - sizeColumnNode: sizeColumnNode,
    - colorColumnNode: colorColumnNode,
    - shapeColumnNode: shapeColumnNode,
    - valueNode: valueNode,
    - countNode: countNode,
    - dayColumnNode: dayColumnNode,
    - xColumnNode: xColumnNode,
    - yColumnNode: yColumnNode,
    - genderColumnNode: genderColumnNode,
    - headSizeNode: headSizeNode,
    - radiusNode: radiusNode,
    - emojiColumnNode: emojiColumnNode,
    - parserNode: parserNode,
    - useCacheNode: useCacheNode,
    - reductionNode: reductionNode,
    - abstractCoreTileSettingTerminalNode: abstractCoreTileSettingTerminalNode,
    - hiddenNode: hiddenNode,
    - visibleNode: visibleNode,
    - maximizedNode: maximizedNode,
    - abstractPagePositionNode: abstractPagePositionNode,
    - leftNode: leftNode,
    - topNode: topNode,
    - widthNode: widthNode,
    - heightNode: heightNode,
    - reduceNode: reduceNode,
    - styleNode: styleNode,
    - columnLimitNode: columnLimitNode,
    - howManyNode: howManyNode,
    - sizeNode: sizeNode,
    - rowDisplayLimitNode: rowDisplayLimitNode,
    - srcNode: srcNode,
    - roughnessNode: roughnessNode,
    - colorsNode: colorsNode,
    - cameraPositionNode: cameraPositionNode,
    - treeLanguageNode: treeLanguageNode,
    - abstractTileSettingNonTerminalNode: abstractTileSettingNonTerminalNode,
    - contentNode: contentNode,
    - catchAllNodesPostContentNode: catchAllNodesPostContentNode,
    - postNode: postNode,
    - abstractDocSettingNode: abstractDocSettingNode,
    - docCategoriesNode: docCategoriesNode,
    - docAuthorNode: docAuthorNode,
    - docDateNode: docDateNode,
    - abstractDocSectionComponentNode: abstractDocSectionComponentNode,
    - docSectionSubtitleNode: docSectionSubtitleNode,
    - docSectionParagraphNode: docSectionParagraphNode,
    - docSectionLinkNode: docSectionLinkNode,
    - docSectionCodeNode: docSectionCodeNode,
    - docLineOfCodeNode: docLineOfCodeNode,
    - docParagraphLineNode: docParagraphLineNode,
    - commentLineNode: commentLineNode,
    - docReferenceUrlNode: docReferenceUrlNode,
    - catchAllErrorNode: catchAllErrorNode,
    - hashBangNode: hashBangNode,
    - ohayoNode: ohayoNode,
    - tileSettingNonTerminalContentNode: tileSettingNonTerminalContentNode,
    - lineOfContentNode: lineOfContentNode,
    - columnDefinitionNode: columnDefinitionNode,
    - schemaNode: schemaNode
    - }
    - }
    - }
    -
    - class tileSettingNonTerminalContentNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(this._getBlobNodeCatchAllNodeType())
    - }
    - getErrors() {
    - return []
    - }
    - }
    -
    - class lineOfContentNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(lineOfContentNode, undefined, undefined)
    - }
    - get stringCell() {
    - return this.getWordsFrom(0)
    - }
    - }
    -
    - class columnDefinitionNode extends jtree.GrammarBackedNode {
    - get columnNameCell() {
    - return this.getWord(0)
    - }
    - get primitiveTypeCell() {
    - return this.getWord(1)
    - }
    - }
    -
    - class schemaNode extends jtree.GrammarBackedNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(columnDefinitionNode, undefined, undefined)
    - }
    - get tileSettingKeywordCell() {
    - return this.getWord(0)
    - }
    - toJTableColumnDefinitionMap() {
    - return this.map(row => {
    - return {
    - name: row.getWord(0),
    - type: row.getWord(1)
    - }
    - })
    - }
    - }
    -
    - window.ohayoNode = ohayoNode
    - }
    -
    - "use strict";
    - window.challengesTree = `challenge
    - id 1
    - question How many U.S. Presidents were born in California?
    - answer 2
    - difficulty easy
    - solution
    - samples.presidents
    - filter.with California
    - tables.basic
    - challenge
    - id 2
    - question What is the score of the highest rated movie on IMDB?
    - answer 9.2
    - difficulty easy
    - solution
    - vega.data movies.json
    - columns.keep Title IMDB_Rating
    - filter.where IMDB_Rating > 0
    - rows.sortBy IMDB_Rating
    - rows.reverse
    - tables.basic
    - challenge
    - id 3
    - question How many movies are rated 8+ on IMDB?
    - answer 157
    - difficulty easy
    - solution
    - vega.data movies.json
    - filter.where IMDB_Rating > 8
    - columns.keep Title IMDB_Rating
    - tables.basic
    - challenge
    - id 4
    - question In the sample dataset "waterBill", what is the median monthly water bill?
    - answer 65.03
    - difficulty easy
    - solution
    - samples.waterBill
    - columns.describe
    - columns.keep Column median
    - tables.basic
    - challenge
    - id 5
    - question In the Declaration of Independence, how many times does the word "people" appear, including when capitalized?
    - answer 10
    - difficulty medium
    - solution
    - samples.declaration
    - text.toLowerCase text
    - text.wordCount
    - filter.where word = people
    - show.max count Count`
    - "use strict";
    - window.TemplatesStamp = `file templates/amazon-purchase-history.ohayo
    - data
    - doc.title Amazon Purchase History
    - doc.comment Delete the below line and replace with your data
    - amazon.history
    - columns.keep Category ItemTotal OrderDate Title
    - tables.basic
    - group.by Category
    - reduce ItemTotal sum sum
    - vega.bar Amount Spent by Category
    - xColumn Category
    - yColumn sum
    - date.addColumns year
    - group.by year
    - reduce ItemTotal sum totalSpent
    - vega.bar Amount Spent by Year
    - yColumn totalSpent
    - xColumn year
    - vega.bar Items Purchases by Year
    - yColumn count
    - xColumn year
    - doc.categories shopping
    - file templates/boiling-points.ohayo
    - data
    - doc.title Boiling Points
    - samples.periodicTable
    - vega.scatter Boiling Point by Atomic Number
    - xColumn AtomicNumber
    - yColumn BoilingPoint
    - colorColumn Phase
    - doc.categories chemistry
    - file templates/cancer-rates-in-the-us.ohayo
    - data
    - doc.title Cancer Rates in the U.S.
    - cancer.cases
    - tables.basic
    - show.sum Female Total female cases
    - vega.bar
    - xColumn CancerType
    - yColumn Female
    - show.sum Male Total male cases
    - columns.setType Male number
    - vega.bar
    - xColumn CancerType
    - yColumn Male
    - doc.categories medicine
    - file templates/country-names.ohayo
    - data
    - doc.title Exploring Country Names
    - samples.populations
    - hidden
    - doc.subtitle How many countrys are there in this dataset?
    - show.rowCount Countries
    - text.firstLetter Country
    - hidden
    - group.by firstLetter
    - hidden
    - vega.bar How many country names begin with each letter (in English)?
    - show.rowCount Letters used
    - doc.subtitle No countries have a name starting with X.
    - doc.categories geography
    - file templates/country-populations.ohayo
    - data
    - doc.title Largest Countries by Population
    - samples.populations
    - rows.sortBy Population2016
    - vega.bar Population by Country
    - yColumn Population2016
    - colorColumn Continent
    - group.by Continent
    - reduce Population2016 sum Population2016
    - vega.bar Population by Region
    - yColumn Population2016
    - doc.categories geography
    - file templates/declaration-of-independence.ohayo
    - data
    - doc.title Declaration of Independence
    - doc.categories history
    - samples.declaration
    - hidden
    - html.printAs pre
    - text.wordCount
    - hidden
    - show.sum count Words
    - text.wordcloud
    - file templates/discovery-of-elements.ohayo
    - data
    - doc.title Discovery of the Elements
    - doc.subtitle What is the growth in known elements over time?
    - samples.periodicTable
    - fill.missing Year 1000
    - columns.keep Element Year
    - rows.sortBy Year
    - tables.basic
    - rowDisplayLimit 200
    - group.by Year
    - rows.sortBy Year
    - rows.runningTotal count
    - vega.bar Number of Elements Found Each Year
    - xColumn Year
    - yColumn count
    - vega.line Cumulative Number of Elements
    - xColumn Year
    - yColumn total
    - vega.scatter Year of Discovery by Atomic Number
    - xColumn Year
    - yColumn AtomicNumber
    - doc.categories chemistry
    - file templates/elements-by-phase.ohayo
    - data
    - doc.title Elements by Phase
    - samples.periodicTable
    - hidden
    - group.by Phase
    - hidden
    - roughjs.pie At Room Temperature Most Elements are Solids
    - label Phase
    - value count
    - columns.keep Element Phase
    - filter.where Phase = solid
    - tables.basic
    - doc.categories chemistry
    - file templates/git-repo-dashboard.ohayo
    - data
    - doc.title Desktop Only: Statistics for Local Git Repo
    - web.get http://localhost:2222/shell?command=gitlog
    - date.addColumns
    - group.by day
    - calendar.heat
    - count count
    - show.median count Median Commits Per Coding Day
    - show.rowCount # Coding Days
    - group.by month
    - vega.line Monthly Commit Trends
    - xColumn month
    - yColumn count
    - vega.bar Days worked by month
    - xColumn month
    - yColumn count
    - show.rowCount Total Commits
    - show.max time Most Recent Commit
    - show.min time First Commit
    - doc.categories programming
    - file templates/github-comparison.ohayo
    - data
    - doc.title GitHub Comparison
    - doc.subtitle A comparison of Ohayo with RStudio and Jupyter Notebook.
    - github.info rstudio/rstudio jupyter/notebook treenotation/ohayo
    - hidden
    - vega.bar Stars Comparison
    - yColumn stargazers_count
    - vega.scatter Stars by Year Created
    - xColumn created_at
    - yColumn stargazers_count
    - doc.categories programming
    - file templates/github-project-stats.ohayo
    - data
    - doc.title GitHub Project Stats
    - github.info treenotation/ohayo
    - hidden
    - show.value full_name Name
    - show.value description Description
    - show.value created_at Created
    - show.value pushed_at Last Updated
    - show.value stargazers_count Stars
    - doc.categories programming
    - file templates/humanPopulation.ohayo
    - data
    - doc.title Human Population
    - doc.subtitle A chart of human population growth.
    - doc.categories history
    - gen.range when -1000 2020 1
    - gen.growth populationInMillions 4 0.0025
    - vega.line Estimated Human Popuation
    - yColumn populationInMillions
    - xColumn when
    - file templates/life-expectancy.ohayo
    - data
    - doc.title Life Expectancy in the U.S.
    - doc.categories medicine
    - owid.lifeExpectancy
    - hidden
    - filter.where Code = USA
    - hidden
    - vega.line Life Expectancy in the USA
    - xColumn Year
    - yColumn Lifeexpectancy(years)
    - file templates/loc-with-bars.ohayo
    - data
    - doc.title Desktop Only: Analyze lines of code in a folder
    - web.get /disk?path=/ohayo/studio&lineStats=true&recursive=true
    - filter.without .DS_Store min.js node_modules ignore package-lock.json
    - show.sum lines Total LoC
    - columns.keep name extension lines words bytes wordsPerLine
    - rows.sortByReverse lines
    - tables.basic
    - group.by extension
    - reduce words sum words
    - reduce bytes sum bytes
    - reduce lines sum lines
    - vega.bar Lines of Code
    - yColumn lines
    - vega.bar Words
    - yColumn words
    - tables.basic
    - doc.categories programming
    - file templates/logs.ohayo
    - data
    - doc.title Exponents
    - math.gen exp 0 1 .01
    - vega.line 2.718^x from 0 to 1
    - xColumn input
    - yColumn output
    - math.gen exp 1 10 .1
    - vega.line 2.718^x from 1 to 10
    - xColumn input
    - yColumn output
    - math.gen exp 10 20 .1
    - vega.line 2.718^x from 10 to 20
    - xColumn input
    - yColumn output
    - doc.categories math
    - file templates/most-popular-websites.ohayo
    - data
    - doc.title 500 Most Popular Websites
    - doc.categories web
    - moz.top500
    - hidden
    - columns.setType LinkingRootDomains numberString
    - hidden
    - tables.basic
    - vega.bar Number of Inbound Links
    - xColumn Rank
    - yColumn LinkingRootDomains
    - file templates/ohayo-grammar-analysis.ohayo
    - data
    - doc.title Ohayo Grammar Analysis
    - doc.categories ohayo
    - debug.ohayoGrammar
    - hidden
    - text.lineCount
    - hidden
    - show.max lines Ohayo Grammar Lines of Code
    - text.wordCount
    - hidden
    - show.sum count Ohayo Total Grammar Words
    - show.rowCount Ohayo Unique Words
    - text.wordcloud
    - text.wordCount
    - hidden
    - rows.sortByReverse count
    - hidden
    - rows.first 10
    - hidden
    - tables.basic
    - file templates/ohayo-product-stats.ohayo
    - data
    - doc.title Ohayo Product Stats
    - doc.categories ohayo
    - templates.list
    - hidden
    - show.rowCount Number of Templates
    - debug.ohayoGrammar
    - hidden
    - text.matches string dataDomain
    - hidden
    - show.max count Number of Integrated Web Data Sources
    - challenge.list
    - hidden
    - show.rowCount Number of Challenges
    - debug.ohayoGrammarTree
    - hidden
    - text.lineCount
    - hidden
    - show.max lines Number of Ohayo Nodes
    - doc.comment show.static 2 Number of 0 Included Datasets
    - doc.comment show.static 2 Number of Datasets on Datasets.ohayo.computer
    - debug.ohayoGrammar
    - hidden
    - text.lineCount
    - hidden
    - show.max lines Ohayo Grammar Lines of Code
    - text.wordCount
    - hidden
    - show.sum count Ohayo Total Grammar Words
    - show.rowCount Ohayo Unique Words
    - doc.comment Todo: show.static 2 Ohayo Grammar Lines of Javascript Code
    - file templates/ohayo-readme.ohayo
    - data
    - doc.title Ohayo Readme & Release Notes
    - web.get readme.md
    - parser text
    - hidden
    - markdown.toHtml
    - web.get releasenotes.md
    - parser text
    - hidden
    - markdown.toHtml
    - web.get ohayo/readme.md
    - parser text
    - hidden
    - markdown.toHtml
    - doc.categories ohayo
    - file templates/ohayo-reference.ohayo
    - data
    - doc.title Ohayo Reference
    - doc.author Breck Yunits
    - doc.date 12/05/2019
    - doc.categories ohayo
    -
    - doc.subtitle Ohayo is a language for data powered documents.
    -
    - doc.section
    - subtitle Overview
    - paragraph Ohayo is a combination of a Markdown-like language coupled with a collaboratively designed dataflow language for doing data science right in the browser.
    -
    -
    - doc.section
    - subtitle Sections
    - paragraph You can put whole sections into 1 tile.
    - paragraph Sections can have multiple paragraphs.
    - code python
    - # they can have code blocks too
    -
    - doc.section
    - subtitle Mixing data with content
    - paragraph You can mix and match doc tiles with any other Ohayo tile.
    -
    - data.inline
    - parser ssv
    - content
    - team superbowls
    - Patriots 6
    - Bills 0
    - vega.bar Number of Superbowl Wins
    -
    -
    - doc.subtitle A List of All Tiles
    - debug.ohayoGrammarTree
    - hidden
    - treenotation.outline
    -
    - doc.section
    - subtitle Secondary Notation (aka Text Styling)
    - paragraph Words can be bolded[bold] or italicized[em] or monospacedono] or linked[link http://ohayo.computer] or footnoted[ref someRefId].
    -
    - doc.section
    - subtitle Links
    - link http://ohayo.computer A whole sentence can be linked
    -
    - doc.section
    - subtitle Categories
    - paragraph You might want to add some tags categorizing your document.
    - code ohayo
    - doc.categories programming
    -
    - doc.section
    - subtitle Blank lines
    - paragraph
    - Blank lines are fine.
    -
    - In paragraphs.
    -
    - doc.section
    - subtitle Code
    - code python
    - # You can create blocks of code for printing
    - # If you provide a supported language ID, secondary notation (highlighting) can be added.
    -
    - doc.ref someRefId
    - url https://en.wikipedia.org/wiki/Note_(typography)
    - file templates/our-world-in-data.ohayo
    - data
    - doc.title Our World in Data
    - doc.subtitle Exploration of datasets in https://ourworldindata.org/
    - owid.list
    - vega.scatter Row Counts by ID
    - xColumn id
    - yColumn rowCount
    - vega.scatter
    - xColumn rowCount
    - yColumn columnCount
    - columns.describe
    - hidden
    - tables.basic
    - doc.categories dataScience
    - file templates/pca-of-flowers.ohayo
    - data
    - doc.title PCA Demonstration
    - samples.iris
    - hidden
    - bitanath.pca
    - hidden
    - vega.scatter PCA of the Iris Dataset
    - xColumn pc1
    - yColumn pc2
    - colorColumn Species
    - doc.categories math
    - doc.subtitle This demonstration uses the PCA library from bitanath.
    - file templates/planets-on-wikipedia.ohayo
    - data
    - doc.title The Planets on Wikipedia
    - wikipedia.page Venus Mercury_(planet) Earth Mars Neptune Saturn Jupiter Uranus
    - hidden
    - tables.basic
    - columns.keep title extract
    - hidden
    - text.combine extract
    - hidden
    - text.wordCount
    - hidden
    - text.wordcloud
    - doc.categories wikipedia
    - file templates/population-of-the-continents.ohayo
    - data
    - doc.title Population of the Continents
    - samples.populations
    - hidden
    - group.by Continent
    - reduce Population2016 sum Population
    - hidden
    - roughjs.pie Population of the Continents
    - label Continent
    - value Population
    - roughjs.bar Population of the Continents
    - label Continent
    - value Population
    - doc.categories geography
    - file templates/portals.ohayo
    - data
    - doc.title Data Portals
    - samples.portals
    - hidden
    - rows.sortByReverse datasets
    - hidden
    - tables.basic
    - doc.categories dataScience
    - file templates/public-apis.ohayo
    - data
    - doc.title Public APIs
    - doc.subtitle An overview of the Public API project to build a list of free APIs for use in software and web development.
    - publicapis.entries
    - hidden
    - group.by Category
    - hidden
    - vega.bar API Categories
    - filter.where Auth =
    - hidden
    - filter.where Cors = no
    - hidden
    - tables.basic
    - tables.basic
    - doc.categories programming
    - file templates/random.ohayo
    - data
    - doc.title Random Numbers
    - random.int 1000 0 1000
    - hidden
    - vega.scatter 1000 Random numbers between 0 and 100
    - xColumn index
    - yColumn number
    - rows.first 100
    - hidden
    - vega.scatter 100 of those
    - xColumn index
    - yColumn number
    - doc.categories math
    - file templates/reddit.ohayo
    - data
    - doc.title Top Stories on Reddit
    - reddit.all
    - hidden
    - columns.keep title created_utc score subreddit url
    - hidden
    - rows.sortByReverse score
    - tables.basic
    - vega.scatter
    - yColumn score
    - xColumn created_utc
    - vega.bar Top Stories on Reddit Right Now
    - yColumn score
    - doc.categories socialMedia
    - file templates/subreddit.ohayo
    - data
    - doc.title Top stories in a subreddit
    - reddit.sub Astronomy
    - columns.keep title created_utc score subreddit url
    - vega.scatter
    - yColumn score
    - xColumn created_utc
    - list.links
    - doc.categories socialMedia
    - file templates/template-generation.ohayo
    - data
    - doc.title Template Maker
    - doc.categories dataScience
    - samples.presidents
    - text.template Message
    - content
    - Hello {name}!
    - What was {HomeState} like?
    - columns.keep Message
    - hidden
    - tables.basic
    - file templates/tlds.ohayo
    - data
    - doc.title Most Popular Top Level Domains
    - doc.categories web
    - doc.subtitle This script looks at the top 500 domain names. It then extracts the TLD and groups them. The conclusion is that .com is the most popular by about 10x.
    - moz.top500
    - hidden
    - text.reverseSplit RootDomain . tld
    - hidden
    - tables.basic
    - group.by tld
    - hidden
    - rows.sortByReverse count
    - hidden
    - tables.basic
    - vega.bar .com is the most popular TLD by nearly 10x.
    - file templates/trends-in-baby-names.ohayo
    - data
    - doc.title Trends in Baby Names
    - doc.comment Uncomment the below line, and delete the following line, to use the full dataset
    - doc.comment web.get https://raw.githubusercontent.com/hadley/data-baby-names/master/baby-names.csv
    - samples.babyNames
    - filter.where name = Aria
    - filter.where sex = girl
    - vega.line
    - xColumn year
    - yColumn percent
    - doc.categories parenting
    - file templates/trigonometry.ohayo
    - data
    - doc.title Trigonometric Functions
    - math.gen sin 0 10 .1
    - vega.line Sin Wave
    - xColumn input
    - yColumn output
    - math.gen cos 0 10 .1
    - vega.line Cos Wave
    - xColumn input
    - yColumn output
    - math.gen tan 0 10 .1
    - vega.line Tan Wave
    - xColumn input
    - yColumn output
    - doc.categories math
    - file templates/typescript-interface-generator.ohayo
    - data
    - doc.title TypeScript Interface Generator
    - data.inline
    - content
    - state,number
    - Hawaii,50
    - schema.toTypescript
    - hidden
    - html.printAs code
    - doc.categories programming
    - file templates/ucimlr-overview.ohayo
    - data
    - doc.title The Datasets in UCIMLR
    - ucimlr.datasets
    - show.rowCount Total Datasets
    - group.by Category
    - vega.bar
    - doc.comment Filter out missing data:
    - filter.where Year > 1910
    - group.by Year
    - columns.setType Year year
    - vega.bar
    - xColumn Year
    - yColumn count
    - doc.categories dataScience
    - file templates/word-cloud.ohayo
    - data
    - doc.title Word Cloud
    - data.inline
    - text.wordCount
    - text.wordcloud
    - rows.sortByReverse count
    - tables.basic
    - parser text
    - content
    - If you put some text here, you will make yourself a word cloud. The more text you add, the better it will be. So keep writing, writing, writing, and you will get something that looks good.
    - doc.categories writing
    - `
    - "use strict";
    - window.StudioDrums = `panel new createNewBlankProgramCommand ctrl+n New file
    - mounted new cloneTabCommand ctrl+shift+n Clone file
    - panel new createMiniMapCommand shift+m Browse files
    - panel new openCreateNewProgramFromUrlDialogCommand New from Url
    - mounted new createNewSourceCodeVisualizationProgramCommand Visualize Source Code
    - mounted file saveTabAndNotifyCommand command+s Save file
    - mounted file showTabMoveFilePromptCommand Move file
    - mounted file cellCheckProgramCommand shift+c Check file for Errors
    - mounted file showDeleteFileConfirmDialogCommand shift+backspace Delete file
    - panel file openDeleteAllTabsPromptCommand Delete all open files
    - mounted navigation closeMountedProgramCommand ctrl+w Close focused tab
    - panel navigation closeAllTabsCommand ctrl+shift+w Close all tabs
    - mounted navigation mountPreviousTabCommand shift+left Previous tab
    - mounted navigation mountNextTabCommand shift+right Next tab
    - panel navigation openFullDiskFilePathPromptCommand shift+o Open file from path
    - panel navigation openFolderPromptCommand Open folder
    - panel navigation changeWorkingFolderPromptCommand Change working folder
    - mounted selection selectAllTilesCommand command+a Select all tiles
    - mounted selection clearSelectionCommand Clear Selection
    - mounted selection selectNextTileCommand shift+down Select next tile
    - mounted selection selectPreviousTileCommand shift+up Select previous Tile
    - mounted selection deleteSelectionCommand backspace Delete Selection
    - mounted selection duplicateSelectionCommand command+d Duplicate Selection
    - panel window toggleThemeCommand shift+t Toggle Theme
    - panel window toggleGutterCommand shift+u Toggle Source Editor Gutter
    - panel window toggleFullScreenCommand shift+f Toggle Full Screen
    - panel window toggleMenuCommand command+shift+f Toggle Menu
    - panel window closeModalCommand escape Close any open modal
    - mounted window clearTabMessagesCommand command+\\ Clear tab messages
    - panel window toggleAutoSaveCommand Toggle autosave
    - mounted window fetchAndReloadFocusedTabCommand shift+r Re-download and refresh tab
    - mounted edit undoFocusedProgramCommand command+z Undo
    - mounted edit redoFocusedProgramCommand command+shift+z Redo
    - mounted edit insertAdjacentTileCommand shift+i Insert Tile
    - panel ohayo toggleHelpCommand ? Help
    - panel ohayo confirmAndResetAppStateCommand Reset Ohayo Studio
    - panel ohayo toggleTreeComponentFrameworkDebuggerCommand shift+d Toggle TCF Debugger`
    - class AbstractPath {
    - constructor(path) {
    - this._checkPath(path)
    - this._path = path
    - }
    - _checkPath() {}
    - toString() {
    - return this._path.toString()
    - }
    - }
    -
    - class FullFilePath extends AbstractPath {
    - _checkPath(fullPath) {
    - if (!fullPath.startsWith("/")) throw new Error(`File fullPath "${fullPath}" does not begin with /.`)
    - if (fullPath.endsWith("/")) throw new Error(`File fullPath "${fullPath}" cannot end with /.`)
    - if (fullPath.includes("//")) throw new Error(`File fullPath "${fullPath}" cannot include //`)
    - }
    - }
    -
    - class FolderPath extends AbstractPath {
    - _checkPath(folderPath) {
    - if (folderPath.includes("//")) throw new Error(`File folderPath "${folderPath}" cannot include //`)
    - if (!folderPath.startsWith("/") || !folderPath.endsWith("/")) throw new Error(`Bad folder: '${folderPath}'. Folder must start and end with /.`)
    - }
    - }
    -
    - class AbstractPathWithApp {
    - constructor(path, app) {
    - this._checkPath(path, app)
    - this._path = path
    - this._app = app
    - }
    -
    - getDiskId() {
    - return this._path.slice(0).split("/")[0]
    - }
    -
    - getFilePath() {
    - return this._path.replace(/^[^\/]+\//, "/")
    - }
    -
    - toString() {
    - return this._path.toString()
    - }
    - }
    -
    - class FullFolderPath extends AbstractPathWithApp {
    - _checkPath(fullFolderPath, app) {
    - if (fullFolderPath.includes("//")) throw new Error(`File fullFolderPath "${fullFolderPath}" cannot include //`)
    - if (!fullFolderPath.endsWith("/")) throw new Error(`Bad fullFolderPath: '${fullFolderPath}'. Must end with /`)
    - if (fullFolderPath.startsWith("/")) throw new Error(`Bad fullFolderPath: '${fullFolderPath}'. Cannot start with /`)
    - if (!fullFolderPath.includes("/")) throw new Error(`Bad fullFolderPath: '${fullFolderPath}' must have a disk id and a folder path part. No / detected.`)
    - }
    -
    - async getFiles() {
    - return this._app.getDisks()[this.getDiskId()].readFiles(this.getFolderPath())
    - }
    -
    - getFolderPath() {
    - return this.getFilePath()
    - }
    - }
    -
    - class FullDiskPath extends AbstractPathWithApp {
    - _checkPath(fullDiskFilePath, app) {
    - if (fullDiskFilePath.includes("//")) throw new Error(`File fullDiskFilePath "${fullDiskFilePath}" cannot include //`)
    - if (fullDiskFilePath.endsWith("/")) throw new Error(`Bad fullDiskFilePath: '${fullDiskFilePath}'. Cannot end with /`)
    - if (fullDiskFilePath.startsWith("/")) throw new Error(`Bad fullDiskFilePath: '${fullDiskFilePath}'. Cannot start with /`)
    - if (!fullDiskFilePath.includes("/")) throw new Error(`Bad fullDiskFilePath: '${fullDiskFilePath}' must have a disk id and a path part. No / detected.`)
    - }
    -
    - getWithoutFilename() {
    - return this._path.replace(/\/[^\/]+$/, "/")
    - }
    -
    - getFilename() {
    - return this._path.split("/").pop()
    - }
    - }
    -
    - class FileHandle {
    - constructor(fullDiskFilePath, app) {
    - this._fullDiskFilePath = new FullDiskPath(fullDiskFilePath)
    - this._app = app
    - }
    -
    - _getDisk() {
    - return this._app.getDisks()[this._fullDiskFilePath.getDiskId()]
    - }
    -
    - unlinkFile() {
    - return this._getDisk().unlinkFile(this._fullDiskFilePath.getFilePath())
    - }
    -
    - readFile() {
    - return this._getDisk().readFile(this._fullDiskFilePath.getFilePath())
    - }
    -
    - writeFile(newVersion) {
    - return this._getDisk().writeFile(this._fullDiskFilePath.getFilePath(), newVersion)
    - }
    - }
    -
    - window.FullFilePath = FullFilePath
    -
    - window.FolderPath = FolderPath
    -
    - window.FullFolderPath = FullFolderPath
    -
    - window.FullDiskPath = FullDiskPath
    -
    - window.FileHandle = FileHandle
    - ;
    -
    -
    -
    - class AbstractDisk {
    - constructor(rootTreeComponent) {
    - this._rootTreeComponent = rootTreeComponent
    - }
    -
    - getPathBase() {
    - return this.getDisplayName() + this.getFolder()
    - }
    -
    - getRootTreeComponent() {
    - return this._rootTreeComponent
    - }
    -
    - getFolder() {
    - return this._folder || "/"
    - }
    -
    - setFolder(folderPath) {
    - this._folder = new FolderPath(folderPath).toString()
    - return this
    - }
    - }
    -
    - window.AbstractDisk
    - = AbstractDisk
    - ;
    -
    -
    -
    -
    - // todo: add a file type. program in PanelTreeComponent will be a child off
    - // File. then we can have diskFile, remoteFile, folderFile, templateFile, localstorageFile, et cetera.,
    - // each with it's own storage strategy. they can extend tree notation. they can implment fetch. they can
    - // handle readonly, et cetera. google docs file. dropbox file. derivative file (for example, from a png).
    - // then the bytes of the file get turned into a program. there are Tree Languages ohayo/fire caddoes and then there
    - // are non-treeLanguage files like pngs and JS, et cetera, that we can build ohayo in-memory templates for.
    -
    - // folders and files =>
    -
    - class AbstractFile extends jtree.TreeNode {
    - getFileLink() {
    - return this.getLine()
    - }
    -
    - getFilename() {
    - return new FullDiskPath(this.getLine()).getFilename()
    - }
    -
    - toFileObject() {
    - const str = this.childrenToString()
    - return {
    - filename: this.getFilename(),
    - link: this.getFileLink(),
    - size: str.length,
    - bytes: str
    - }
    - }
    - }
    -
    - window.AbstractFile
    - = AbstractFile
    - ;
    -
    -
    -
    -
    -
    - class ServerStorageFile extends AbstractFile {}
    -
    - // todo: use same constants file on serverside.
    -
    - class ServerStorageDisk extends AbstractDisk {
    - _getWillow() {
    - return this.getRootTreeComponent().getWillowBrowser()
    - }
    -
    - async _httpPostUrl(method, options) {
    - const response = await this._getWillow().httpPostUrl("/serverStorage." + method, options)
    - return response.text
    - }
    -
    - getDisplayName() {
    - return this._getWillow().getHost()
    - }
    -
    - async readFiles(folder = this.getFolder()) {
    - // todo: speed tests/checks
    - const response = await this._getWillow().httpGetUrl("/serverStorage.list", { folder: folder })
    - return response.body.map(file => new ServerStorageFile(file.data, this.getDisplayName() + folder + file.name))
    - }
    -
    - async getAvailablePermalink(permalink) {
    - const fullPath = this.getFolder() + permalink
    - const res = await this._httpPostUrl("getAvailablePermalink", { permalink: new FullFilePath(fullPath).toString() })
    - return res
    - }
    -
    - async unlinkFile(fullPath) {
    - const res = await this._httpPostUrl("delete", { fullPath: new FullFilePath(fullPath).toString() })
    - return res
    - }
    -
    - async writeFile(fullPath, newVersion) {
    - // todo: speed tests/checks
    - try {
    - const res = await this._httpPostUrl("write", { fullPath: new FullFilePath(fullPath).toString(), newVersion: newVersion })
    - return res
    - } catch (err) {
    - console.error(err)
    - throw new Error("Save failed!")
    - }
    - }
    -
    - async exists(fullPath) {
    - const res = await this._httpPostUrl("exists", { fullPath: new FullFilePath(fullPath).toString() })
    - return res.toString() === "true"
    - }
    -
    - async readFile(fullPath) {
    - // todo: speed tests/checks
    - const res = await this._httpPostUrl("read", { fullPath: new FullFilePath(fullPath).toString() })
    - return res
    - }
    - }
    -
    - window.ServerStorageDisk
    - = ServerStorageDisk
    - ;
    -
    - const StorageKeys = {}
    - StorageKeys.autoSave = "__autoSave"
    - StorageKeys.appState = "__appState"
    - StorageKeys.visitCount = "__visitCount"
    - StorageKeys.workingFolderFullDiskFolderPath = "__workingFolderFullDiskFolderPath"
    -
    - StorageKeys.isKey = key => {
    - if (!StorageKeys._storageKeysmap) {
    - StorageKeys._storageKeysmap = {}
    - Object.values(StorageKeys).forEach(value => (StorageKeys._storageKeysmap[value] = true))
    - }
    - return StorageKeys._storageKeysmap[key]
    - }
    -
    - window.StorageKeys
    - = StorageKeys
    - ;
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - class LocalStorageFile extends AbstractFile {}
    -
    - class LocalStorageDisk extends AbstractDisk {
    - async readFiles() {
    - return this.readFilesSync()
    - }
    -
    - readFilesSync() {
    - const app = this.getRootTreeComponent()
    - return app
    - .getStoreKeys()
    - .filter(key => !StorageKeys.isKey(key))
    - .filter(key => key.startsWith("/"))
    - .map(filename => new LocalStorageFile(app.getFromStore(filename), this.getDisplayName() + filename))
    - }
    -
    - getDisplayName() {
    - return "localStorage"
    - }
    -
    - async unlinkFile(fullPath) {
    - this.getRootTreeComponent().removeValue(new FullFilePath(fullPath))
    - }
    -
    - async getAvailablePermalink(permalink) {
    - const app = this.getRootTreeComponent()
    - return this.getFolder() + jtree.Utils.getAvailablePermalink(permalink, fullPath => app.getFromStore(this.getFolder() + fullPath) !== undefined)
    - }
    -
    - async exists(fullPath) {
    - return this.getRootTreeComponent().getFromStore(new FullFilePath(fullPath)) !== undefined
    - }
    -
    - async writeFile(fullPath, newVersion) {
    - this.getRootTreeComponent().storeValue(new FullFilePath(fullPath), newVersion)
    - }
    -
    - async readFile(fullPath) {
    - return this.getRootTreeComponent().getFromStore(new FullFilePath(fullPath))
    - }
    - }
    -
    - window.LocalStorageDisk
    - = LocalStorageDisk
    - ;
    -
    - const DemoTemplates = `faq.ohayo
    - web.get ohayo/packages/samples/faq.md
    - parser text
    - hidden
    - markdown.toHtml
    - ohayo.ohayo
    - web.get ohayo/packages/samples/welcome.md
    - parser text
    - hidden
    - markdown.toHtml
    - templates.list
    - challenge.list`
    -
    - window.DemoTemplates
    - = DemoTemplates
    - ;
    -
    - // todo: title should be folder name?
    - const MiniTemplate = `editor.files
    - hidden
    - rows.sortBy link
    - hidden
    - editor.gallery`
    -
    - window.MiniTemplate
    - = MiniTemplate
    - ;
    -
    -
    -
    - const OhayoCodeEditorTemplate = (source, fileName, treeLanguage) =>
    - new jtree.TreeNode(`doc.title Source code visualization of {fileName}
    - data.inline
    - parser text
    - treeLanguage {treeLanguage}
    - text.lineCount
    - show.median lines Total lines
    - text.wordCount
    - show.sum count Total words
    - treenotation.3d
    - treenotation.outline
    - treenotation.wordTypes
    - html.printAs pre
    - text.wordCount
    - tables.basic
    - text.wordcloud
    - content
    - {source}`).templateToString({ source, fileName, treeLanguage })
    -
    - window.OhayoCodeEditorTemplate
    - = OhayoCodeEditorTemplate
    - ;
    -
    - const OhayoTemplates = {}
    -
    - OhayoTemplates._fromDelimited = (filename, data, app) => {
    - const key = app.initLocalDataStorage(filename, data)
    - return `data.localStorage ${key}
    - tables.basic`
    - }
    -
    - OhayoTemplates.tsv = OhayoTemplates._fromDelimited
    -
    - OhayoTemplates.json = (filename, data, app) => {
    - const key = app.initLocalDataStorage(filename, data)
    - return `data.localStorage ${key}`
    - }
    -
    - OhayoTemplates.csv = (filename, data, app) => {
    - // todo: remove \r?
    - // check csv subtypes
    - const isMultiCsv = data.split("\n\n").length > 3
    - if (isMultiCsv) return OhayoTemplates._multiCsv(filename, data, app)
    - return OhayoTemplates._fromDelimited(filename, data, app)
    - }
    -
    - OhayoTemplates._multiCsv = (filename, data, app) => {
    - return data
    - .split("\n\n")
    - .map(t => t.trim())
    - .filter(t => t)
    - .map(table => {
    - const rows = table.split("\n")
    - const tableName = rows.shift()
    - const key = app.initLocalDataStorage(filename + "-" + tableName, rows.join("\n"))
    - return `data.localStorage ${key}
    - tables.basic ${tableName}`
    - })
    - .join("\n")
    - }
    -
    - window.OhayoTemplates
    - = OhayoTemplates
    - ;
    -
    - const SpeedTestTemplate = (title, rows) =>
    - `data.inline
    - content
    - ${rows.replace(/\n/g, "\n ")}
    - html.h1 ${title}
    - rows.sortBy timeToLoad
    - rows.reverse
    - doc.subtitle Slow Load Times
    - tables.basic
    - rows.sortBy timeToRender
    - rows.reverse
    - doc.subtitle Slow Render Times
    - tables.basic
    - show.mean timeToLoad
    - show.mean timeToRender
    - show.median timeToRender
    - show.sum timeToLoad
    - show.sum timeToRender
    - show.rowCount`
    -
    - window.SpeedTestTemplate
    - = SpeedTestTemplate
    - ;
    -
    - const CodeMirrorCss = `.CodeMirror {
    - font-family: monospace;
    - height: 300px;
    - color: #000
    - }
    -
    - .CodeMirror-lines {
    - padding: 4px 0
    - }
    -
    - .CodeMirror pre {
    - padding: 0 4px
    - }
    -
    - .CodeMirror-scrollbar-filler,
    - .CodeMirror-gutter-filler {
    - background-color: #fff
    - }
    -
    - .CodeMirror-gutters {
    - border-right: 0;
    - background-color: #f7f7f7;
    - white-space: nowrap
    - }
    -
    - .CodeMirror-linenumber {
    - padding: 0 3px 0 5px;
    - min-width: 20px;
    - text-align: right;
    - color: #999;
    - white-space: nowrap
    - }
    -
    - .CodeMirror-guttermarker {
    - color: #000
    - }
    -
    - .CodeMirror-guttermarker-subtle {
    - color: #999
    - }
    -
    - .CodeMirror-cursor {
    - border-left: 1px solid #000;
    - border-right: none;
    - width: 0
    - }
    -
    - .CodeMirror div.CodeMirror-secondarycursor {
    - border-left: 1px solid silver
    - }
    -
    - .cm-fat-cursor .CodeMirror-cursor {
    - width: auto;
    - border: 0!important;
    - background: #7e7
    - }
    -
    - .cm-fat-cursor div.CodeMirror-cursors {
    - z-index: 1
    - }
    -
    - .cm-animate-fat-cursor {
    - width: auto;
    - border: 0;
    - -webkit-animation: blink 1.06s steps(1) infinite;
    - -moz-animation: blink 1.06s steps(1) infinite;
    - animation: blink 1.06s steps(1) infinite;
    - background-color: #7e7
    - }
    -
    - @-moz-keyframes blink {
    - 50% {
    - background-color: transparent
    - }
    - }
    -
    - @-webkit-keyframes blink {
    - 50% {
    - background-color: transparent
    - }
    - }
    -
    - @keyframes blink {
    - 50% {
    - background-color: transparent
    - }
    - }
    -
    - .cm-tab {
    - display: inline-block;
    - text-decoration: inherit
    - }
    -
    - .CodeMirror-rulers {
    - position: absolute;
    - left: 0;
    - right: 0;
    - top: -50px;
    - bottom: -20px;
    - overflow: hidden
    - }
    -
    - .CodeMirror-ruler {
    - border-left: 1px solid #ccc;
    - top: 0;
    - bottom: 0;
    - position: absolute
    - }
    -
    - .cm-s-default .cm-header {
    - color: blue
    - }
    -
    - .cm-s-default .cm-quote {
    - color: #090
    - }
    -
    - .cm-negative {
    - color: #d44
    - }
    -
    - .cm-positive {
    - color: #292
    - }
    -
    - .cm-header,
    - .cm-strong {
    - font-weight: 700
    - }
    -
    - .cm-em {
    - font-style: italic
    - }
    -
    - .cm-link {
    - text-decoration: underline
    - }
    -
    - .cm-strikethrough {
    - text-decoration: line-through
    - }
    -
    - .cm-s-default .cm-keyword {
    - color: #708
    - }
    -
    - .cm-s-default .cm-atom {
    - color: #219
    - }
    -
    - .cm-s-default .cm-number {
    - color: #164
    - }
    -
    - .cm-s-default .cm-def {
    - color: #00f
    - }
    -
    - .cm-s-default .cm-variable-2 {
    - color: #05a
    - }
    -
    - .cm-s-default .cm-variable-3,
    - .cm-s-default .cm-type {
    - color: #085
    - }
    -
    - .cm-s-default .cm-comment {
    - color: #a50
    - }
    -
    - .cm-s-default .cm-string {
    - color: #a11
    - }
    -
    - .cm-s-default .cm-string-2 {
    - color: #f50
    - }
    -
    - .cm-s-default .cm-meta {
    - color: #555
    - }
    -
    - .cm-s-default .cm-qualifier {
    - color: #555
    - }
    -
    - .cm-s-default .cm-builtin {
    - color: #30a
    - }
    -
    - .cm-s-default .cm-bracket {
    - color: #997
    - }
    -
    - .cm-s-default .cm-tag {
    - color: #170
    - }
    -
    - .cm-s-default .cm-attribute {
    - color: #00c
    - }
    -
    - .cm-s-default .cm-hr {
    - color: #999
    - }
    -
    - .cm-s-default .cm-link {
    - color: #00c
    - }
    -
    - .cm-s-default .cm-error {
    - color: red
    - }
    -
    - .cm-invalidchar {
    - color: red
    - }
    -
    - .CodeMirror-composing {
    - border-bottom: 2px solid
    - }
    -
    - div.CodeMirror span.CodeMirror-matchingbracket {
    - color: #0f0
    - }
    -
    - div.CodeMirror span.CodeMirror-nonmatchingbracket {
    - color: #f22
    - }
    -
    - .CodeMirror-matchingtag {
    - background: rgba(255, 150, 0, .3)
    - }
    -
    - .CodeMirror-activeline-background {
    - background: #e8f2ff
    - }
    -
    - .CodeMirror {
    - position: relative;
    - overflow: hidden;
    - background: #fff
    - }
    -
    - .CodeMirror-scroll {
    - overflow: scroll!important;
    - margin-bottom: -30px;
    - margin-right: -30px;
    - padding-bottom: 30px;
    - height: 100%;
    - outline: none;
    - position: relative
    - }
    -
    - .CodeMirror-sizer {
    - position: relative;
    - border-right: 30px solid transparent
    - }
    -
    - .CodeMirror-vscrollbar,
    - .CodeMirror-hscrollbar,
    - .CodeMirror-scrollbar-filler,
    - .CodeMirror-gutter-filler {
    - position: absolute;
    - z-index: 6;
    - display: none
    - }
    -
    - .CodeMirror-vscrollbar {
    - right: 0;
    - top: 0;
    - overflow-x: hidden;
    - overflow-y: scroll
    - }
    -
    - .CodeMirror-hscrollbar {
    - bottom: 0;
    - left: 0;
    - overflow-y: hidden;
    - overflow-x: scroll
    - }
    -
    - .CodeMirror-scrollbar-filler {
    - right: 0;
    - bottom: 0
    - }
    -
    - .CodeMirror-gutter-filler {
    - left: 0;
    - bottom: 0
    - }
    -
    - .CodeMirror-gutters {
    - position: absolute;
    - left: 0;
    - top: 0;
    - min-height: 100%;
    - z-index: 3
    - }
    -
    - .CodeMirror-gutter {
    - white-space: normal;
    - height: 100%;
    - display: inline-block;
    - vertical-align: top;
    - margin-bottom: -30px
    - }
    -
    - .CodeMirror-gutter-wrapper {
    - position: absolute;
    - z-index: 4;
    - background: none!important;
    - border: none!important
    - }
    -
    - .CodeMirror-gutter-background {
    - position: absolute;
    - top: 0;
    - bottom: 0;
    - z-index: 4
    - }
    -
    - .CodeMirror-gutter-elt {
    - position: absolute;
    - cursor: default;
    - z-index: 4
    - }
    -
    - .CodeMirror-gutter-wrapper ::selection {
    - background-color: transparent
    - }
    -
    - .CodeMirror-gutter-wrapper ::-moz-selection {
    - background-color: transparent
    - }
    -
    - .CodeMirror-lines {
    - cursor: text;
    - min-height: 1px
    - }
    -
    - .CodeMirror pre {
    - -moz-border-radius: 0;
    - -webkit-border-radius: 0;
    - border-radius: 0;
    - border-width: 0;
    - background: transparent;
    - font-family: inherit;
    - font-size: inherit;
    - margin: 0;
    - white-space: pre;
    - word-wrap: normal;
    - line-height: inherit;
    - color: inherit;
    - z-index: 2;
    - position: relative;
    - overflow: visible;
    - -webkit-tap-highlight-color: transparent;
    - -webkit-font-variant-ligatures: contextual;
    - font-variant-ligatures: contextual
    - }
    -
    - .CodeMirror-wrap pre {
    - word-wrap: break-word;
    - white-space: pre-wrap;
    - word-break: normal
    - }
    -
    - .CodeMirror-linebackground {
    - position: absolute;
    - left: 0;
    - right: 0;
    - top: 0;
    - bottom: 0;
    - z-index: 0
    - }
    -
    - .CodeMirror-linewidget {
    - position: relative;
    - z-index: 2;
    - overflow: auto
    - }
    -
    - .CodeMirror-rtl pre {
    - direction: rtl
    + abstractNonTerminalNode
    + inScope abstractTerminalNode abstractNonTerminalNode
    + abstract
    + cells keywordCell
    + abstractJsblockNode
    + compiler
    + openChildren {
    + closeChildren }
    + extends abstractNonTerminalNode
    + abstract
    + blockNode
    + description block of code
    + frequency .2
    + compiler
    + stringTemplate /* {identifierCell} */
    + extends abstractJsblockNode
    + crux block
    + functionNode
    + crux function
    + description Function Assignment
    + cells keywordCell functionIdentifierCell
    + catchAllCellType anyCell
    + compiler
    + stringTemplate const {functionIdentifierCell} = ({anyCell}) =>
    + catchAllCellDelimiter ,
    + frequency .1
    + extends abstractJsblockNode
    + ifNode
    + crux if
    + description If tile
    + cells keywordCell identifierCell
    + frequency .2
    + compiler
    + stringTemplate if ({identifierCell})
    + extends abstractJsblockNode
    + whileNode
    + crux while
    + description While tile
    + cells keywordCell identifierCell
    + frequency .1
    + compiler
    + stringTemplate while ({identifierCell})
    + extends abstractJsblockNode
    + abstractTerminalNode
    + abstract
    + cells keywordCell
    + abstractAssignmentNode
    + extends abstractTerminalNode
    + abstract
    + abstractArithmeticNode
    + cells keywordCell identifierCell
    + catchAllCellType anyCell
    + compiler
    + stringTemplate const {identifierCell} = {anyCell}
    + frequency .2
    + extends abstractAssignmentNode
    + abstract
    + divideNode
    + description Divide Numbers
    + compiler
    + catchAllCellDelimiter /
    + extends abstractArithmeticNode
    + crux divide
    + moduloNode
    + description Modulo Numbers
    + compiler
    + catchAllCellDelimiter %
    + extends abstractArithmeticNode
    + crux modulo
    + multiplyNode
    + description Multiply Numbers
    + compiler
    + catchAllCellDelimiter *
    + extends abstractArithmeticNode
    + crux multiply
    + substractNode
    + description Subtract Numbers
    + compiler
    + catchAllCellDelimiter -
    + extends abstractArithmeticNode
    + crux substract
    + addNode
    + crux add
    + example
    + add ten 2 3 5
    + description Add numbers and store result
    + compiler
    + catchAllCellDelimiter +
    + extends abstractArithmeticNode
    + abstractBooleanOperatorNode
    + description Runs a boolean test and saves result.
    + extends abstractAssignmentNode
    + abstract
    + greaterThanNode
    + description Greater than test
    + cells keywordCell identifierCell leftNumberCell numberCell
    + compiler
    + stringTemplate const {identifierCell} = {leftNumberCell} > {numberCell}
    + frequency .1
    + extends abstractBooleanOperatorNode
    + crux greaterThan
    + greaterThanOrEqualNode
    + description Greater than or equal to test
    + cells keywordCell identifierCell leftNumberCell numberCell
    + compiler
    + stringTemplate const {identifierCell} = {leftNumberCell} >= {numberCell}
    + frequency .1
    + extends abstractBooleanOperatorNode
    + crux greaterThanOrEqual
    + lessThanNode
    + description Less than test
    + cells keywordCell identifierCell leftAnyCell anyCell
    + compiler
    + stringTemplate const {identifierCell} = {leftAnyCell} < {anyCell}
    + frequency .1
    + extends abstractBooleanOperatorNode
    + crux lessThan
    + lessThanOrEqualNode
    + crux lessThanOrEqual
    + description Less than or equal to test
    + cells keywordCell identifierCell leftAnyCell anyCell
    + compiler
    + stringTemplate const {identifierCell} = {leftAnyCell} <= {anyCell}
    + frequency .1
    + extends abstractBooleanOperatorNode
    + sumNode
    + crux sum
    + description Add numbers and store result
    + cells keywordCell numberIdentifierCell
    + catchAllCellType numberCell
    + compiler
    + stringTemplate const {numberIdentifierCell} = [{numberCell}].reduce((sum, num) => sum + num)
    + catchAllCellDelimiter ,
    + frequency .1
    + extends abstractAssignmentNode
    + booleanNode
    + crux boolean
    + description Boolean Assignment
    + cells keywordCell booleanIdentifierCell booleanCell
    + compiler
    + stringTemplate const {booleanIdentifierCell} = {booleanCell}
    + extends abstractAssignmentNode
    + callFunctionAndSetNode
    + crux callFunctionAndSet
    + description Function Call
    + frequency .5
    + cells keywordCell resultIdentifierCell functionIdentifierCell
    + catchAllCellType anyCell
    + compiler
    + stringTemplate const {resultIdentifierCell} = {functionIdentifierCell}({anyCell})
    + catchAllCellDelimiter ,
    + extends abstractAssignmentNode
    + callMethodAndSetNode
    + crux callMethodAndSet
    + description Method Call
    + frequency .5
    + cells keywordCell resultIdentifierCell instanceIdentifierCell methodIdentifierCell
    + catchAllCellType anyCell
    + compiler
    + stringTemplate const {resultIdentifierCell} = {instanceIdentifierCell}.{methodIdentifierCell}({anyCell})
    + catchAllCellDelimiter ,
    + extends abstractAssignmentNode
    + joinNode
    + crux join
    + description Join strings to form new string
    + cells keywordCell identifierCell
    + catchAllCellType identifiersCell
    + compiler
    + stringTemplate const {identifierCell} = [{identifiersCell}].join("")
    + catchAllCellDelimiter ,
    + frequency .2
    + extends abstractAssignmentNode
    + mutableNumberNode
    + crux mutableNumber
    + description Mutable Number Assignment
    + cells keywordCell identifierCell numberCell
    + compiler
    + stringTemplate let {identifierCell} = {numberCell}
    + extends abstractAssignmentNode
    + numberNode
    + crux number
    + description Number Assignment
    + cells keywordCell identifierCell numberCell
    + compiler
    + stringTemplate const {identifierCell} = {numberCell}
    + frequency .3
    + extends abstractAssignmentNode
    + numbersNode
    + crux numbers
    + description Number Array Assignment
    + cells keywordCell identifierCell
    + catchAllCellType numberCell
    + frequency .4
    + compiler
    + stringTemplate const {identifierCell} = [{numberCell}]
    + catchAllCellDelimiter ,
    + extends abstractAssignmentNode
    + stringNode
    + crux string
    + description String Assignment
    + cells keywordCell stringIdentifierCell
    + catchAllCellType anyCell
    + compiler
    + stringTemplate const {stringIdentifierCell} = "{anyCell}"
    + frequency .2
    + extends abstractAssignmentNode
    + callFunctionNode
    + crux callFunction
    + description Function call ignore result.
    + frequency .1
    + cells keywordCell functionIdentifierCell
    + catchAllCellType anyCell
    + compiler
    + stringTemplate {functionIdentifierCell}({anyCell})
    + catchAllCellDelimiter ,
    + extends abstractTerminalNode
    + decrementNode
    + crux decrement
    + description Decrement
    + cells keywordCell numberIdentifierCell
    + compiler
    + stringTemplate {numberIdentifierCell}--
    + frequency .1
    + extends abstractTerminalNode
    + dumpIdentifierNode
    + crux dumpIdentifier
    + description Dump variable(s) to console
    + catchAllCellType identifierCell
    + compiler
    + stringTemplate console.log({identifierCell})
    + catchAllCellDelimiter ,
    + frequency .5
    + extends abstractTerminalNode
    + exportNode
    + crux export
    + description Export This
    + cells keywordCell identifierCell
    + compiler
    + stringTemplate module.exports = {identifierCell}
    + frequency .1
    + extends abstractTerminalNode
    + incrementNode
    + crux increment
    + description Increment
    + frequency .3
    + cells keywordCell numberIdentifierCell
    + compiler
    + stringTemplate {numberIdentifierCell}++
    + extends abstractTerminalNode
    + printNumberNode
    + crux printNumber
    + extends abstractTerminalNode
    + catchAllCellType numberIdentifierCell
    + compiler
    + stringTemplate console.log({numberIdentifierCell})
    + printStringNode
    + crux printString
    + todo Allow printing of multiline strings
    + extends abstractTerminalNode
    + catchAllCellType stringCellsCell
    + compiler
    + stringTemplate console.log("{stringCells}")
    + requireNode
    + crux require
    + description Require Something
    + cells keywordCell identifierCell filepathCell
    + compiler
    + stringTemplate const {identifierCell} = require("{filepathCell}")
    + frequency .1
    + extends abstractTerminalNode
    + returnNode
    + crux return
    + cells keywordCell anyCell
    + compiler
    + stringTemplate return {anyCell}
    + frequency .1
    + extends abstractTerminalNode
    + hashbangNode
    + crux #!
    + description Standard bash hashbang line.
    + catchAllCellType hashBangCell
    + compiler
    + stringTemplate // #! {hashBangCell}
    + cells hashBangKeywordCell
    + errorNode
    + baseNodeType errorNode
    + compiler
    + stringTemplate // error`)
    + return this._cachedHandGrammarProgramRoot
    + }
    + static getNodeTypeMap() {
    + return {
    + fireNode: fireNode,
    + abstractNonTerminalNode: abstractNonTerminalNode,
    + abstractJsblockNode: abstractJsblockNode,
    + blockNode: blockNode,
    + functionNode: functionNode,
    + ifNode: ifNode,
    + whileNode: whileNode,
    + abstractTerminalNode: abstractTerminalNode,
    + abstractAssignmentNode: abstractAssignmentNode,
    + abstractArithmeticNode: abstractArithmeticNode,
    + divideNode: divideNode,
    + moduloNode: moduloNode,
    + multiplyNode: multiplyNode,
    + substractNode: substractNode,
    + addNode: addNode,
    + abstractBooleanOperatorNode: abstractBooleanOperatorNode,
    + greaterThanNode: greaterThanNode,
    + greaterThanOrEqualNode: greaterThanOrEqualNode,
    + lessThanNode: lessThanNode,
    + lessThanOrEqualNode: lessThanOrEqualNode,
    + sumNode: sumNode,
    + booleanNode: booleanNode,
    + callFunctionAndSetNode: callFunctionAndSetNode,
    + callMethodAndSetNode: callMethodAndSetNode,
    + joinNode: joinNode,
    + mutableNumberNode: mutableNumberNode,
    + numberNode: numberNode,
    + numbersNode: numbersNode,
    + stringNode: stringNode,
    + callFunctionNode: callFunctionNode,
    + decrementNode: decrementNode,
    + dumpIdentifierNode: dumpIdentifierNode,
    + exportNode: exportNode,
    + incrementNode: incrementNode,
    + printNumberNode: printNumberNode,
    + printStringNode: printStringNode,
    + requireNode: requireNode,
    + returnNode: returnNode,
    + hashbangNode: hashbangNode,
    + errorNode: errorNode,
    + }
    + }
    + }
    +
    + class abstractNonTerminalNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + undefined,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    + block: blockNode,
    + function: functionNode,
    + if: ifNode,
    + while: whileNode,
    + divide: divideNode,
    + modulo: moduloNode,
    + multiply: multiplyNode,
    + substract: substractNode,
    + add: addNode,
    + greaterThan: greaterThanNode,
    + greaterThanOrEqual: greaterThanOrEqualNode,
    + lessThan: lessThanNode,
    + lessThanOrEqual: lessThanOrEqualNode,
    + sum: sumNode,
    + boolean: booleanNode,
    + callFunctionAndSet: callFunctionAndSetNode,
    + callMethodAndSet: callMethodAndSetNode,
    + join: joinNode,
    + mutableNumber: mutableNumberNode,
    + number: numberNode,
    + numbers: numbersNode,
    + string: stringNode,
    + callFunction: callFunctionNode,
    + decrement: decrementNode,
    + dumpIdentifier: dumpIdentifierNode,
    + export: exportNode,
    + increment: incrementNode,
    + printNumber: printNumberNode,
    + printString: printStringNode,
    + require: requireNode,
    + return: returnNode,
    + }),
    + undefined
    + )
    + }
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + }
    +
    + class abstractJsblockNode extends abstractNonTerminalNode {}
    +
    + class blockNode extends abstractJsblockNode {}
    +
    + class functionNode extends abstractJsblockNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get functionIdentifierCell() {
    + return this.getWord(1)
    + }
    + get anyCell() {
    + return this.getWordsFrom(2)
    + }
    + }
    +
    + class ifNode extends abstractJsblockNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get identifierCell() {
    + return this.getWord(1)
    + }
    + }
    +
    + class whileNode extends abstractJsblockNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get identifierCell() {
    + return this.getWord(1)
    + }
    + }
    +
    + class abstractTerminalNode extends jtree.GrammarBackedNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + }
    +
    + class abstractAssignmentNode extends abstractTerminalNode {}
    +
    + class abstractArithmeticNode extends abstractAssignmentNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get identifierCell() {
    + return this.getWord(1)
    + }
    + get anyCell() {
    + return this.getWordsFrom(2)
    + }
    + }
    +
    + class divideNode extends abstractArithmeticNode {}
    +
    + class moduloNode extends abstractArithmeticNode {}
    +
    + class multiplyNode extends abstractArithmeticNode {}
    +
    + class substractNode extends abstractArithmeticNode {}
    +
    + class addNode extends abstractArithmeticNode {}
    +
    + class abstractBooleanOperatorNode extends abstractAssignmentNode {}
    +
    + class greaterThanNode extends abstractBooleanOperatorNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get identifierCell() {
    + return this.getWord(1)
    + }
    + get leftNumberCell() {
    + return parseFloat(this.getWord(2))
    + }
    + get numberCell() {
    + return parseFloat(this.getWord(3))
    + }
    + }
    +
    + class greaterThanOrEqualNode extends abstractBooleanOperatorNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get identifierCell() {
    + return this.getWord(1)
    + }
    + get leftNumberCell() {
    + return parseFloat(this.getWord(2))
    + }
    + get numberCell() {
    + return parseFloat(this.getWord(3))
    + }
    + }
    +
    + class lessThanNode extends abstractBooleanOperatorNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get identifierCell() {
    + return this.getWord(1)
    + }
    + get leftAnyCell() {
    + return this.getWord(2)
    + }
    + get anyCell() {
    + return this.getWord(3)
    + }
    + }
    +
    + class lessThanOrEqualNode extends abstractBooleanOperatorNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get identifierCell() {
    + return this.getWord(1)
    + }
    + get leftAnyCell() {
    + return this.getWord(2)
    + }
    + get anyCell() {
    + return this.getWord(3)
    + }
    + }
    +
    + class sumNode extends abstractAssignmentNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get numberIdentifierCell() {
    + return this.getWord(1)
    + }
    + get numberCell() {
    + return this.getWordsFrom(2).map((val) => parseFloat(val))
    + }
    + }
    +
    + class booleanNode extends abstractAssignmentNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get booleanIdentifierCell() {
    + return this.getWord(1)
    + }
    + get booleanCell() {
    + return this.getWord(2)
    + }
    + }
    +
    + class callFunctionAndSetNode extends abstractAssignmentNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get resultIdentifierCell() {
    + return this.getWord(1)
    + }
    + get functionIdentifierCell() {
    + return this.getWord(2)
    + }
    + get anyCell() {
    + return this.getWordsFrom(3)
    + }
    + }
    +
    + class callMethodAndSetNode extends abstractAssignmentNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get resultIdentifierCell() {
    + return this.getWord(1)
    + }
    + get instanceIdentifierCell() {
    + return this.getWord(2)
    + }
    + get methodIdentifierCell() {
    + return this.getWord(3)
    + }
    + get anyCell() {
    + return this.getWordsFrom(4)
    + }
    + }
    +
    + class joinNode extends abstractAssignmentNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get identifierCell() {
    + return this.getWord(1)
    + }
    + get identifiersCell() {
    + return this.getWordsFrom(2)
    + }
    + }
    +
    + class mutableNumberNode extends abstractAssignmentNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get identifierCell() {
    + return this.getWord(1)
    + }
    + get numberCell() {
    + return parseFloat(this.getWord(2))
    + }
    + }
    +
    + class numberNode extends abstractAssignmentNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get identifierCell() {
    + return this.getWord(1)
    + }
    + get numberCell() {
    + return parseFloat(this.getWord(2))
    + }
    + }
    +
    + class numbersNode extends abstractAssignmentNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get identifierCell() {
    + return this.getWord(1)
    + }
    + get numberCell() {
    + return this.getWordsFrom(2).map((val) => parseFloat(val))
    + }
    + }
    +
    + class stringNode extends abstractAssignmentNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get stringIdentifierCell() {
    + return this.getWord(1)
    + }
    + get anyCell() {
    + return this.getWordsFrom(2)
    + }
    + }
    +
    + class callFunctionNode extends abstractTerminalNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get functionIdentifierCell() {
    + return this.getWord(1)
    + }
    + get anyCell() {
    + return this.getWordsFrom(2)
    + }
    + }
    +
    + class decrementNode extends abstractTerminalNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get numberIdentifierCell() {
    + return this.getWord(1)
    + }
    + }
    +
    + class dumpIdentifierNode extends abstractTerminalNode {
    + get identifierCell() {
    + return this.getWordsFrom(0)
    + }
    + }
    +
    + class exportNode extends abstractTerminalNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get identifierCell() {
    + return this.getWord(1)
    + }
    + }
    +
    + class incrementNode extends abstractTerminalNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get numberIdentifierCell() {
    + return this.getWord(1)
    + }
    + }
    +
    + class printNumberNode extends abstractTerminalNode {
    + get numberIdentifierCell() {
    + return this.getWordsFrom(0)
    + }
    + }
    +
    + class printStringNode extends abstractTerminalNode {
    + get stringCellsCell() {
    + return this.getWordsFrom(0)
    + }
    + }
    +
    + class requireNode extends abstractTerminalNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get identifierCell() {
    + return this.getWord(1)
    + }
    + get filepathCell() {
    + return this.getWord(2)
    + }
    + }
    +
    + class returnNode extends abstractTerminalNode {
    + get keywordCell() {
    + return this.getWord(0)
    + }
    + get anyCell() {
    + return this.getWord(1)
    + }
    + }
    +
    + class hashbangNode extends jtree.GrammarBackedNode {
    + get hashBangKeywordCell() {
    + return this.getWord(0)
    + }
    + get hashBangCell() {
    + return this.getWordsFrom(1)
    + }
    + }
    +
    + class errorNode extends jtree.GrammarBackedNode {
    + getErrors() {
    + return this._getErrorNodeErrors()
    + }
    + }
    +
    + window.fireNode = fireNode
    + {
    + class hakonNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(selectorNode, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { comment: commentNode }), undefined)
    + }
    + getSelector() {
    + return ""
    + }
    + compile() {
    + return this.getTopDownArray()
    + .filter((node) => node.isSelectorNode)
    + .map((child) => child.compile())
    + .join("")
    + }
    + getHandGrammarProgram() {
    + if (!this._cachedHandGrammarProgramRoot)
    + this._cachedHandGrammarProgramRoot = new jtree.HandGrammarProgram(`tooling onsave jtree build produceLang hakon
    + anyCell
    + keywordCell
    + commentKeywordCell
    + extends keywordCell
    + highlightScope comment
    + enum comment
    + extraCell
    + highlightScope invalid
    + cssValueCell
    + highlightScope constant.numeric
    + selectorCell
    + highlightScope keyword.control
    + examples body h1
    + todo add html tags, css and ids selector regexes, etc
    + propertyKeywordCell
    + highlightScope variable.function
    + extends keywordCell
    + enum align-content align-items align-self all animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function backface-visibility background background-attachment background-blend-mode background-clip background-color background-image background-origin background-position background-repeat background-size border border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom box-shadow box-sizing caption-side clear clip color column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns content counter-increment counter-reset cursor direction display empty-cells fill filter flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float font @font-face font-family font-size font-size-adjust font-stretch font-style font-variant font-weight hanging-punctuation height justify-content @keyframes left letter-spacing line-height list-style list-style-image list-style-position list-style-type margin margin-bottom margin-left margin-right margin-top max-height max-width @media min-height min-width nav-down nav-index nav-left nav-right nav-up opacity order outline outline-color outline-offset outline-style outline-width overflow overflow-x overflow-y padding padding-bottom padding-left padding-right padding-top page-break-after page-break-before page-break-inside perspective perspective-origin position quotes resize right tab-size table-layout text-align text-align-last text-decoration text-decoration-color text-decoration-line text-decoration-style text-indent text-justify text-overflow text-shadow text-transform top transform transform-origin transform-style transition transition-delay transition-duration transition-property transition-timing-function unicode-bidi vertical-align visibility white-space width word-break word-spacing word-wrap z-index overscroll-behavior-x user-select -ms-touch-action -webkit-user-select -webkit-touch-callout -moz-user-select touch-action -ms-user-select -khtml-user-select
    + errorCell
    + highlightScope invalid
    + commentCell
    + highlightScope comment
    + hakonNode
    + root
    + todo Add variables?
    + description A prefix Tree Language that compiles to CSS
    + compilesTo css
    + inScope commentNode
    + catchAllNodeType selectorNode
    + javascript
    + getSelector() {
    + return ""
    + }
    + compile() {
    + return this.getTopDownArray()
    + .filter(node => node.isSelectorNode)
    + .map(child => child.compile())
    + .join("")
    + }
    + example A basic example
    + body
    + font-size 12px
    + h1,h2
    + color red
    + a
    + &:hover
    + color blue
    + font-size 17px
    + propertyNode
    + catchAllCellType cssValueCell
    + catchAllNodeType errorNode
    + javascript
    + compile(spaces) {
    + return \`\${spaces}\${this.getFirstWord()}: \${this.getContent()};\`
    + }
    + cells propertyKeywordCell
    + variableNode
    + extends propertyNode
    + pattern --
    + errorNode
    + catchAllNodeType errorNode
    + catchAllCellType errorCell
    + baseNodeType errorNode
    + commentNode
    + cells commentKeywordCell
    + catchAllCellType commentCell
    + catchAllNodeType commentNode
    + selectorNode
    + inScope propertyNode variableNode commentNode
    + catchAllNodeType selectorNode
    + boolean isSelectorNode true
    + javascript
    + getSelector() {
    + const parentSelector = this.getParent().getSelector()
    + return this.getFirstWord()
    + .split(",")
    + .map(part => {
    + if (part.startsWith("&")) return parentSelector + part.substr(1)
    + return parentSelector ? parentSelector + " " + part : part
    + })
    + .join(",")
    + }
    + compile() {
    + const propertyNodes = this.getChildren().filter(node => node.doesExtend("propertyNode"))
    + if (!propertyNodes.length) return ""
    + const spaces = " "
    + return \`\${this.getSelector()} {
    + \${propertyNodes.map(child => child.compile(spaces)).join("\\n")}
    + }\\n\`
    + }
    + cells selectorCell`)
    + return this._cachedHandGrammarProgramRoot
    + }
    + static getNodeTypeMap() {
    + return {
    + hakonNode: hakonNode,
    + propertyNode: propertyNode,
    + variableNode: variableNode,
    + errorNode: errorNode,
    + commentNode: commentNode,
    + selectorNode: selectorNode,
    + }
    + }
    + }
    +
    + class propertyNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(errorNode, undefined, undefined)
    + }
    + get propertyKeywordCell() {
    + return this.getWord(0)
    + }
    + get cssValueCell() {
    + return this.getWordsFrom(1)
    + }
    + compile(spaces) {
    + return `${spaces}${this.getFirstWord()}: ${this.getContent()};`
    + }
    + }
    +
    + class variableNode extends propertyNode {}
    +
    + class errorNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(errorNode, undefined, undefined)
    + }
    + getErrors() {
    + return this._getErrorNodeErrors()
    + }
    + get errorCell() {
    + return this.getWordsFrom(0)
    + }
    + }
    +
    + class commentNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(commentNode, undefined, undefined)
    + }
    + get commentKeywordCell() {
    + return this.getWord(0)
    + }
    + get commentCell() {
    + return this.getWordsFrom(1)
    + }
    + }
    +
    + class selectorNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + selectorNode,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    + "border-bottom-right-radius": propertyNode,
    + "transition-timing-function": propertyNode,
    + "animation-iteration-count": propertyNode,
    + "animation-timing-function": propertyNode,
    + "border-bottom-left-radius": propertyNode,
    + "border-top-right-radius": propertyNode,
    + "border-top-left-radius": propertyNode,
    + "background-attachment": propertyNode,
    + "background-blend-mode": propertyNode,
    + "text-decoration-color": propertyNode,
    + "text-decoration-style": propertyNode,
    + "overscroll-behavior-x": propertyNode,
    + "-webkit-touch-callout": propertyNode,
    + "animation-play-state": propertyNode,
    + "text-decoration-line": propertyNode,
    + "animation-direction": propertyNode,
    + "animation-fill-mode": propertyNode,
    + "backface-visibility": propertyNode,
    + "background-position": propertyNode,
    + "border-bottom-color": propertyNode,
    + "border-bottom-style": propertyNode,
    + "border-bottom-width": propertyNode,
    + "border-image-outset": propertyNode,
    + "border-image-repeat": propertyNode,
    + "border-image-source": propertyNode,
    + "hanging-punctuation": propertyNode,
    + "list-style-position": propertyNode,
    + "transition-duration": propertyNode,
    + "transition-property": propertyNode,
    + "-webkit-user-select": propertyNode,
    + "animation-duration": propertyNode,
    + "border-image-slice": propertyNode,
    + "border-image-width": propertyNode,
    + "border-right-color": propertyNode,
    + "border-right-style": propertyNode,
    + "border-right-width": propertyNode,
    + "perspective-origin": propertyNode,
    + "-khtml-user-select": propertyNode,
    + "background-origin": propertyNode,
    + "background-repeat": propertyNode,
    + "border-left-color": propertyNode,
    + "border-left-style": propertyNode,
    + "border-left-width": propertyNode,
    + "column-rule-color": propertyNode,
    + "column-rule-style": propertyNode,
    + "column-rule-width": propertyNode,
    + "counter-increment": propertyNode,
    + "page-break-before": propertyNode,
    + "page-break-inside": propertyNode,
    + "background-color": propertyNode,
    + "background-image": propertyNode,
    + "border-top-color": propertyNode,
    + "border-top-style": propertyNode,
    + "border-top-width": propertyNode,
    + "font-size-adjust": propertyNode,
    + "list-style-image": propertyNode,
    + "page-break-after": propertyNode,
    + "transform-origin": propertyNode,
    + "transition-delay": propertyNode,
    + "-ms-touch-action": propertyNode,
    + "-moz-user-select": propertyNode,
    + "animation-delay": propertyNode,
    + "background-clip": propertyNode,
    + "background-size": propertyNode,
    + "border-collapse": propertyNode,
    + "justify-content": propertyNode,
    + "list-style-type": propertyNode,
    + "text-align-last": propertyNode,
    + "text-decoration": propertyNode,
    + "transform-style": propertyNode,
    + "-ms-user-select": propertyNode,
    + "animation-name": propertyNode,
    + "border-spacing": propertyNode,
    + "flex-direction": propertyNode,
    + "letter-spacing": propertyNode,
    + "outline-offset": propertyNode,
    + "padding-bottom": propertyNode,
    + "text-transform": propertyNode,
    + "vertical-align": propertyNode,
    + "align-content": propertyNode,
    + "border-bottom": propertyNode,
    + "border-radius": propertyNode,
    + "counter-reset": propertyNode,
    + "margin-bottom": propertyNode,
    + "outline-color": propertyNode,
    + "outline-style": propertyNode,
    + "outline-width": propertyNode,
    + "padding-right": propertyNode,
    + "text-overflow": propertyNode,
    + "border-color": propertyNode,
    + "border-image": propertyNode,
    + "border-right": propertyNode,
    + "border-style": propertyNode,
    + "border-width": propertyNode,
    + "caption-side": propertyNode,
    + "column-count": propertyNode,
    + "column-width": propertyNode,
    + "font-stretch": propertyNode,
    + "font-variant": propertyNode,
    + "margin-right": propertyNode,
    + "padding-left": propertyNode,
    + "table-layout": propertyNode,
    + "text-justify": propertyNode,
    + "unicode-bidi": propertyNode,
    + "word-spacing": propertyNode,
    + "touch-action": propertyNode,
    + "align-items": propertyNode,
    + "border-left": propertyNode,
    + "column-fill": propertyNode,
    + "column-rule": propertyNode,
    + "column-span": propertyNode,
    + "empty-cells": propertyNode,
    + "flex-shrink": propertyNode,
    + "font-family": propertyNode,
    + "font-weight": propertyNode,
    + "line-height": propertyNode,
    + "margin-left": propertyNode,
    + "padding-top": propertyNode,
    + perspective: propertyNode,
    + "text-indent": propertyNode,
    + "text-shadow": propertyNode,
    + "white-space": propertyNode,
    + "user-select": propertyNode,
    + "align-self": propertyNode,
    + background: propertyNode,
    + "border-top": propertyNode,
    + "box-shadow": propertyNode,
    + "box-sizing": propertyNode,
    + "column-gap": propertyNode,
    + "flex-basis": propertyNode,
    + "@font-face": propertyNode,
    + "font-style": propertyNode,
    + "@keyframes": propertyNode,
    + "list-style": propertyNode,
    + "margin-top": propertyNode,
    + "max-height": propertyNode,
    + "min-height": propertyNode,
    + "overflow-x": propertyNode,
    + "overflow-y": propertyNode,
    + "text-align": propertyNode,
    + transition: propertyNode,
    + visibility: propertyNode,
    + "word-break": propertyNode,
    + animation: propertyNode,
    + direction: propertyNode,
    + "flex-flow": propertyNode,
    + "flex-grow": propertyNode,
    + "flex-wrap": propertyNode,
    + "font-size": propertyNode,
    + "max-width": propertyNode,
    + "min-width": propertyNode,
    + "nav-index": propertyNode,
    + "nav-right": propertyNode,
    + transform: propertyNode,
    + "word-wrap": propertyNode,
    + "nav-down": propertyNode,
    + "nav-left": propertyNode,
    + overflow: propertyNode,
    + position: propertyNode,
    + "tab-size": propertyNode,
    + columns: propertyNode,
    + content: propertyNode,
    + display: propertyNode,
    + opacity: propertyNode,
    + outline: propertyNode,
    + padding: propertyNode,
    + "z-index": propertyNode,
    + border: propertyNode,
    + bottom: propertyNode,
    + cursor: propertyNode,
    + filter: propertyNode,
    + height: propertyNode,
    + margin: propertyNode,
    + "@media": propertyNode,
    + "nav-up": propertyNode,
    + quotes: propertyNode,
    + resize: propertyNode,
    + clear: propertyNode,
    + color: propertyNode,
    + float: propertyNode,
    + order: propertyNode,
    + right: propertyNode,
    + width: propertyNode,
    + clip: propertyNode,
    + fill: propertyNode,
    + flex: propertyNode,
    + font: propertyNode,
    + left: propertyNode,
    + all: propertyNode,
    + top: propertyNode,
    + comment: commentNode,
    + }),
    + [{ regex: /--/, nodeConstructor: variableNode }]
    + )
    + }
    + get selectorCell() {
    + return this.getWord(0)
    + }
    + get isSelectorNode() {
    + return true
    + }
    + getSelector() {
    + const parentSelector = this.getParent().getSelector()
    + return this.getFirstWord()
    + .split(",")
    + .map((part) => {
    + if (part.startsWith("&")) return parentSelector + part.substr(1)
    + return parentSelector ? parentSelector + " " + part : part
    + })
    + .join(",")
    + }
    + compile() {
    + const propertyNodes = this.getChildren().filter((node) => node.doesExtend("propertyNode"))
    + if (!propertyNodes.length) return ""
    + const spaces = " "
    + return `${this.getSelector()} {
    + ${propertyNodes.map((child) => child.compile(spaces)).join("\n")}
    + }\n`
    + }
    + }
    - .CodeMirror-code {
    - outline: none
    + window.hakonNode = hakonNode
    -
    - .CodeMirror-scroll,
    - .CodeMirror-sizer,
    - .CodeMirror-gutter,
    - .CodeMirror-gutters,
    - .CodeMirror-linenumber {
    - -moz-box-sizing: content-box;
    - box-sizing: content-box
    + const BrowserEvents = {}
    + BrowserEvents.click = "click"
    + BrowserEvents.change = "change"
    + BrowserEvents.mouseover = "mouseover"
    + BrowserEvents.mouseout = "mouseout"
    + BrowserEvents.mousedown = "mousedown"
    + BrowserEvents.contextmenu = "contextmenu"
    + BrowserEvents.keypress = "keypress"
    + BrowserEvents.keyup = "keyup"
    + BrowserEvents.focus = "focus"
    + BrowserEvents.mousemove = "mousemove"
    + BrowserEvents.dblclick = "dblclick"
    + BrowserEvents.submit = "submit"
    + BrowserEvents.blur = "blur"
    + BrowserEvents.paste = "paste"
    + BrowserEvents.copy = "copy"
    + BrowserEvents.resize = "resize"
    + BrowserEvents.cut = "cut"
    + BrowserEvents.drop = "drop"
    + BrowserEvents.dragover = "dragover"
    + BrowserEvents.dragenter = "dragenter"
    + BrowserEvents.dragleave = "dragleave"
    + BrowserEvents.ready = "ready"
    + const WillowConstants = {}
    + // todo: cleanup
    + WillowConstants.clickCommand = "clickCommand"
    + WillowConstants.shiftClickCommand = "shiftClickCommand"
    + WillowConstants.blurCommand = "blurCommand"
    + WillowConstants.contextMenuCommand = "contextMenuCommand"
    + WillowConstants.changeCommand = "changeCommand"
    + WillowConstants.doubleClickCommand = "doubleClickCommand"
    + // todo: cleanup
    + WillowConstants.titleTag = "titleTag"
    + WillowConstants.styleTag = "styleTag"
    + WillowConstants.tagMap = {}
    + WillowConstants.tagMap[WillowConstants.styleTag] = "style"
    + WillowConstants.tagMap[WillowConstants.titleTag] = "title"
    + WillowConstants.tags = {}
    + WillowConstants.tags.html = "html"
    + WillowConstants.tags.head = "head"
    + WillowConstants.tags.body = "body"
    + WillowConstants.collapse = "collapse"
    + WillowConstants.uidAttribute = "stumpUid"
    + WillowConstants.class = "class"
    + WillowConstants.type = "type"
    + WillowConstants.value = "value"
    + WillowConstants.name = "name"
    + WillowConstants.checkbox = "checkbox"
    + WillowConstants.checkedSelector = ":checked"
    + WillowConstants.contenteditable = "contenteditable"
    + WillowConstants.inputTypes = ["input", "textarea"]
    + var CacheType
    + ;(function (CacheType) {
    + CacheType["inBrowserMemory"] = "inBrowserMemory"
    + })(CacheType || (CacheType = {}))
    + class WillowHTTPResponse {
    + constructor(superAgentResponse) {
    + this._cacheType = CacheType.inBrowserMemory
    + this._fromCache = false
    + this._cacheTime = Date.now()
    + this._superAgentResponse = superAgentResponse
    + this._mimeType = superAgentResponse && superAgentResponse.type
    + }
    + // todo: ServerMemoryCacheTime and ServerMemoryDiskCacheTime
    + get cacheTime() {
    + return this._cacheTime
    + }
    + get cacheType() {
    + return this._cacheType
    + }
    + get body() {
    + return this._superAgentResponse && this._superAgentResponse.body
    + }
    + get text() {
    + if (this._text === undefined)
    + this._text = this._superAgentResponse && this._superAgentResponse.text ? this._superAgentResponse.text : this.body ? JSON.stringify(this.body, null, 2) : ""
    + return this._text
    + }
    + get asJson() {
    + return this.body ? this.body : JSON.parse(this.text)
    + }
    + get fromCache() {
    + return this._fromCache
    + }
    + setFromCache(val) {
    + this._fromCache = val
    + return this
    + }
    + getParsedDataOrText() {
    + if (this._mimeType === "text/csv") return this.text
    + return this.body || this.text
    + }
    -
    - .CodeMirror-measure {
    - position: absolute;
    - width: 100%;
    - height: 0;
    - overflow: hidden;
    - visibility: hidden
    + class WillowHTTPProxyCacheResponse extends WillowHTTPResponse {
    + constructor(proxyServerResponse) {
    + super()
    + this._proxyServerResponse = proxyServerResponse
    + this._cacheType = proxyServerResponse.body.cacheType
    + this._cacheTime = proxyServerResponse.body.cacheTime
    + this._text = proxyServerResponse.body.text
    + }
    -
    - .CodeMirror-cursor {
    - position: absolute;
    - pointer-events: none
    + class AbstractWillowShadow {
    + constructor(stumpNode) {
    + this._stumpNode = stumpNode
    + }
    + getShadowStumpNode() {
    + return this._stumpNode
    + }
    + getShadowValue() {
    + return this._val
    + }
    + removeShadow() {
    + return this
    + }
    + setInputOrTextAreaValue(value) {
    + this._val = value
    + return this
    + }
    + getShadowParent() {
    + return this.getShadowStumpNode().getParent().getShadow()
    + }
    + getPositionAndDimensions(gridSize = 1) {
    + const offset = this.getShadowOffset()
    + const parentOffset = this.getShadowParent().getShadowOffset()
    + return {
    + left: Math.floor((offset.left - parentOffset.left) / gridSize),
    + top: Math.floor((offset.top - parentOffset.top) / gridSize),
    + width: Math.floor(this.getShadowWidth() / gridSize),
    + height: Math.floor(this.getShadowHeight() / gridSize),
    + }
    + }
    + shadowHasClass(name) {
    + return false
    + }
    + getShadowAttr(name) {
    + return ""
    + }
    + makeResizable(options) {
    + return this
    + }
    + makeDraggable(options) {
    + return this
    + }
    + makeSelectable(options) {
    + return this
    + }
    + isShadowChecked() {
    + return false
    + }
    + getShadowHtml() {
    + return ""
    + }
    + getShadowOffset() {
    + return { left: 111, top: 111 }
    + }
    + getShadowWidth() {
    + return 111
    + }
    + getShadowHeight() {
    + return 111
    + }
    + setShadowAttr(name, value) {
    + return this
    + }
    + isShadowDraggable() {
    + return this.shadowHasClass("draggable")
    + }
    + toggleShadow() {}
    + addClassToShadow(className) {}
    + removeClassFromShadow(className) {
    + return this
    + }
    + onShadowEvent(event, selector, fn) {
    + // todo:
    + return this
    + }
    + offShadowEvent(event, fn) {
    + // todo:
    + return this
    + }
    + triggerShadowEvent(name) {
    + return this
    + }
    + getShadowPosition() {
    + return {
    + left: 111,
    + top: 111,
    + }
    + }
    + getShadowOuterHeight() {
    + return 11
    + }
    + getShadowOuterWidth() {
    + return 11
    + }
    + getShadowCss(property) {
    + return ""
    + }
    + setShadowCss(css) {
    + return this
    + }
    + insertHtmlNode(childNode, index) {}
    + getShadowElement() {}
    -
    - .CodeMirror-measure pre {
    - position: static
    + class WillowShadow extends AbstractWillowShadow {}
    + class WillowStore {
    + constructor() {
    + this._values = {}
    + }
    + get(key) {
    + return this._values[key]
    + }
    + set(key, value) {
    + this._values[key] = value
    + return this
    + }
    + remove(key) {
    + delete this._values[key]
    + }
    + each(fn) {
    + Object.keys(this._values).forEach((key) => {
    + fn(this._values[key], key)
    + })
    + }
    + clearAll() {
    + this._values = {}
    + }
    -
    - div.CodeMirror-cursors {
    - visibility: hidden;
    - position: relative;
    - z-index: 3
    + class WillowMousetrap {
    + constructor() {
    + this.prototype = {}
    + }
    + bind() {}
    -
    - div.CodeMirror-dragcursors {
    - visibility: visible
    + // this one should have no document, window, $, et cetera.
    + class AbstractWillowBrowser extends stumpNode {
    + constructor(fullHtmlPageUrlIncludingProtocolAndFileName) {
    + super(`${WillowConstants.tags.html}
    + ${WillowConstants.tags.head}
    + ${WillowConstants.tags.body}`)
    + this._offlineMode = false
    + this._httpGetResponseCache = {}
    + this.location = {}
    + this._htmlStumpNode = this.nodeAt(0)
    + this._headStumpNode = this.nodeAt(0).nodeAt(0)
    + this._bodyStumpNode = this.nodeAt(0).nodeAt(1)
    + this.addSuidsToHtmlHeadAndBodyShadows()
    + this._fullHtmlPageUrlIncludingProtocolAndFileName = fullHtmlPageUrlIncludingProtocolAndFileName
    + const url = new URL(fullHtmlPageUrlIncludingProtocolAndFileName)
    + this.location.port = url.port
    + this.location.protocol = url.protocol
    + this.location.hostname = url.hostname
    + this.location.host = url.host
    + }
    + _getPort() {
    + return this.location.port ? ":" + this.location.port : ""
    + }
    + getHash() {
    + return this.location.hash || ""
    + }
    + setHash(value) {
    + this.location.hash = value
    + }
    + queryObjectToQueryString(obj) {
    + const params = new URLSearchParams()
    + for (const [key, value] of Object.entries(obj)) {
    + params.set(key, String(value))
    + }
    + return params.toString()
    + }
    + toPrettyDeepLink(treeCode, queryObject) {
    + // todo: move things to a constant.
    + const nodeBreakSymbol = "~"
    + const edgeSymbol = "_"
    + const obj = Object.assign({}, queryObject)
    + if (!treeCode.includes(nodeBreakSymbol) && !treeCode.includes(edgeSymbol)) {
    + obj.nodeBreakSymbol = nodeBreakSymbol
    + obj.edgeSymbol = edgeSymbol
    + obj.data = encodeURIComponent(treeCode.replace(/ /g, edgeSymbol).replace(/\n/g, nodeBreakSymbol))
    + } else obj.data = encodeURIComponent(treeCode)
    + return this.getAppWebPageUrl() + "?" + this.queryObjectToQueryString(obj)
    + }
    + getHost() {
    + return this.location.host
    + }
    + reload() {}
    + toggleOfflineMode() {
    + this._offlineMode = !this._offlineMode
    + }
    + addSuidsToHtmlHeadAndBodyShadows() {}
    + getShadowClass() {
    + return WillowShadow
    + }
    + getMockMouseEvent() {
    + return {
    + clientX: 0,
    + clientY: 0,
    + offsetX: 0,
    + offsetY: 0,
    + }
    + }
    + toggleFullScreen() {}
    + getMousetrap() {
    + if (!this._mousetrap) this._mousetrap = new WillowMousetrap()
    + return this._mousetrap
    + }
    + _getFocusedShadow() {
    + return this._focusedShadow || this.getBodyStumpNode().getShadow()
    + }
    + getHeadStumpNode() {
    + return this._headStumpNode
    + }
    + getBodyStumpNode() {
    + return this._bodyStumpNode
    + }
    + getHtmlStumpNode() {
    + return this._htmlStumpNode
    + }
    + getStore() {
    + if (!this._store) this._store = new WillowStore()
    + return this._store
    + }
    + someInputHasFocus() {
    + const focusedShadow = this._getFocusedShadow()
    + if (!focusedShadow) return false
    + const stumpNode = focusedShadow.getShadowStumpNode()
    + return stumpNode && stumpNode.isInputType()
    + }
    + copyTextToClipboard(text) {}
    + setCopyData(evt, str) {}
    + getAppWebPageUrl() {
    + return this._fullHtmlPageUrlIncludingProtocolAndFileName
    + }
    + getAppWebPageParentFolderWithoutTrailingSlash() {
    + return jtree.Utils.getPathWithoutFileName(this._fullHtmlPageUrlIncludingProtocolAndFileName)
    + }
    + _makeRelativeUrlAbsolute(url) {
    + if (url.startsWith("http://") || url.startsWith("https://")) return url
    + return this.getAppWebPageParentFolderWithoutTrailingSlash() + "/" + url.replace(/^\//, "")
    + }
    + async makeUrlAbsoluteAndHttpGetUrl(url, queryStringObject, responseClass = WillowHTTPResponse) {
    + return this.httpGetUrl(this._makeRelativeUrlAbsolute(url), queryStringObject, responseClass)
    + }
    + async httpGetUrl(url, queryStringObject, responseClass = WillowHTTPResponse) {
    + if (this._offlineMode) return new WillowHTTPResponse()
    + const superAgentResponse = await superagent
    + .get(url)
    + .query(queryStringObject)
    + .set(this._headers || {})
    + return new responseClass(superAgentResponse)
    + }
    + _getFromResponseCache(cacheKey) {
    + const hit = this._httpGetResponseCache[cacheKey]
    + if (hit) hit.setFromCache(true)
    + return hit
    + }
    + _setInResponseCache(url, res) {
    + this._httpGetResponseCache[url] = res
    + return this
    + }
    + async httpGetUrlFromCache(url, queryStringMap = {}, responseClass = WillowHTTPResponse) {
    + const cacheKey = url + JSON.stringify(queryStringMap)
    + const cacheHit = this._getFromResponseCache(cacheKey)
    + if (!cacheHit) {
    + const res = await this.httpGetUrl(url, queryStringMap, responseClass)
    + this._setInResponseCache(cacheKey, res)
    + return res
    + }
    + return cacheHit
    + }
    + async httpGetUrlFromProxyCache(url) {
    + const queryStringMap = {}
    + queryStringMap.url = url
    + queryStringMap.cacheOnServer = "true"
    + return await this.httpGetUrlFromCache("/proxy", queryStringMap, WillowHTTPProxyCacheResponse)
    + }
    + async httpPostUrl(url, data) {
    + if (this._offlineMode) return new WillowHTTPResponse()
    + const superAgentResponse = await superagent
    + .post(this._makeRelativeUrlAbsolute(url))
    + .set(this._headers || {})
    + .send(data)
    + return new WillowHTTPResponse(superAgentResponse)
    + }
    + encodeURIComponent(str) {
    + return encodeURIComponent(str)
    + }
    + downloadFile(data, filename, filetype) {
    + // noop
    + }
    + async appendScript(url) {}
    + getWindowTitle() {
    + // todo: deep getNodeByBase/withBase/type/word or something?
    + const nodes = this.getTopDownArray()
    + const titleNode = nodes.find((node) => node.getFirstWord() === WillowConstants.titleTag)
    + return titleNode ? titleNode.getContent() : ""
    + }
    + setWindowTitle(value) {
    + const nodes = this.getTopDownArray()
    + const headNode = nodes.find((node) => node.getFirstWord() === WillowConstants.tags.head)
    + headNode.touchNode(WillowConstants.titleTag).setContent(value)
    + return this
    + }
    + _getHostname() {
    + return this.location.hostname || ""
    + }
    + openUrl(link) {
    + // noop in willow
    + }
    + getPageHtml() {
    + return this.getHtmlStumpNode().toHtmlWithSuids()
    + }
    + getStumpNodeFromElement(el) {}
    + setPasteHandler(fn) {
    + return this
    + }
    + setErrorHandler(fn) {
    + return this
    + }
    + setCopyHandler(fn) {
    + return this
    + }
    + setCutHandler(fn) {
    + return this
    + }
    + setResizeEndHandler(fn) {
    + return this
    + }
    + async confirmThen(message) {
    + return true
    + }
    + async promptThen(message, value) {
    + return value
    + }
    + setLoadedDroppedFileHandler(callback, helpText = "") {}
    + getWindowSize() {
    + return {
    + width: 1111,
    + height: 1111,
    + }
    + }
    + getDocumentSize() {
    + return this.getWindowSize()
    + }
    + isExternalLink(link) {
    + if (link && link.substr(0, 1) === "/") return false
    + if (!link.includes("//")) return false
    + const hostname = this._getHostname()
    + const url = new URL(link)
    + return url.hostname && hostname !== url.hostname
    + }
    + forceRepaint() {}
    + blurFocusedInput() {}
    -
    - .CodeMirror-focused div.CodeMirror-cursors {
    - visibility: visible
    + class WillowBrowser extends AbstractWillowBrowser {
    + constructor(fullHtmlPageUrlIncludingProtocolAndFileName) {
    + super(fullHtmlPageUrlIncludingProtocolAndFileName)
    + this._offlineMode = true
    + }
    -
    - .CodeMirror-selected {
    - background: #d9d9d9
    + WillowBrowser._stumpsOnPage = 0
    + class WillowBrowserShadow extends AbstractWillowShadow {
    + _getJQElement() {
    + // todo: speedup?
    + if (!this._cachedEl) this._cachedEl = jQuery(`[${WillowConstants.uidAttribute}="${this.getShadowStumpNode()._getUid()}"]`)
    + return this._cachedEl
    + }
    + getShadowElement() {
    + return this._getJQElement()[0]
    + }
    + getShadowPosition() {
    + return this._getJQElement().position()
    + }
    + shadowHasClass(name) {
    + return this._getJQElement().hasClass(name)
    + }
    + getShadowHtml() {
    + return this._getJQElement().html()
    + }
    + getShadowValue() {
    + // todo: cleanup, add tests
    + if (this.getShadowStumpNode().isInputType()) return this._getJQElement().val()
    + return this._getJQElement().val() || this.getShadowValueFromAttr()
    + }
    + getShadowValueFromAttr() {
    + return this._getJQElement().attr(WillowConstants.value)
    + }
    + getShadowOuterHeight() {
    + return this._getJQElement().outerHeight()
    + }
    + getShadowOuterWidth() {
    + return this._getJQElement().outerWidth()
    + }
    + isShadowChecked() {
    + return this._getJQElement().is(WillowConstants.checkedSelector)
    + }
    + getShadowWidth() {
    + return this._getJQElement().width()
    + }
    + getShadowHeight() {
    + return this._getJQElement().height()
    + }
    + getShadowOffset() {
    + return this._getJQElement().offset()
    + }
    + getShadowAttr(name) {
    + return this._getJQElement().attr(name)
    + }
    + _logMessage(type) {
    + if (true) return true
    + WillowBrowserShadow._shadowUpdateNumber++
    + console.log(`DOM Update ${WillowBrowserShadow._shadowUpdateNumber}: ${type}`)
    + }
    + getShadowCss(prop) {
    + return this._getJQElement().css(prop)
    + }
    + triggerShadowEvent(event) {
    + this._getJQElement().trigger(event)
    + this._logMessage("trigger")
    + return this
    + }
    + // BEGIN MUTABLE METHODS:
    + // todo: add tests
    + // todo: idea, don't "paint" wall (dont append it to parent, until done.)
    + insertHtmlNode(childStumpNode, index) {
    + const newChildJqElement = jQuery(childStumpNode.toHtmlWithSuids())
    + newChildJqElement.data("stumpNode", childStumpNode) // todo: what do we use this for?
    + const jqEl = this._getJQElement()
    + // todo: can we virtualize this?
    + // would it be a "virtual shadow?"
    + if (index === undefined) jqEl.append(newChildJqElement)
    + else if (index === 0) jqEl.prepend(newChildJqElement)
    + else jQuery(jqEl.children().get(index - 1)).after(newChildJqElement)
    + WillowBrowser._stumpsOnPage++
    + this._logMessage("insert")
    + }
    + addClassToShadow(className) {
    + this._getJQElement().addClass(className)
    + this._logMessage("addClass")
    + return this
    + }
    + removeClassFromShadow(className) {
    + this._getJQElement().removeClass(className)
    + this._logMessage("removeClass")
    + return this
    + }
    + onShadowEvent(event, two, three) {
    + this._getJQElement().on(event, two, three)
    + this._logMessage("bind on")
    + return this
    + }
    + offShadowEvent(event, fn) {
    + this._getJQElement().off(event, fn)
    + this._logMessage("bind off")
    + return this
    + }
    + toggleShadow() {
    + this._getJQElement().toggle()
    + this._logMessage("toggle")
    + return this
    + }
    + makeResizable(options) {
    + this._getJQElement().resizable(options)
    + this._logMessage("resizable")
    + return this
    + }
    + removeShadow() {
    + this._getJQElement().remove()
    + WillowBrowser._stumpsOnPage--
    + this._logMessage("remove")
    + return this
    + }
    + setInputOrTextAreaValue(value) {
    + this._getJQElement().val(value)
    + this._logMessage("val")
    + return this
    + }
    + setShadowAttr(name, value) {
    + this._getJQElement().attr(name, value)
    + this._logMessage("attr")
    + return this
    + }
    + makeDraggable(options) {
    + this._logMessage("draggable")
    + this._getJQElement().draggable(options)
    + return this
    + }
    + setShadowCss(css) {
    + this._getJQElement().css(css)
    + this._logMessage("css")
    + return this
    + }
    + makeSelectable(options) {
    + this._getJQElement().selectable(options)
    + this._logMessage("selectable")
    + return this
    + }
    -
    - .CodeMirror-focused .CodeMirror-selected {
    - background: #d7d4f0
    + WillowBrowserShadow._shadowUpdateNumber = 0 // todo: what is this for, debugging perf?
    + // same thing, except with side effects.
    + class RealWillowBrowser extends AbstractWillowBrowser {
    + findStumpNodesByShadowClass(className) {
    + const stumpNodes = []
    + const that = this
    + jQuery("." + className).each(function () {
    + stumpNodes.push(that.getStumpNodeFromElement(this))
    + })
    + return stumpNodes
    + }
    + addSuidsToHtmlHeadAndBodyShadows() {
    + jQuery(WillowConstants.tags.html).attr(WillowConstants.uidAttribute, this.getHtmlStumpNode()._getUid())
    + jQuery(WillowConstants.tags.head).attr(WillowConstants.uidAttribute, this.getHeadStumpNode()._getUid())
    + jQuery(WillowConstants.tags.body).attr(WillowConstants.uidAttribute, this.getBodyStumpNode()._getUid())
    + }
    + getShadowClass() {
    + return WillowBrowserShadow
    + }
    + setCopyHandler(fn) {
    + jQuery(document).on(BrowserEvents.copy, fn)
    + return this
    + }
    + setCutHandler(fn) {
    + jQuery(document).on(BrowserEvents.cut, fn)
    + return this
    + }
    + setPasteHandler(fn) {
    + window.addEventListener(BrowserEvents.paste, fn, false)
    + return this
    + }
    + setErrorHandler(fn) {
    + window.addEventListener("error", fn)
    + window.addEventListener("unhandledrejection", fn)
    + return this
    + }
    + toggleFullScreen() {
    + const doc = document
    + if ((doc.fullScreenElement && doc.fullScreenElement !== null) || (!doc.mozFullScreen && !doc.webkitIsFullScreen)) {
    + if (doc.documentElement.requestFullScreen) doc.documentElement.requestFullScreen()
    + else if (doc.documentElement.mozRequestFullScreen) doc.documentElement.mozRequestFullScreen()
    + else if (doc.documentElement.webkitRequestFullScreen) doc.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)
    + } else {
    + if (doc.cancelFullScreen) doc.cancelFullScreen()
    + else if (doc.mozCancelFullScreen) doc.mozCancelFullScreen()
    + else if (doc.webkitCancelFullScreen) doc.webkitCancelFullScreen()
    + }
    + }
    + setCopyData(evt, str) {
    + const originalEvent = evt.originalEvent
    + originalEvent.preventDefault()
    + originalEvent.clipboardData.setData("text/plain", str)
    + originalEvent.clipboardData.setData("text/html", str)
    + }
    + getMousetrap() {
    + return window.Mousetrap
    + }
    + copyTextToClipboard(text) {
    + // http://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript
    + const textArea = document.createElement("textarea")
    + textArea.style.position = "fixed"
    + textArea.style.top = "0"
    + textArea.style.left = "0"
    + textArea.style.width = "2em"
    + textArea.style.height = "2em"
    + textArea.style.padding = "0"
    + textArea.style.border = "none"
    + textArea.style.outline = "none"
    + textArea.style.boxShadow = "none"
    + textArea.style.background = "transparent"
    + textArea.value = text
    + document.body.appendChild(textArea)
    + textArea.select()
    + try {
    + const successful = document.execCommand("copy")
    + } catch (err) {}
    + document.body.removeChild(textArea)
    + }
    + getStore() {
    + return window.store
    + }
    + getHash() {
    + return location.hash || ""
    + }
    + setHash(value) {
    + location.hash = value
    + }
    + getHost() {
    + return location.host
    + }
    + _getHostname() {
    + return location.hostname
    + }
    + async appendScript(url) {
    + if (!url) return undefined
    + if (!this._loadingPromises) this._loadingPromises = {}
    + if (this._loadingPromises[url]) return this._loadingPromises[url]
    + if (this.isNodeJs()) return undefined
    + this._loadingPromises[url] = this._appendScript(url)
    + return this._loadingPromises[url]
    + }
    + _appendScript(url) {
    + //https://bradb.net/blog/promise-based-js-script-loader/
    + return new Promise(function (resolve, reject) {
    + let resolved = false
    + const scriptEl = document.createElement("script")
    + scriptEl.type = "text/javascript"
    + scriptEl.src = url
    + scriptEl.async = true
    + scriptEl.onload = scriptEl.onreadystatechange = function () {
    + if (!resolved && (!this.readyState || this.readyState == "complete")) {
    + resolved = true
    + resolve(this)
    + }
    + }
    + scriptEl.onerror = scriptEl.onabort = reject
    + document.head.appendChild(scriptEl)
    + })
    + }
    + downloadFile(data, filename, filetype) {
    + const downloadLink = document.createElement("a")
    + downloadLink.setAttribute("href", `data:${filetype},` + encodeURIComponent(data))
    + downloadLink.setAttribute("download", filename)
    + downloadLink.click()
    + }
    + reload() {
    + window.location.reload()
    + }
    + openUrl(link) {
    + window.open(link)
    + }
    + setResizeEndHandler(fn) {
    + let resizeTimer
    + jQuery(window).on(BrowserEvents.resize, (evt) => {
    + const target = jQuery(evt.target)
    + if (target.is("div")) return // dont resize on div resizes
    + clearTimeout(resizeTimer)
    + resizeTimer = setTimeout(() => {
    + fn({ width: target.width(), height: target.height() })
    + }, 100)
    + })
    + return this
    + }
    + getStumpNodeFromElement(el) {
    + const jqEl = jQuery(el)
    + return this.getHtmlStumpNode().getNodeByGuid(parseInt(jqEl.attr(WillowConstants.uidAttribute)))
    + }
    + forceRepaint() {
    + jQuery(window).width()
    + }
    + getBrowserHtml() {
    + return document.documentElement.outerHTML
    + }
    + async confirmThen(message) {
    + return confirm(message)
    + }
    + async promptThen(message, value) {
    + return prompt(message, value)
    + }
    + getWindowSize() {
    + const windowStumpNode = jQuery(window)
    + return {
    + width: windowStumpNode.width(),
    + height: windowStumpNode.height(),
    + }
    + }
    + getDocumentSize() {
    + const documentStumpNode = jQuery(document)
    + return {
    + width: documentStumpNode.width(),
    + height: documentStumpNode.height(),
    + }
    + }
    + // todo: denote the side effect
    + blurFocusedInput() {
    + // todo: test against browser.
    + document.activeElement.blur()
    + }
    + setLoadedDroppedFileHandler(callback, helpText = "") {
    + const bodyStumpNode = this.getBodyStumpNode()
    + const bodyShadow = bodyStumpNode.getShadow()
    + // Added the below to ensure dragging from the chrome downloads bar works
    + // http://stackoverflow.com/questions/19526430/drag-and-drop-file-uploads-from-chrome-downloads-bar
    + const handleChromeBug = (event) => {
    + const originalEvent = event.originalEvent
    + const effect = originalEvent.dataTransfer.effectAllowed
    + originalEvent.dataTransfer.dropEffect = effect === "move" || effect === "linkMove" ? "move" : "copy"
    + }
    + const dragoverHandler = (event) => {
    + handleChromeBug(event)
    + event.preventDefault()
    + event.stopPropagation()
    + if (!bodyStumpNode.stumpNodeHasClass("dragOver")) {
    + bodyStumpNode.insertChildNode(`div ${helpText}
    + id dragOverHelp`)
    + bodyStumpNode.addClassToStumpNode("dragOver")
    + // Add the help, and then hopefull we'll get a dragover event on the dragOverHelp, then
    + // 50ms later, add the dragleave handler, and from now on drag leave will only happen on the help
    + // div
    + setTimeout(function () {
    + bodyShadow.onShadowEvent(BrowserEvents.dragleave, dragleaveHandler)
    + }, 50)
    + }
    + }
    + const dragleaveHandler = (event) => {
    + event.preventDefault()
    + event.stopPropagation()
    + bodyStumpNode.removeClassFromStumpNode("dragOver")
    + bodyStumpNode.findStumpNodeByChild("id dragOverHelp").removeStumpNode()
    + bodyShadow.offShadowEvent(BrowserEvents.dragleave, dragleaveHandler)
    + }
    + const dropHandler = async (event) => {
    + event.preventDefault()
    + event.stopPropagation()
    + bodyStumpNode.removeClassFromStumpNode("dragOver")
    + bodyStumpNode.findStumpNodeByChild("id dragOverHelp").removeStumpNode()
    + const droppedItems = event.originalEvent.dataTransfer.items
    + // NOTE: YOU NEED TO STAY IN THE "DROP" EVENT, OTHERWISE THE DATATRANSFERITEMS MUTATE
    + // (BY DESIGN) https://bugs.chromium.org/p/chromium/issues/detail?id=137231
    + // DO NOT ADD AN AWAIT IN THIS LOOP. IT WILL BREAK.
    + const items = []
    + for (let droppedItem of droppedItems) {
    + const entry = droppedItem.webkitGetAsEntry()
    + items.push(this._handleDroppedEntry(entry))
    + }
    + const results = await Promise.all(items)
    + callback(results)
    + }
    + bodyShadow.onShadowEvent(BrowserEvents.dragover, dragoverHandler)
    + bodyShadow.onShadowEvent(BrowserEvents.drop, dropHandler)
    + // todo: why do we do this?
    + bodyShadow.onShadowEvent(BrowserEvents.dragenter, function (event) {
    + event.preventDefault()
    + event.stopPropagation()
    + })
    + }
    + _handleDroppedEntry(item, path = "") {
    + // http://stackoverflow.com/questions/3590058/does-html5-allow-drag-drop-upload-of-folders-or-a-folder-tree
    + // http://stackoverflow.com/questions/6756583/prevent-browser-from-loading-a-drag-and-dropped-file
    + return item.isFile ? this._handleDroppedFile(item) : this._handleDroppedDirectory(item, path)
    + }
    + _handleDroppedDirectory(item, path) {
    + return new Promise((resolve, reject) => {
    + item.createReader().readEntries(async (entries) => {
    + const promises = []
    + for (let i = 0; i < entries.length; i++) {
    + promises.push(this._handleDroppedEntry(entries[i], path + item.name + "/"))
    + }
    + const res = await Promise.all(promises)
    + resolve(res)
    + })
    + })
    + }
    + _handleDroppedFile(file) {
    + // https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications
    + // http://www.sitepoint.com/html5-javascript-open-dropped-files/
    + return new Promise((resolve, reject) => {
    + file.file((data) => {
    + const reader = new FileReader()
    + reader.onload = (evt) => {
    + resolve({ data: evt.target.result, filename: data.name })
    + }
    + reader.onerror = (err) => reject(err)
    + reader.readAsText(data)
    + })
    + })
    + }
    + _getFocusedShadow() {
    + const stumpNode = this.getStumpNodeFromElement(document.activeElement)
    + return stumpNode && stumpNode.getShadow()
    + }
    -
    - .CodeMirror-crosshair {
    - cursor: crosshair
    + class AbstractTheme {
    + hakonToCss(str) {
    + const hakonProgram = new hakonNode(str)
    + // console.log(hakonProgram.getAllErrors())
    + return hakonProgram.compile()
    + }
    -
    - .CodeMirror-line::selection,
    - .CodeMirror-line>span::selection,
    - .CodeMirror-line>span>span::selection {
    - background: #d7d4f0
    + class DefaultTheme extends AbstractTheme {}
    + class AbstractTreeComponent extends jtree.GrammarBackedNode {
    + async startWhenReady() {
    + if (this.isNodeJs()) return this.start()
    + document.addEventListener(
    + "DOMContentLoaded",
    + async () => {
    + this.start()
    + },
    + false
    + )
    + }
    + start() {
    + this._bindTreeComponentFrameworkCommandListenersOnBody()
    + this.renderAndGetRenderReport(this.getWillowBrowser().getBodyStumpNode())
    + }
    + getWillowBrowser() {
    + if (!this._willowBrowser) {
    + if (this.isNodeJs()) {
    + this._willowBrowser = new WillowBrowser("http://localhost:8000/index.html")
    + } else {
    + this._willowBrowser = new RealWillowBrowser(window.location.href)
    + }
    + }
    + return this._willowBrowser
    + }
    + onCommandError(err) {
    + throw err
    + }
    + _setMouseEvent(evt) {
    + this._mouseEvent = evt
    + return this
    + }
    + getMouseEvent() {
    + return this._mouseEvent || this.getWillowBrowser().getMockMouseEvent()
    + }
    + _onCommandWillRun() {
    + // todo: remove. currently used by ohayo
    + }
    + _getCommandArgumentsFromStumpNode(stumpNode, commandMethod) {
    + if (commandMethod.includes(" ")) {
    + // todo: cleanup and document
    + // It seems the command arguments can from the method string or from form values.
    + const parts = commandMethod.split(" ")
    + return {
    + uno: parts[1],
    + dos: parts[2],
    + }
    + }
    + const shadow = stumpNode.getShadow()
    + let valueParam
    + if (stumpNode.isStumpNodeCheckbox()) valueParam = shadow.isShadowChecked() ? true : false
    + // todo: fix bug if nothing is entered.
    + else if (shadow.getShadowValue() !== undefined) valueParam = shadow.getShadowValue()
    + else valueParam = stumpNode.getStumpNodeAttr("value")
    + const nameParam = stumpNode.getStumpNodeAttr("name")
    + return {
    + uno: valueParam,
    + dos: nameParam,
    + }
    + }
    + getStumpNodeString() {
    + return this.getWillowBrowser().getHtmlStumpNode().toString()
    + }
    + _getHtmlOnlyNodes() {
    + const nodes = []
    + this.getWillowBrowser()
    + .getHtmlStumpNode()
    + .deepVisit((node) => {
    + if (node.getFirstWord() === "styleTag" || (node.getContent() || "").startsWith("
    + nodes.push(node)
    + })
    + return nodes
    + }
    + getStumpNodeStringWithoutCssAndSvg() {
    + // todo: cleanup. feels hacky.
    + const clone = new jtree.TreeNode(this.getWillowBrowser().getHtmlStumpNode().toString())
    + clone.getTopDownArray().forEach((node) => {
    + if (node.getFirstWord() === "styleTag" || (node.getContent() || "").startsWith("
    + })
    + return clone.toString()
    + }
    + getTextContent() {
    + return this._getHtmlOnlyNodes()
    + .map((node) => node.getTextContent())
    + .filter((text) => text)
    + .join("\n")
    + }
    + getCommandNames() {
    + return Object.getOwnPropertyNames(Object.getPrototypeOf(this)).filter((word) => word.endsWith("Command"))
    + }
    + async _executeCommandOnStumpNode(stumpNode, commandMethod) {
    + const params = this._getCommandArgumentsFromStumpNode(stumpNode, commandMethod)
    + if (commandMethod.includes(" "))
    + // todo: cleanup
    + commandMethod = commandMethod.split(" ")[0]
    + this.addToCommandLog([commandMethod, params.uno, params.dos].filter((identity) => identity).join(" "))
    + this._onCommandWillRun() // todo: remove. currently used by ohayo
    + let treeComponent = stumpNode.getStumpNodeTreeComponent()
    + while (!treeComponent[commandMethod]) {
    + const parent = treeComponent.getParent()
    + if (parent === treeComponent) throw new Error(`Unknown command "${commandMethod}"`)
    + if (!parent) debugger
    + treeComponent = parent
    + }
    + try {
    + await treeComponent[commandMethod](params.uno, params.dos)
    + } catch (err) {
    + this.onCommandError(err)
    + }
    + }
    + _bindTreeComponentFrameworkCommandListenersOnBody() {
    + const willowBrowser = this.getWillowBrowser()
    + const bodyShadow = willowBrowser.getBodyStumpNode().getShadow()
    + const app = this
    + const checkAndExecute = (el, attr, evt) => {
    + const stumpNode = willowBrowser.getStumpNodeFromElement(el)
    + evt.preventDefault()
    + evt.stopImmediatePropagation()
    + this._executeCommandOnStumpNode(stumpNode, stumpNode.getStumpNodeAttr(attr))
    + return false
    + }
    + bodyShadow.onShadowEvent(BrowserEvents.contextmenu, `[${WillowConstants.contextMenuCommand}]`, function (evt) {
    + if (evt.ctrlKey) return true
    + app._setMouseEvent(evt) // todo: remove?
    + return checkAndExecute(this, WillowConstants.contextMenuCommand, evt)
    + })
    + bodyShadow.onShadowEvent(BrowserEvents.click, `[${WillowConstants.clickCommand}]`, function (evt) {
    + if (evt.shiftKey) return checkAndExecute(this, WillowConstants.shiftClickCommand, evt)
    + app._setMouseEvent(evt) // todo: remove?
    + return checkAndExecute(this, WillowConstants.clickCommand, evt)
    + })
    + bodyShadow.onShadowEvent(BrowserEvents.dblclick, `[${WillowConstants.doubleClickCommand}]`, function (evt) {
    + if (evt.target !== evt.currentTarget) return true // direct dblclicks only
    + app._setMouseEvent(evt) // todo: remove?
    + return checkAndExecute(this, WillowConstants.doubleClickCommand, evt)
    + })
    + bodyShadow.onShadowEvent(BrowserEvents.blur, `[${WillowConstants.blurCommand}]`, function (evt) {
    + return checkAndExecute(this, WillowConstants.blurCommand, evt)
    + })
    + bodyShadow.onShadowEvent(BrowserEvents.change, `[${WillowConstants.changeCommand}]`, function (evt) {
    + return checkAndExecute(this, WillowConstants.changeCommand, evt)
    + })
    + }
    + stopPropagationCommand() {
    + // todo: remove?
    + // intentional noop
    + }
    + // todo: remove?
    + async clearMessageBufferCommand() {
    + delete this._messageBuffer
    + }
    + // todo: remove?
    + async unmountAndDestroyCommand() {
    + this.unmountAndDestroy()
    + }
    + toggleTreeComponentFrameworkDebuggerCommand() {
    + // todo: move somewhere else?
    + // todo: cleanup
    + const app = this.getRootNode()
    + const node = app.getNode("TreeComponentFrameworkDebuggerComponent")
    + if (node) {
    + node.unmountAndDestroy()
    + } else {
    + app.appendLine("TreeComponentFrameworkDebuggerComponent")
    + app.renderAndGetRenderReport()
    + }
    + }
    + getStumpNode() {
    + return this._htmlStumpNode
    + }
    + toHakonCode() {
    + return ""
    + }
    + getTheme() {
    + if (!this.isRoot()) return this.getRootNode().getTheme()
    + if (!this._theme) this._theme = new DefaultTheme()
    + return this._theme
    + }
    + getCommandsBuffer() {
    + if (!this._commandsBuffer) this._commandsBuffer = []
    + return this._commandsBuffer
    + }
    + addToCommandLog(command) {
    + this.getCommandsBuffer().push({
    + command: command,
    + time: this._getProcessTimeInMilliseconds(),
    + })
    + }
    + getMessageBuffer() {
    + if (!this._messageBuffer) this._messageBuffer = new jtree.TreeNode()
    + return this._messageBuffer
    + }
    + // todo: move this to tree class? or other higher level class?
    + addStumpCodeMessageToLog(message) {
    + // note: we have 1 parameter, and are going to do type inference first.
    + // Todo: add actions that can be taken from a message?
    + // todo: add tests
    + this.getMessageBuffer().appendLineAndChildren("message", message)
    + }
    + addStumpErrorMessageToLog(errorMessage) {
    + // todo: cleanup!
    + return this.addStumpCodeMessageToLog(`div
    + class OhayoError
    + bern${jtree.TreeNode.nest(errorMessage, 2)}`)
    + }
    + logMessageText(message = "") {
    + const pre = `pre
    + bern${jtree.TreeNode.nest(message, 2)}`
    + return this.addStumpCodeMessageToLog(pre)
    + }
    + unmount() {
    + if (
    + !this.isMounted() // todo: why do we need this check?
    + )
    + return undefined
    + this._getChildTreeComponents().forEach((child) => child.unmount())
    + this.treeComponentWillUnmount()
    + this._removeCss()
    + this._removeHtml()
    + delete this._lastRenderedTime
    + this.treeComponentDidUnmount()
    + }
    + _removeHtml() {
    + this._htmlStumpNode.removeStumpNode()
    + delete this._htmlStumpNode
    + }
    + toStumpCode() {
    + return `div
    + class ${this.getCssClassNames().join(" ")}`
    + }
    + getCssClassNames() {
    + return this._getJavascriptPrototypeChainUpTo("AbstractTreeComponent")
    + }
    + treeComponentWillMount() {}
    + async treeComponentDidMount() {
    + AbstractTreeComponent._mountedTreeComponents++
    + }
    + treeComponentDidUnmount() {
    + AbstractTreeComponent._mountedTreeComponents--
    + }
    + treeComponentWillUnmount() {}
    + getNewestTimeToRender() {
    + return this._lastTimeToRender
    + }
    + _setLastRenderedTime(time) {
    + this._lastRenderedTime = time
    + return this
    + }
    + async treeComponentDidUpdate() {}
    + _getChildTreeComponents() {
    + return this.getChildrenByNodeConstructor(AbstractTreeComponent)
    + }
    + _hasChildrenTreeComponents() {
    + return this._getChildTreeComponents().length > 0
    + }
    + // todo: this is hacky. we do it so we can just mount all tiles to wall.
    + getStumpNodeForChildren() {
    + return this.getStumpNode()
    + }
    + _getLastRenderedTime() {
    + return this._lastRenderedTime
    + }
    + _getCss() {
    + return this.getTheme().hakonToCss(this.toHakonCode())
    + }
    + toPlainHtml(containerId) {
    + return `
    +
    + ${new stumpNode(this.toStumpCode()).compile()}
    +
    `
    + }
    + _getCssStumpCode() {
    + return `styleTag
    + for ${this.constructor.name}
    + bern${jtree.TreeNode.nest(this._getCss(), 2)}`
    + }
    + _updateAndGetUpdateReport() {
    + const reasonForUpdatingOrNot = this.getWhetherToUpdateAndReason()
    + if (!reasonForUpdatingOrNot.shouldUpdate) return reasonForUpdatingOrNot
    + this._setLastRenderedTime(this._getProcessTimeInMilliseconds())
    + this._removeCss()
    + this._mountCss()
    + // todo: fucking switch to react? looks like we don't update parent because we dont want to nuke children.
    + // okay. i see why we might do that for non tile treeComponents. but for Tile treeComponents, seems like we arent nesting, so why not?
    + // for now
    + if (this._hasChildrenTreeComponents()) return { shouldUpdate: false, reason: "did not update because is a parent" }
    + this._updateHtml()
    + this._lastTimeToRender = this._getProcessTimeInMilliseconds() - this._getLastRenderedTime()
    + return reasonForUpdatingOrNot
    + }
    + _updateHtml() {
    + const stumpNodeToMountOn = this._htmlStumpNode.getParent()
    + const currentIndex = this._htmlStumpNode.getIndex()
    + this._removeHtml()
    + this._mountHtml(stumpNodeToMountOn, this._toLoadedOrLoadingStumpCode(), currentIndex)
    + }
    + unmountAndDestroy() {
    + this.unmount()
    + return this.destroy()
    + }
    + // todo: move to keyword node class?
    + toggle(firstWord, contentOptions) {
    + const currentNode = this.getNode(firstWord)
    + if (!contentOptions) return currentNode ? currentNode.unmountAndDestroy() : this.appendLine(firstWord)
    + const currentContent = currentNode === undefined ? undefined : currentNode.getContent()
    + const index = contentOptions.indexOf(currentContent)
    + const newContent = index === -1 || index + 1 === contentOptions.length ? contentOptions[0] : contentOptions[index + 1]
    + this.delete(firstWord)
    + if (newContent) this.touchNode(firstWord).setContent(newContent)
    + return newContent
    + }
    + isMounted() {
    + return !!this._htmlStumpNode
    + }
    + toggleAndRender(firstWord, contentOptions) {
    + this.toggle(firstWord, contentOptions)
    + this.getRootNode().renderAndGetRenderReport()
    + }
    + _getFirstOutdatedDependency(lastRenderedTime = this._getLastRenderedTime() || 0) {
    + return this.getDependencies().find((dep) => dep.getLineModifiedTime() > lastRenderedTime)
    + }
    + getWhetherToUpdateAndReason() {
    + const mTime = this.getLineModifiedTime()
    + const lastRenderedTime = this._getLastRenderedTime() || 0
    + const staleTime = mTime - lastRenderedTime
    + if (lastRenderedTime === 0)
    + return {
    + shouldUpdate: true,
    + reason: "shouldUpdate because this TreeComponent hasn't been rendered yet",
    + staleTime: staleTime,
    + }
    + if (staleTime > 0)
    + return {
    + shouldUpdate: true,
    + reason: "shouldUpdate because this TreeComponent changed",
    + staleTime: staleTime,
    + }
    + const outdatedDependency = this._getFirstOutdatedDependency(lastRenderedTime)
    + if (outdatedDependency)
    + return {
    + shouldUpdate: true,
    + reason: "Should update because a dependency updated",
    + dependency: outdatedDependency,
    + staleTime: outdatedDependency.getLineModifiedTime() - lastRenderedTime,
    + }
    + return {
    + shouldUpdate: false,
    + reason: "Should NOT update because no dependency changed",
    + lastRenderedTime: lastRenderedTime,
    + mTime: mTime,
    + }
    + }
    + getDependencies() {
    + return []
    + }
    + _getTreeComponentsThatNeedRendering(arr) {
    + this._getChildTreeComponents().forEach((child) => {
    + const reasonForUpdatingOrNot = child.getWhetherToUpdateAndReason()
    + if (!child.isMounted() || reasonForUpdatingOrNot.shouldUpdate) arr.push({ child: child, childUpdateBecause: reasonForUpdatingOrNot })
    + child._getTreeComponentsThatNeedRendering(arr)
    + })
    + }
    + toStumpLoadingCode() {
    + return `div Loading ${this.getFirstWord()}...
    + class ${this.getCssClassNames().join(" ")}
    + id ${this.getTreeComponentId()}`
    + }
    + getTreeComponentId() {
    + // html ids can't begin with a number
    + return "treeComponent" + this._getUid()
    + }
    + _toLoadedOrLoadingStumpCode() {
    + if (!this.isLoaded()) return this.toStumpLoadingCode()
    + this.setRunTimePhaseError("renderPhase")
    + try {
    + return this.toStumpCode()
    + } catch (err) {
    + console.error(err)
    + this.setRunTimePhaseError("renderPhase", err)
    + return this.toStumpErrorStateCode(err)
    + }
    + }
    + toStumpErrorStateCode(err) {
    + return `div ${err}
    + class ${this.getCssClassNames().join(" ")}
    + id ${this.getTreeComponentId()}`
    + }
    + _mount(stumpNodeToMountOn, index) {
    + this._setLastRenderedTime(this._getProcessTimeInMilliseconds())
    + this.treeComponentWillMount()
    + this._mountCss()
    + this._mountHtml(stumpNodeToMountOn, this._toLoadedOrLoadingStumpCode(), index) // todo: add index back?
    + this._lastTimeToRender = this._getProcessTimeInMilliseconds() - this._getLastRenderedTime()
    + return this
    + }
    + // todo: we might be able to squeeze virtual dom in here on the mountCss and mountHtml methods.
    + _mountCss() {
    + // todo: only insert css once per class? have a set?
    + this._cssStumpNode = this._getPageHeadStump().insertCssChildNode(this._getCssStumpCode())
    + }
    + _getPageHeadStump() {
    + return this.getRootNode().getWillowBrowser().getHeadStumpNode()
    + }
    + _removeCss() {
    + this._cssStumpNode.removeCssStumpNode()
    + delete this._cssStumpNode
    + }
    + _mountHtml(stumpNodeToMountOn, htmlCode, index) {
    + this._htmlStumpNode = stumpNodeToMountOn.insertChildNode(htmlCode, index)
    + this._htmlStumpNode.setStumpNodeTreeComponent(this)
    + }
    + renderAndGetRenderReport(stumpNode, index) {
    + const isUpdateOp = this.isMounted()
    + let treeComponentUpdateReport = {
    + shouldUpdate: false,
    + reason: "",
    + }
    + if (isUpdateOp) treeComponentUpdateReport = this._updateAndGetUpdateReport()
    + else this._mount(stumpNode, index)
    + const stumpNodeForChildren = this.getStumpNodeForChildren()
    + // Todo: insert delayed rendering?
    + const childResults = this._getChildTreeComponents().map((child, index) => child.renderAndGetRenderReport(stumpNodeForChildren, index))
    + if (isUpdateOp) {
    + if (treeComponentUpdateReport.shouldUpdate) {
    + try {
    + if (this.isLoaded()) this.treeComponentDidUpdate()
    + } catch (err) {
    + console.error(err)
    + }
    + }
    + } else {
    + try {
    + if (this.isLoaded()) this.treeComponentDidMount()
    + } catch (err) {
    + console.error(err)
    + }
    + }
    + let str = `${this.getWord(0) || this.constructor.name} ${isUpdateOp ? "update" : "mount"} ${treeComponentUpdateReport.shouldUpdate} ${treeComponentUpdateReport.reason}`
    + childResults.forEach((child) => (str += "\n" + child.toString(1)))
    + return new jtree.TreeNode(str)
    + }
    -
    - .CodeMirror-line::-moz-selection,
    - .CodeMirror-line>span::-moz-selection,
    - .CodeMirror-line>span>span::-moz-selection {
    - background: #d7d4f0
    + AbstractTreeComponent._mountedTreeComponents = 0
    + class TreeComponentFrameworkDebuggerComponent extends AbstractTreeComponent {
    + toHakonCode() {
    + return `.TreeComponentFrameworkDebuggerComponent
    + position fixed
    + top 5px
    + left 5px
    + z-index 1000
    + background rgba(254,255,156, .95)
    + box-shadow 1px 1px 1px rgba(0,0,0,.5)
    + padding 12px
    + overflow scroll
    + max-height 500px
    + .TreeComponentFrameworkDebuggerComponentCloseButton
    + position absolute
    + cursor pointer
    + opacity .9
    + top 2px
    + right 2px
    + &:hover
    + opacity 1`
    + }
    + toStumpCode() {
    + const app = this.getRootNode()
    + return `div
    + class TreeComponentFrameworkDebuggerComponent
    + div x
    + class TreeComponentFrameworkDebuggerComponentCloseButton
    + clickCommand toggleTreeComponentFrameworkDebuggerCommand
    + div
    + span This app is powered by the
    + a Tree Component Framework
    + href https://github.com/treenotation/jtree/tree/master/treeComponentFramework
    + p ${app.getNumberOfLines()} components loaded. ${WillowBrowser._stumpsOnPage} stumps on page.
    + pre
    + bern
    + ${app.toString(3)}`
    + }
    -
    - .cm-searching {
    - background: #ffa;
    - background: rgba(255, 255, 0, .4)
    + class AbstractGithubTriangleComponent extends AbstractTreeComponent {
    + constructor() {
    + super(...arguments)
    + this.githubLink = `https://github.com/treenotation/jtree`
    + }
    + toHakonCode() {
    + return `.AbstractGithubTriangleComponent
    + display block
    + position absolute
    + top 0
    + right 0`
    + }
    + toStumpCode() {
    + return `a
    + class AbstractGithubTriangleComponent
    + href ${this.githubLink}
    + img
    + src /github-fork.svg`
    + }
    + window.AbstractGithubTriangleComponent = AbstractGithubTriangleComponent
    + window.AbstractTreeComponent = AbstractTreeComponent
    + window.WillowBrowser = WillowBrowser
    + window.TreeComponentFrameworkDebuggerComponent = TreeComponentFrameworkDebuggerComponent
    - .cm-force-border {
    - padding-right: .1px
    - }
    + {
    + class tileBlankLineNode extends jtree.GrammarBackedNode {
    + get emptyCell() {
    + return this.getWord(0)
    + }
    + get visible() {
    + return false
    + }
    + }
    +
    + class abstractTileTreeComponentNode extends AbstractTreeComponent {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + catchAllErrorNode,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    + "amazon.history": amazonHistoryNode,
    + "fitbit.all": fitbitAllNode,
    + "datawrapper.comingSoon": datawrapperComingSoonNode,
    + "dcjs.comingSoon": dcjsComingSoonNode,
    + "finos.perspective.comingSoon": finosPerspectiveComingSoonNode,
    + "fivethirtyeight.comingSoon": fivethirtyeightComingSoonNode,
    + "gov.comingSoon": GovNode,
    + "highcharts.comingSoon": highchartsComingSoonNode,
    + "re3data.comingSoon": re3dataComingSoonNode,
    + "zing.comingSoon": zingComingSoonNode,
    + "editor.helloWorld": editorHelloWorldNode,
    + "challenge.list": challengeListNode,
    + "samples.list": samplesListNode,
    + "vega.data.list": vegaDataListNode,
    + "vega.example.list": vegaExampleListNode,
    + "doc.picker": PickerTileNode,
    + "templates.list": templatesListNode,
    + "asciichart.line": asciiChartNode,
    + "calendar.heat": calendarHeatNode,
    + "challenge.play": challengePlayNode,
    + "debug.dump": debugDumpNode,
    + "web.dump": webDumpNode,
    + "debug.commands": debugCommandsNode,
    + "debug.sleep": debugSleepNode,
    + "debug.noop": debugNoOpNode,
    + "debug.throw": debugThrowNode,
    + "dtjs.basic": dtjsBasicNode,
    + "editor.gallery": editorGalleryNode,
    + "handsontable.basic": handsontableBasicNode,
    + "html.text": htmlTextNode,
    + "html.printAs": htmlPrintAsNode,
    + "html.h1": htmlH1Node,
    + "html.img": htmlImgNode,
    + "html.iframe": htmlIframeNode,
    + "html.custom": htmlCustomNode,
    + "icons.human": iconsHumanNode,
    + "icons.circle": iconsCircleNode,
    + "list.basic": listBasicNode,
    + "list.links": listLinksNode,
    + "markdown.toHtml": markdownToHtmlNode,
    + "roughjs.bar": roughJsBarNode,
    + "roughjs.pie": roughJsPieNode,
    + "roughjs.line": roughJsLineNode,
    + "show.rowCount": showRowCountNode,
    + "show.columnCount": showColumnCountNode,
    + "show.static": showStaticNode,
    + "show.value": showValueNode,
    + "show.median": showMedianNode,
    + "show.sum": showSumNode,
    + "show.mean": showMeanNode,
    + "show.min": showMinNode,
    + "show.max": showMaxNode,
    + "tables.basic": tablesBasicNode,
    + "tables.interesting": tablesInterestingNode,
    + "tables.dump": tablesDumpNode,
    + "text.wordcloud": textWordcloudNode,
    + "treenotation.3d": treenotation3dNode,
    + "treenotation.outline": treenotationOutlineNode,
    + "treenotation.dotline": treenotationDotlineNode,
    + "vega.bar": vegaBarNode,
    + "vega.line": vegaLineNode,
    + "vega.area": vegaAreaNode,
    + "vega.scatter": vegaScatterNode,
    + "vega.bubble": vegaBubbleNode,
    + "vega.emoji": vegaEmojiNode,
    + "vega.histogram": vegaHistogramNode,
    + "vega.example": vegaExampleNode,
    + "tiles.didyoumean": DidYouMeanTileNode,
    + "doc.title": docTitleNode,
    + "doc.subtitle": docSubtitleNode,
    + "doc.section": docSectionNode,
    + "doc.ref": docReferenceNode,
    + "doc.comment": docCommentNode,
    + "doc.tooling": docToolingNode,
    + "github.info": githubInfoNode,
    + "disk.browse": diskBrowseNode,
    + "disk.read": diskReadNode,
    + "hackernews.top": hackernewsTopNode,
    + "hackernews.submissions": hackernewsSubmissionsNode,
    + "publicapis.entries": publicApisNode,
    + "web.get": webGetNode,
    + "web.post": webPostNode,
    + "wikipedia.page": wikipediaContentNode,
    + "cancer.cases": cancerCasesNode,
    + "cdc.infants.weight": weightPercentilesNode,
    + "cdc.infants.length": lengthPercentilesNode,
    + "cdc.infants.headCircumference": headPercentilesNode,
    + "kaggle.datasets.heart": kaggleDatasetsHeartNode,
    + "moz.top500": mozTop500Node,
    + "owid.lifeExpectancy": lifeExpectancyNode,
    + "owid.list": owidListNode,
    + "samples.telescopes": samplesTelescopesNode,
    + "samples.mtcars": samplesMtcarsNode,
    + "samples.iris": samplesIrisNode,
    + "samples.flights14": samplesFlights14Node,
    + "samples.si": samplesSiNode,
    + "samples.portals": samplesPortalNode,
    + "samples.starWars": samplesStarWarsNode,
    + "samples.populations": samplesPopulationsNode,
    + "samples.babyNames": samplesBabyNamesNode,
    + "samples.declaration": samplesDeclarationNode,
    + "samples.periodicTable": samplesPeriodicTableNode,
    + "samples.letters": samplesLettersNode,
    + "samples.presidents": samplesPresidentsNode,
    + "ucimlr.datasets": ucimlrDatasetsNode,
    + "vega.data": vegaDataNode,
    + "reddit.all": redditAllNode,
    + "reddit.subs": redditSubsNode,
    + "reddit.sub": redditSubNode,
    + "samples.patients": samplesPatientsNode,
    + "samples.poem": samplesPoemNode,
    + "samples.outerSpace": samplesOuterSpaceNode,
    + "samples.treeProgram": samplesTreeProgramNode,
    + "samples.waterBill": samplesWaterBillNode,
    + "samples.gapMinder": samplesGapMinderNode,
    + "date.addColumns": dateAddColumnsNode,
    + "gen.constant": genConstantNode,
    + "gen.growth": genGrowthNode,
    + "math.log": mathLogNode,
    + "rows.addIndexColumn": rowsAddIndexColumnNode,
    + "rows.runningTotal": rowsRunningTotalNode,
    + "text.length": textLengthNode,
    + "text.split": textSplitNode,
    + "text.reverseSplit": reverseTextSplitNode,
    + "text.toLowerCase": textToLowerCaseNode,
    + "text.template": textTemplateNode,
    + "text.permalink": textPermalinkNode,
    + "text.replace": textReplaceNode,
    + "text.trim": textTrimNode,
    + "text.substring": textSubstringNode,
    + "text.firstLetter": testFirstLetterNode,
    + "columns.describe": columnsDescribeNode,
    + "columns.list": columnsListNode,
    + "data.eval": dataEvalNode,
    + "join.by": joinByNode,
    + "match.columnsFuzzy": matchColumnsFuzzyNode,
    + "schema.toTypescript": schemaTypeScriptNode,
    + "schema.toSimple": schemaSimpleNode,
    + "text.wordCount": textWordCountNode,
    + "text.lineCount": textLineCountNode,
    + "treenotation.wordTypes": treenotationWordTypesNode,
    + "columns.first": columnsFirstNode,
    + "columns.last": columnsLastNode,
    + "columns.drop": columnsDropNode,
    + "columns.dropConstants": columnsDropConstantsNode,
    + "columns.keep": columnsKeepNode,
    + "columns.keepNumerics": columnsKeepNumericsNode,
    + "rows.shuffle": rowsShuffleNode,
    + "rows.reverse": rowsReverseNode,
    + "filter.where": filterWhereNode,
    + "filter.with": filterWithNode,
    + "filter.without": filterWithoutNode,
    + "filter.withAny": filterAnyNode,
    + "rows.first": rowsFirstNode,
    + "rows.sample": rowsSampleNode,
    + "rows.dropIfMissing": rowsDropIfMissingNode,
    + "rows.last": rowsLastNode,
    + "bitanath.pca": pcaNode,
    + "columns.rename": columnsRenameNode,
    + "columns.cleanNames": columnsCleanNamesNode,
    + "columns.setType": columnsSetTypeNode,
    + "data.synth": dataSynthNode,
    + "data.about": dataAboutNode,
    + "data.usabilityScore": dataUsabilityScoreNode,
    + "fill.missing": fillMissingNode,
    + "gen.range": genRangeNode,
    + "group.by": groupByNode,
    + "rows.sortBy": rowsSortByNode,
    + "rows.sortByReverse": rowsSortByReverseNode,
    + "rows.addOne": rowsAddOneNode,
    + "text.matches": textMatchesNode,
    + "text.combine": textCombineNode,
    + "data.inline": dataInlineNode,
    + "data.localStorage": dataLocalStorageNode,
    + "debug.parserTest": debugParserTestNode,
    + "debug.ohayoGrammar": debugGrammarNode,
    + "debug.ohayoGrammarTree": debugGrammarTreeNode,
    + "editor.files": editorFilesNode,
    + "editor.commandHistory": editorCommandHistoryNode,
    + "math.gen": mathGenNode,
    + "random.float": randomFloatNode,
    + "random.int": randomIntNode,
    + "samples.tinyIris": samplesTinyIrisNode,
    + "assert.rowCount": assertRowCountNode,
    + "print.text": printNode,
    + "print.csv": printCsvNode,
    + hidden: hiddenNode,
    + visible: visibleNode,
    + maximized: maximizedNode,
    + left: leftNode,
    + top: topNode,
    + width: widthNode,
    + height: heightNode,
    + }),
    + [{ regex: /^$/, nodeConstructor: tileBlankLineNode }]
    + )
    + }
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get inspectionStumpTemplate() {
    + return `div TileConstructor: {constructorName} ParentConstructor: {parentConstructorName}
    + div Messages:
    + ol
    + {messages}
    + div Tree:
    + pre
    + bern
    + {sourceCode}
    + div All Tile Settings:
    + pre
    + bern
    + {settings}
    + div Input rows: {inputCount} Output rows: {outputCount}
    + div Load time: {timeToLoad} Render time: {renderTime}
    + div Input Columns:
    + pre
    + bern
    + {inputColumnsAsTable}
    + div Output Columns
    + pre
    + bern
    + {outputColumnsAsTable}
    + div Output Numeric Values:
    + pre
    + bern
    + {outputNumericValues}
    + div TypeScript Interface:
    + pre
    + bern
    + {typeScriptInterface}
    + div Input Numeric Values:
    + pre
    + bern
    + {inputNumericValues}`
    + }
    + get tileStumpTemplate() {
    + return `div
    + class {classes}
    + id {id}
    + div
    + style {bodyStyle}
    + class TileBody
    + {body}
    + div
    + class TileFooter
    + {footer}`
    + }
    + get errorStateStumpTemplate() {
    + return `div
    + class {classes}
    + id {id}
    + div
    + class TileBody
    + div ERROR
    + {content}
    + div
    + class TileFooter
    + {footer}`
    + }
    + get pencilStumpTemplate() {
    + return `span ➕
    + class TileInsertBetweenButton
    + clickCommand insertTileBetweenCommand
    + span ▼
    + class TileDropDownButton
    + clickCommand toggleTileMenuCommand`
    + }
    + get errorLogMessageStumpTemplate() {
    + return `div Error occurred. See console.
    + class OhayoError`
    + }
    + get tileLoadingTemplate() {
    + return `div
    + class abstractTileTreeComponentNode
    + id {id}
    + div Loading {name}...
    + class TileBody
    + div
    + class TileFooter
    + {footer}`
    + }
    + get visibleKey() {
    + return `visible`
    + }
    + get hiddenKey() {
    + return `hidden`
    + }
    + get yearKey() {
    + return `year`
    + }
    + get monthKey() {
    + return `month`
    + }
    + get needsData() {
    + return true
    + }
    + get dayKey() {
    + return `day`
    + }
    + get ohayoFileExtensionKey() {
    + return `.ohayo`
    + }
    + get columnPredictionHintsKey() {
    + return `columnPredictionHints`
    + }
    + get sizeColumnKey() {
    + return `sizeColumn`
    + }
    + get shapeColumnKey() {
    + return `shapeColumn`
    + }
    + get colorColumnKey() {
    + return `colorColumn`
    + }
    + get yColumnKey() {
    + return `yColumn`
    + }
    + get xColumnKey() {
    + return `xColumn`
    + }
    + get contentKey() {
    + return `content`
    + }
    + get rowDisplayLimitKey() {
    + return `rowDisplayLimit`
    + }
    + get settingKey() {
    + return `setting`
    + }
    + // todo: ADD TYPINGS
    + getPipishInput() {
    + // todo: add placeholder property?
    + return this.getSettingsStruct().content || this.getParentOrDummyTable().getFirstColumnAsString() || ""
    + }
    + getDependencies() {
    + return [{ getLineModifiedTime: () => this.getParentOrDummyTable().getTableCTime() }] // todo: we removed this: this.getOutputOrInputTable().getTableCTime()...i think we had it because we want to return true to update children.
    + }
    + getRunTimeEnumOptions(cell) {
    + // todo: only works if codemirror === tab
    + try {
    + // todo: handle at static time.
    + if (cell.getCellTypeId() === "columnNameCell" && this.isLoaded()) {
    + const mirrorNode = typeof app === "undefined" ? this : app.mountedProgram.nodeAtLine(this.getLineNumber() - 1)
    + return mirrorNode.getParentOrDummyTable().getColumnNames()
    + }
    + } catch (err) {
    + console.log(err)
    + }
    + }
    + mapSettingNamesToColumnNames(settingNames) {
    + const tileStruct = this.getSettingsStruct()
    + return settingNames.map((name) => tileStruct[name])
    + }
    + getOutputOrInputTable() {
    + return this._outputTable || this.getParentOrDummyTable()
    + }
    + getOutputTable() {
    + return this._outputTable
    + }
    + getParentOrDummyTable() {
    + // Returns: non-empty input table || dummy table || empty input table.
    + const parentTable = this.getParent().getOutputOrInputTable()
    + if (!parentTable.isBlankTable()) return parentTable
    + return this._getDummyTable() || parentTable
    + }
    + _getDummyTable() {
    + const dataSet = DummyDataSets[this.dummyDataSetName]
    + if (!this._dummyTable && dataSet) this._dummyTable = new Table(jtree.Utils.javascriptTableWithHeaderRowToObjects(dataSet))
    + return this._dummyTable
    + }
    + getRequiredTableWithHeader(headerSettingNames) {
    + const columnNames = this.mapSettingNamesToColumnNames(headerSettingNames)
    + const table = this.getParentOrDummyTable()
    + const columns = columnNames.map((name) => table.getTableColumnByName(name))
    + if (columns.some((col) => !col)) return []
    + return this.getRowsAsDataTableArrayWithHeader(table.getRows(), columnNames)
    + }
    + setIsDataLoaded(value) {
    + this._isDataLoaded = value
    + this.makeDirty() // todo: remove
    + return this
    + }
    + getRowsAsDataTableArrayWithHeader(rows, header) {
    + const data = rows.map((row) => row.getAsArray(header))
    + data.unshift(header)
    + return data
    + }
    + getTileQualityCheck() {
    + const definition = this.getDefinition()
    + const name = this.getFirstWord()
    + let score = 0
    + return {
    + name: name,
    + namespace: name.split(".")[0],
    + description: definition.getDescription() ? 1 : 0,
    + dummyDataSetName: this.dummyDataSetName,
    + runTimeErrors: Object.values(this.getRunTimePhaseErrors()).length,
    + examples: definition.getExamples().length,
    + edgeTests: 0,
    + speedTests: 0,
    + roadMap: 0,
    + idealStyleUXDescription: 0,
    + secPriTests: 0,
    + userType: 0,
    + }
    + }
    + _getCachedSettings() {
    + if (this._cache_settingsObject) return this._cache_settingsObject
    + this._cache_settingsObject = {}
    + this.filter((child) => child.doesExtend("abstractTileSettingTerminalNode") || child.doesExtend("abstractTileSettingNonTerminalNode")).forEach((setting) => {
    + this._cache_settingsObject[setting.getFirstWord()] = setting.getSettingValue()
    + })
    + return this._cache_settingsObject
    + }
    + // todo: ADD TYPINGS
    + getSettingsStruct() {
    + const settingsFromCache = this._getCachedSettings()
    + // todo: this wont work anymore
    + const hintsNode = this.getDefinition().getConstantsObject()[this.columnPredictionHintsKey]
    + if (hintsNode)
    + Object.assign(settingsFromCache, this.getParentOrDummyTable().getPredictionsForAPropertyNameToColumnNameMapGivenHintsNode(new jtree.TreeNode(hintsNode), settingsFromCache))
    + return settingsFromCache
    + }
    + getProgramTemplate(id) {}
    + getSnippetTemplate(id) {}
    + getExampleTemplate(index) {
    + // todo: right now we only have 1 example per tile.
    + const exampleNode = this.getDefinition().getNode(jtree.GrammarConstants.example)
    + return exampleNode ? exampleNode.childrenToString() : ""
    + }
    + toStumpLoadingCode() {
    + return this.qFormat(this.tileLoadingTemplate, {
    + classes: this.getCssClassNames().join(" "),
    + id: this.getTreeComponentId(),
    + name: this.getWord(0),
    + footer: this.getTileMenuButtonStumpCode(),
    + })
    + }
    + emitLogMessage(message) {
    + const tab = this.getTab()
    + if (tab) tab.addStumpCodeMessageToLog(message)
    + else if (this.isNodeJs()) console.log(message)
    + }
    + getTheme() {
    + return this.getTab().getTheme()
    + }
    + qFormat(str, obj) {
    + return new jtree.TreeNode(str).templateToString(obj)
    + }
    + scrollIntoView() {
    + const el = this.getStumpNode().getShadow().getShadowElement()
    + if (el) el.scrollIntoView()
    + }
    + async loadBrowserRequirements() {
    + const loadingMap = this.getTab().getRootNode().getDefinitionLoadingPromiseMap()
    + if (!loadingMap.has(this.constructor)) loadingMap.set(this.constructor, this._makeBrowserLoadRequirementsPromise(loadingMap))
    + await loadingMap.get(this.constructor)
    + }
    + async _makeBrowserLoadRequirementsPromise(loadingMap) {
    + const app = this.getWebApp()
    + const cssScript = this[OhayoConstants.tileCssScript]
    + if (cssScript) this._loadTileCss(cssScript)
    + const def = this.getDefinition()
    + const scriptPaths = def.nodesThatStartWith("string " + OhayoConstants.tileScript).map((node) => node.getWord(2))
    + const thisScript = this[OhayoConstants.tileScript]
    + if (thisScript && !scriptPaths.includes(thisScript)) scriptPaths.push(thisScript)
    + if (scriptPaths.length) await Promise.all(scriptPaths.map((scriptPath) => app.getWillowBrowser().appendScript(scriptPath)))
    + loadingMap.set(this.constructor, true)
    + }
    + _loadTileCss(css) {
    + const app = this.getWebApp()
    + app
    + .getWillowBrowser()
    + .getBodyStumpNode()
    + .insertChildNode(
    + css
    + .split(" ")
    + .map(
    + (url) => `link
    + rel stylesheet
    + media screen
    + href ${url}`
    + )
    + .join("\n")
    + )
    + }
    + _hasBrowserRequirements() {
    + return this.tileScript
    + }
    + _areBrowserRequirementsLoaded() {
    + if (this.isNodeJs()) return true
    + // todo: cleanup. assumes app is here in browser.
    + const loadingMap = app.getDefinitionLoadingPromiseMap()
    + return !this._hasBrowserRequirements() || loadingMap.get(this.constructor) === true
    + }
    + isLoaded() {
    + return this._areBrowserRequirementsLoaded() && (!this.needsData || this._isDataLoaded)
    + }
    + getErrorMessageHtml() {
    + const errors = Object.values(this.getRunTimePhaseErrors())
    + return errors.length ? ` ${errors.join(" ")}` : "" //todo: cleanup
    + }
    + toStumpErrorStateCode(err) {
    + return this.qFormat(this.errorStateStumpTemplate, {
    + classes: this.getCssClassNames().join(" "),
    + id: this.getTreeComponentId(),
    + content: `div ` + err,
    + footer: this.getTileMenuButtonStumpCode(),
    + })
    + }
    + // todo: delete this
    + makeDirty() {
    + delete this._cache_settingsObject
    + delete this._bodyStumpCodeCache // todo: cleanup
    + this._setLastRenderedTime(0)
    + }
    + getAllTileSettingsDefinitions() {
    + const def = this.getDefinition()
    + return Object.values(def.getFirstWordMapWithDefinitions()).filter((def) => def.isOrExtendsANodeTypeInScope([OhayoConstants.abstractTileSetting]))
    + }
    + getTab() {
    + return this.getRootNode().getTab()
    + }
    + getChildTiles() {
    + return this.getChildInstancesOfNodeTypeId("abstractTileTreeComponentNode")
    + }
    + selectTile() {
    + this.selectNode()
    + if (this.isMounted()) this.getStumpNode().addClassToStumpNode(OhayoConstants.selectedClass)
    + }
    + unselectNode() {
    + super.unselectNode()
    + if (this.isMounted()) this.getStumpNode().removeClassFromStumpNode(OhayoConstants.selectedClass)
    + }
    + getCssClassNames() {
    + const classNames = super.getCssClassNames()
    + if (this._isMaximized()) classNames.push("TileMaximized")
    + return classNames
    + }
    + toStumpCode() {
    + return this.qFormat(this.tileStumpTemplate, {
    + classes: this.getCssClassNames().join(" "),
    + id: this.getTreeComponentId(),
    + bodyStyle: this.customBodyStyle || "",
    + body: this._getBodyStumpCodeCache() || "",
    + footer: this.getTileFooterStumpCode(),
    + })
    + }
    + _getBodyStumpCodeCache() {
    + if (!this._bodyStumpCodeCache) this._bodyStumpCodeCache = this.getTileBodyStumpCode()
    + return this._bodyStumpCodeCache
    + }
    + getTileBodyStumpCode() {
    + return ``
    + }
    + _getCss() {
    + const selector = "#" + this.getTreeComponentId()
    + const theme = this.getTheme()
    + const visibleCss = this.isVisible() ? "" : "display: none"
    + const hakonCode = this.hakonTemplate ? new jtree.TreeNode(theme).evalTemplateString(this.hakonTemplate) : this.toHakonCode()
    + return `${selector} { ${visibleCss} }
    + ${theme.hakonToCss(hakonCode)}`
    + }
    + handleTileError(err) {
    + if (!this._errorCount) this._errorCount = 0
    + this._errorCount++
    + this.getRootNode().goRed(err)
    + }
    + async insertTileBetweenCommand() {
    + const tab = this.getTab()
    + const newNode = this.appendLine("doc.picker")
    + this.getChildTiles().forEach((tile) => {
    + if (tile === newNode) return true
    + newNode.appendNode(tile)
    + tile.unmountAndDestroy()
    + })
    + tab.autosaveTab()
    + await this.getRootNode().loadAndIncrementalRender()
    + }
    + getWall() {
    + return this.getWebApp().getAppWall()
    + }
    + getWebApp() {
    + return this.getTab().getRootNode()
    + }
    + async runAndrenderAndGetRenderReport() {
    + await this.execute()
    + return this.renderAndGetRenderReport()
    + }
    + getTimeToLoad() {
    + return this._timeToLoad || 0
    + }
    + toHakonCode() {
    + return ""
    + }
    + getTileFooterStumpCode() {
    + return this.getTileMenuButtonStumpCode()
    + }
    + getTileMenuButtonStumpCode() {
    + return this.qFormat(this.pencilStumpTemplate)
    + }
    + // Tile child rendering is done at the wall level.
    + _getChildTreeComponents() {
    + return []
    + }
    + getStumpNodeForChildren() {
    + // We render all Tiles on the Wall.
    + return this.getStumpNode().getParent()
    + }
    + toInspectionStumpCode() {
    + const messages = this.getMessageBuffer().map((message) => `li ${moment(message.getLineModifiedTime()).fromNow()} - ${message.childrenToString()}`)
    + // const settings = this.getAllTileSettingsDefinitions()
    + // .map(setting => `${setting.getFirstWord()} ${setting.getDescription()}`)
    + // .join("\n")
    + const settings = JSON.stringify(this.getSettingsStruct(), null, 2)
    + const parentConstructorName = this.getParent().constructor.name
    + const constructorName = this.constructor.name
    + const sourceCode = this.toString()
    + const inputTable = this.getParentOrDummyTable()
    + const outputTable = this.getOutputOrInputTable()
    + const outputColumns = outputTable.getColumnsArrayOfObjects()
    + const inputCols = inputTable.getColumnsArrayOfObjects()
    + const inputCount = inputTable.getRowCount()
    + const outputCount = outputTable.getRowCount()
    + const timeToLoad = this.getTimeToLoad()
    + const renderTime = this.getNewestTimeToRender()
    + const inputColumnsAsTable = new jtree.TreeNode(inputCols).toTable()
    + const outputColumnsAsTable = new jtree.TreeNode(outputColumns).toTable()
    + const outputNumericValues = new jtree.TreeNode(outputTable.getJavascriptNativeTypedValues()).toTable()
    + const typeScriptInterface = outputTable.toTypeScriptInterface()
    + const inputNumericValues = new jtree.TreeNode(inputTable.getJavascriptNativeTypedValues()).toTable()
    + return this.qFormat(this.inspectionStumpTemplate, {
    + settings,
    + inputCount,
    + outputCount,
    + timeToLoad,
    + renderTime,
    + inputColumnsAsTable,
    + outputColumnsAsTable,
    + outputNumericValues,
    + typeScriptInterface,
    + inputNumericValues,
    + constructorName,
    + parentConstructorName,
    + sourceCode,
    + messages,
    + })
    + }
    + isVisible() {
    + if (this.has(this.visibleKey)) return true
    + if (this.visible === false) return false
    + if (this.has(this.hiddenKey)) return false
    + return true
    + }
    + _isMaximized() {
    + return this.has(OhayoConstants.maximized)
    + }
    + async _executeChildNodes() {
    + await Promise.all(this.getChildTiles().map((tile) => tile.execute()))
    + }
    + async _execute() {
    + this.setIsDataLoaded(true)
    + await this._executeChildNodes()
    + }
    + async execute() {
    + try {
    + this.setRunTimePhaseError("execute")
    + await this._execute()
    + } catch (err) {
    + this.setRunTimePhaseError("execute", err)
    + console.error(err)
    + this.emitLogMessage(this.errorLogMessageStumpTemplate)
    + }
    + return this
    + }
    + cloneTileCommand() {
    + this.duplicateLineCommand()
    + return this.getTab().autosaveAndRender()
    + }
    + duplicateLineCommand() {
    + return this.getParent().insertLineAndChildren(this.getLine(), undefined, this.getIndex() + 1)
    + }
    + async toggleTileMaximizeCommand() {
    + if (this.has(OhayoConstants.maximized)) this.delete(OhayoConstants.maximized)
    + else this.touchNode(OhayoConstants.maximized)
    + await this._runAfterTileUpdate(this)
    + }
    + async triggerTileMethodCommand(value, methodName) {
    + await thisethodName](value)
    + await this._runAfterTileUpdate(this)
    + }
    + // todo: refactor.
    + async changeTileTypeCommand(newValue) {
    + const tab = this.getTab()
    + this.setFirstWord(newValue)
    + const newNode = this.duplicate()
    + // todo: destroy or something? how do we reparse.
    + this.getChildTiles().forEach((tile) => tile.unmountAndDestroy())
    + this.unmountAndDestroy()
    + tab.autosaveTab()
    + this.getRootNode().loadAndIncrementalRender()
    + }
    + changeParentCommand(pathVector) {
    + // if (tile.getFirstWordPath() === value) return; // todo: do we need this line?
    + const program = this.getRootNode()
    + const indexPath = pathVector ? pathVector.split(" ").map((num) => parseInt(num)) : ""
    + const destinationTree = indexPath ? program.nodeAt(indexPath) : program
    + // todo: on jtree should we make copyTo second param optional?
    + this.copyTo(destinationTree, destinationTree.length)
    + this.unmountAndDestroy()
    + return this.getTab().autosaveAndRender()
    + }
    + async removeTileCommand() {
    + const tab = this.getTab()
    + this.getChildTiles().forEach((tile) => {
    + tile.unmount()
    + tile.shiftLeft()
    + })
    + this.unmountAndDestroy()
    + tab.autosaveTab()
    + this.getRootNode().loadAndIncrementalRender()
    + }
    + getNewDataCommand() {
    + // todo: have some type of paging system to fetch new data.
    + }
    + async changeTileSettingAndRenderCommand(value, settingName) {
    + // note the unusual ordering of params.
    + this.touchNode(settingName).setContent(value.toString())
    + // todo: sometimes size needs to be redone (maximize, for example)
    + await this._runAfterTileUpdate(this)
    + }
    + // todo: remove
    + async changeTileSettingMultilineCommand(val, settingName) {
    + this.touchNode(settingName).setChildren(val)
    + await this._runAfterTileUpdate(this)
    + }
    + async changeTileSettingCommand(settingName, value) {
    + this.touchNode(settingName).setContent(value)
    + }
    + async changeWordAndRenderCommand(value, index) {
    + this.setWord(parseInt(index), value)
    + await this._runAfterTileUpdate(this)
    + }
    + async changeWordsAndRenderCommand(value, index) {
    + index = parseInt(index)
    + const edgeSymbol = this.getEdgeSymbol()
    + const words = this.getWords().slice(0, index)
    + this.setLine(words.concat(value.split(edgeSymbol)).join(edgeSymbol))
    + await this._runAfterTileUpdate(this)
    + }
    + async updateChildrenCommand(val) {
    + this.setChildren(val)
    + // reload the whole doc for now.
    + await this._runAfterTileUpdate(this)
    + }
    + async _runAfterTileUpdate(tile) {
    + tile.makeDirty() // ugly!
    + tile.getChildTiles().forEach((tile) => {
    + tile.makeDirty() // todo: ugly!
    + })
    + // todo: what if you have a tile that has a contextare that allows editing of its children/
    + // if you edit a child, then that parent tile needs to update to...should we allow that or ban that?
    + await tile.getTab().autosaveTab()
    + await tile.runAndrenderAndGetRenderReport()
    + tile.getTab().getRootNode().renderApp() // Need to render full app because of code editor
    + }
    + // todo: downstream data changes?
    + async changeTileContentAndRenderCommand(value) {
    + this.setContent(value)
    + await this._runAfterTileUpdate(this)
    + }
    + async copyTileCommand() {
    + // todo: remove cousin tiles?
    + this.getRootNode().getWillowBrowser().copyTextToClipboard(this.getFirstAncestor().toString())
    + }
    + async createProgramFromTileExampleCommand(index) {
    + const template = this.getExampleTemplate(index)
    + if (!template) return undefined
    + const fileExtension = "ohayo" // todo: generalize
    + const tab = await this.getTab().getRootNode()._createAndOpen(template, `help-for-${this.getFirstWord()}.${fileExtension}`)
    + tab.addStumpCodeMessageToLog(`div Created '${tab.getFullTabFilePath()}'`)
    + }
    + async inspectTileCommand() {
    + if (!this.isNodeJs()) {
    + console.log("Tile available at window.tile")
    + window.tile = this
    + console.log(this)
    + }
    + this.getTab().addStumpCodeMessageToLog(this.toInspectionStumpCode())
    + this.getTab().getRootNode().renderApp()
    + }
    + async toggleTileMenuCommand() {
    + const app = this.getTab().getRootNode()
    + app.setTargetTile(this)
    + app.toggleAndRender(`${StudioConstants.tileMenu}`)
    + }
    + async createProgramFromTemplateCommand(id) {
    + const programTemplate = this.getProgramTemplate(id)
    + if (!programTemplate) return undefined
    + const tab = await this.getTab().getRootNode()._createAndOpen(programTemplate.template, programTemplate.name)
    + tab.addStumpCodeMessageToLog(`div Created '${tab.getFullTabFilePath()}'`)
    + }
    + async appendSnippetTemplateCommand(id) {
    + const snippet = this.getSnippetTemplate(id)
    + if (!snippet) return undefined
    + const tab = this.getTab()
    + const tabProgram = tab.getTabProgram()
    + const newNodes = tabProgram.concat(snippet)
    + const newTiles = newNodes.filter((tile) => tile.doesExtend && tile.doesExtend("abstractTileTreeComponentNode"))
    + tab.autosaveTab()
    + tabProgram.clearSelection()
    + tab.getTabWall().unmount()
    + await tabProgram.loadAndIncrementalRender()
    + newTiles.forEach((tile) => tile.selectTile())
    + newTiles[0].scrollIntoView()
    + }
    + async copyDataCommand(delimiter) {
    + this.getRootNode().getWillowBrowser().copyTextToClipboard(this.getOutputOrInputTable().toDelimited(delimiter))
    + }
    + async copyDataAsJavascriptCommand() {
    + const table = this.getOutputOrInputTable()
    + this.getRootNode()
    + .getWillowBrowser()
    + .copyTextToClipboard(JSON.stringify(table.toTree().toDataTable(table.getColumnNames()), null, 2))
    + }
    + async copyDataAsTreeCommand() {
    + const text = this.getOutputOrInputTable().toTree().toString()
    + this.getRootNode().getWillowBrowser().copyTextToClipboard(text)
    + }
    + async exportTileDataCommand(format = "csv") {
    + // todo: figure this out. use the browsers filename? tile title? id?
    + let extension = "csv"
    + let type = "text/csv"
    + let str = this.getOutputOrInputTable().toDelimited(",")
    + if (format === "tree") {
    + extension = "tree"
    + type = "text"
    + str = this.getOutputOrInputTable().toTree().toString()
    + }
    + this.getRootNode()
    + .getWillowBrowser()
    + .downloadFile(str, this.getTab().getFileName() + "." + extension, type)
    + }
    + }
    +
    + class abstractChartNode extends abstractTileTreeComponentNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + undefined,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { rowDisplayLimit: rowDisplayLimitNode }),
    + undefined
    + )
    + }
    + get tileFooterTemplate() {
    + return `span Rows: {rowCount} Columns Out: {columnCount}
    + {tileMenuButton}`
    + }
    + get rowDisplayLimit() {
    + return 10000
    + }
    + getTileFooterStumpCode() {
    + const table = this.getParentOrDummyTable()
    + return this.qFormat(this.tileFooterTemplate, {
    + rowCount: table.getRowCount(),
    + columnCount: table.getColumnCount(),
    + tileMenuButton: this.getTileMenuButtonStumpCode(),
    + })
    + }
    + getTileRunTimeWidth() {
    + return this.isNodeJs() ? 456 : jQuery(".WallTreeComponent").width() - 100
    + }
    + getTileRunTimeHeight() {
    + return 300
    + }
    + toDisplayString(value, columnName) {
    + // todo: remove.
    + if (value === undefined) return ""
    + return this.getParentOrDummyTable().getTableColumnByName(columnName).toDisplayString(value)
    + }
    + _getRowDisplayLimit() {
    + const limitStr = this.getSettingsStruct()[this.rowDisplayLimitKey] || this.rowDisplayLimit
    + const limit = parseInt(limitStr)
    + if (!limitStr || isNaN(limit)) return undefined
    + return limit
    + }
    + getRowsWithRowDisplayLimit() {
    + return this.getParentOrDummyTable().getRows().slice(0, this._getRowDisplayLimit())
    + }
    + }
    +
    + class abstractTextNode extends abstractChartNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { content: contentNode }), undefined)
    + }
    + get stringCell() {
    + return this.getWordsFrom(0)
    + }
    + get bodyStumpTemplate() {
    + return `div
    + class TileSelectable
    + bern
    + {content}`
    + }
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, { content: this.content ? jtree.Utils.linkify(this.content) : "" })
    + }
    + }
    +
    + class abstractInstructionsNode extends abstractTextNode {
    + get content() {
    + return `Instructions go here.`
    + }
    + get tileSize() {
    + return `600 240`
    + }
    + }
    +
    + class amazonHistoryNode extends abstractInstructionsNode {
    + get dummyDataSetName() {
    + return `amazonPurchases`
    + }
    + get content() {
    + return `Step 1. Go to https://www.amazon.com/gp/b2b/reports to download your Amazon order history.
    Step 2. Add the data here.`
    + }
    + }
    +
    + class fitbitAllNode extends abstractInstructionsNode {
    + get content() {
    + return `Step 1. Go to https://www.fitbit.com/settings/data/export to download your Fitbit data.
    Step 2. Drop the CSV onto this page.`
    + }
    + }
    +
    + class abstractComingSoonNode extends abstractTextNode {
    + get content() {
    + return `Instructions go here.`
    + }
    + get tileSize() {
    + return `600 240`
    + }
    + }
    +
    + class datawrapperComingSoonNode extends abstractComingSoonNode {
    + get content() {
    + return `We don't have support yet for https://www.datawrapper.de/`
    + }
    + }
    +
    + class dcjsComingSoonNode extends abstractComingSoonNode {
    + get content() {
    + return `We don't have support yet for https://github.com/dc-js/dc.js`
    + }
    + }
    +
    + class finosPerspectiveComingSoonNode extends abstractComingSoonNode {
    + get content() {
    + return `We don't have support yet for https://perspective.finos.org/`
    + }
    + }
    +
    + class fivethirtyeightComingSoonNode extends abstractComingSoonNode {
    + get content() {
    + return `We don't have support yet for https://github.com/fivethirtyeight/data/`
    + }
    + }
    +
    + class GovNode extends abstractComingSoonNode {
    + get content() {
    + return `We don't have support yet for https://www.data.gov/`
    + }
    + }
    +
    + class highchartsComingSoonNode extends abstractComingSoonNode {
    + get content() {
    + return `We don't have support yet for https://www.highcharts.com/blog/snippets/3d-solar-system/`
    + }
    + }
    +
    + class re3dataComingSoonNode extends abstractComingSoonNode {
    + get content() {
    + return `We don't have support yet for https://www.re3data.org/`
    + }
    + }
    +
    + class zingComingSoonNode extends abstractComingSoonNode {
    + get content() {
    + return `We don't have support yet for https://www.zingchart.com/`
    + }
    + }
    +
    + class editorHelloWorldNode extends abstractTextNode {
    + get content() {
    + return `Ohayo world!`
    + }
    + }
    +
    + class abstractSnippetGalleryNode extends abstractChartNode {
    + get optionStumpTemplate() {
    + return `li
    + a {title}
    + value {value}
    + class appendSnippetButton
    + clickCommand appendSnippetTemplateCommand`
    + }
    + get bodyStumpTemplate() {
    + return `h4 {title}
    + ol
    + class TileSelectable
    + {options}`
    + }
    + get tileSize() {
    + return `600 240`
    + }
    + getGalleryNodes() {}
    + async _execute() {
    + this._outputTable = new Table(this.getGalleryNodes().toDataTable().slice(1))
    + this.setIsDataLoaded(true)
    + await this._executeChildNodes()
    + }
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, {
    + title: this.title,
    + options: new jtree.TreeNode(
    + this.getGalleryNodes()
    + .map((node) => this.qFormat(this.optionStumpTemplate, { title: node.evalTemplateString(this.itemFormat), value: node.get("id") }))
    + .join("\n")
    + ).toString(),
    + })
    + }
    + }
    +
    + class abstractTemplateGalleryNode extends abstractSnippetGalleryNode {
    + get optionStumpTemplate() {
    + return `li
    + a {title}
    + value {value}
    + class createProgramButton
    + clickCommand createProgramFromTemplateCommand`
    + }
    + }
    +
    + class challengeListNode extends abstractSnippetGalleryNode {
    + get itemFormat() {
    + return `{question}`
    + }
    + get title() {
    + return `Try a challenge:`
    + }
    + getGalleryNodes() {
    + return typeof challengesTree === "undefined" ? jtree.TreeNode.fromDisk("ohayo/packages/challenge/challenges.tree") : new jtree.TreeNode(challengesTree)
    + }
    + getSnippetTemplate(id) {
    + return `challenge.play ${id}`
    + }
    + }
    +
    + class samplesListNode extends abstractSnippetGalleryNode {
    + get isDataPublicDomain() {
    + return true
    + }
    + get itemFormat() {
    + return `{id} - {description}`
    + }
    + get title() {
    + return `All samples:`
    + }
    + getGalleryNodes() {
    + // todo: cleanup.
    + const ohayo = this.getWebApp().getOhayoGrammarAsTree()
    + const hits = ohayo.getNodesByRegex(/^samples/).map((node) => {
    + return {
    + id: node.get("crux"),
    + description: node.get("description"),
    + }
    + })
    + return new jtree.TreeNode(hits)
    + }
    + getSnippetTemplate(id) {
    + return id
    + }
    + }
    +
    + class vegaDataListNode extends abstractSnippetGalleryNode {
    + get itemFormat() {
    + return `{id}`
    + }
    + get title() {
    + return `All Vega datasets:`
    + }
    + getGalleryNodes() {
    + // todo: cleanup this line.
    + const node = this.getWebApp()
    + .getOhayoGrammarAsTree()
    + .getNodesByRegex(/^vegaDataSetCell/)[0]
    + return new jtree.TreeNode(
    + node
    + .get("enum")
    + .split(" ")
    + .map((item) => {
    + return {
    + id: item,
    + }
    + })
    + )
    + }
    + getSnippetTemplate(id) {
    + return `vega.data ${id}`
    + }
    + }
    +
    + class vegaExampleListNode extends abstractSnippetGalleryNode {
    + get itemFormat() {
    + return `{id}`
    + }
    + get title() {
    + return `All Vega examples:`
    + }
    + getGalleryNodes() {
    + // todo: cleanup this line.
    + const node = this.getWebApp()
    + .getOhayoGrammarAsTree()
    + .getNodesByRegex(/^vegaExampleNameCell/)[0]
    + return new jtree.TreeNode(
    + node
    + .get("enum")
    + .split(" ")
    + .map((item) => {
    + return {
    + id: item,
    + }
    + })
    + )
    + }
    + getSnippetTemplate(id) {
    + return `vega.example ${id}`
    + }
    + }
    +
    + class abstractPickerTileNode extends abstractChartNode {
    + get categoryBreakStumpTemplate() {
    + return `div {category}
    + class PickerCategory`
    + }
    + get itemStumpTemplate() {
    + return `{categoryBreak}
    + a {name}
    + br
    + span {description}
    + title {description}
    + tabindex -1
    + value {value}
    + class pickerItemButton
    + clickCommand {command}`
    + }
    + get hakonTemplate() {
    + return `.abstractPickerTileNode
    + .PickerCategory
    + width 100%
    + margin-top 20px
    + text-align center
    + .TileBody
    + display flex
    + flex-flow row wrap
    + a
    + &:hover
    + background-color {borderColor}
    + padding 10px
    + margin 5px
    + height 30px
    + background-color {backgroundColor}
    + border 1px solid {borderColor}
    + overflow hidden
    + text-align center
    + text-overflow ellipsis
    + font-size 14px
    + width 120px
    + span
    + font-size 70%`
    + }
    + get needsData() {
    + return false
    + }
    + get tileSize() {
    + return `480 420`
    + }
    + async fetchTableInputs() {
    + return { rows: this.getChoices() }
    + }
    + getTileBodyStumpCode() {
    + let lastCat = ""
    + return this.getChoices()
    + .map((choice) => {
    + choice.categoryBreak = lastCat !== choice.category ? this.qFormat(this.categoryBreakStumpTemplate, { category: choice.category }) : ""
    + lastCat = choice.category
    + return this.qFormat(this.itemStumpTemplate, choice)
    + })
    + .join("\n")
    + }
    + }
    +
    + class PickerTileNode extends abstractPickerTileNode {
    + getChoices() {
    + const allChoices = this.getRootNode().getHandGrammarProgram().getTopNodeTypeDefinitions()
    + const filteredChoices = allChoices.filter((nodeDef) => !(nodeDef.get(jtree.GrammarConstants.tags) || "").includes(OhayoConstants.noPicker))
    + const theChoices = filteredChoices.length ? filteredChoices : allChoices
    + return theChoices.map((nodeDefinition) => {
    + const nodeId = nodeDefinition.get("crux") || nodeDefinition.getNodeTypeIdFromDefinition()
    + const name = nodeId.split(".")[1] || ""
    + const category = lodash.upperFirst(nodeId.split(".")[0])
    + const description = nodeDefinition.getDescription()
    + return { name, category, description, value: nodeId, command: "changeTileTypeCommand" }
    + })
    + }
    + }
    +
    + class templatesListNode extends abstractPickerTileNode {
    + getChoices() {
    + // todo: cleanup.
    + const choices = this.getWebApp()
    + .getStandardTemplates()
    + .map((node) => {
    + const id = node.getWord(1).replace("templates/", "").replace(this.ohayoFileExtensionKey, "")
    + return {
    + command: "createProgramFromTemplateCommand",
    + name: node.get("data doc.title"),
    + value: id,
    + category: lodash.upperFirst(node.get("data doc.categories")),
    + description: "",
    + }
    + })
    + return lodash.sortBy(choices, "category")
    + }
    + getProgramTemplate(id) {
    + const node = this.getWebApp()
    + .getStandardTemplates()
    + .filter((node) => node.getContent() === `templates/${id}${this.ohayoFileExtensionKey}`)[0]
    + return {
    + template: node.getNode("data").childrenToString(),
    + name: id + this.ohayoFileExtensionKey,
    + }
    + }
    + }
    +
    + class asciiChartNode extends abstractChartNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { yColumn: yColumnNode }), undefined)
    + }
    + get titleCell() {
    + return this.getWordsFrom(0)
    + }
    + get bodyStumpTemplate() {
    + return `pre
    + class TileSelectable
    + style overflow: scroll; width: 100%; height: 100%; white-space: pre;
    + bern
    + {title}
    + {chart}`
    + }
    + get columnPredictionHints() {
    + return `yColumn isString=false`
    + }
    + get tileScript() {
    + return `ohayo/packages/asciichart/asciichart.js`
    + }
    + getTileBodyStumpCode() {
    + // todo: autodetect column
    + const columName = this.mapSettingNamesToColumnNames(["yColumn"])[0]
    + const column = this.getParentOrDummyTable().getColumnByName(columName)
    + const values = column.getValues()
    + const chart = asciichart.plot(values, { height: 15 })
    + const title = this.getContent() || ""
    + const leftPad = Math.max(0, Math.floor((chart.split("\n")[0].length - title.length) / 2))
    + return this.qFormat(this.bodyStumpTemplate, { title: " ".repeat(leftPad) + title, chart })
    + }
    + }
    +
    + class calendarHeatNode extends abstractChartNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + undefined,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { count: countNode, dayColumn: dayColumnNode }),
    + undefined
    + )
    + }
    + get hakonTemplate() {
    + return `.heatCal
    + rect
    + fill {darkerBackground}
    + shape-rendering crispedges
    + text
    + font-size 10px
    + fill #ddd`
    + }
    + get bodyStumpTemplate() {
    + return `div
    + class heatCal
    + bern
    + {svg}`
    + }
    + get dummyDataSetName() {
    + return `waterBill`
    + }
    + get columnPredictionHints() {
    + return `count getPrimitiveTypeName=number
    + dayColumn getPrimitiveTypeName=day`
    + }
    + get tileSize() {
    + return `750 200`
    + }
    + _getLegend(quins, squareSideWithPadding, position) {
    + const theme = this.getTheme()
    + const quinSvgs = quins
    + .map((quin, index) => {
    + const left = position.left + squareSideWithPadding * index
    + const style = "fill: " + theme.getHeatColor(1 - quin.percent)
    + return ``
    + })
    + .join("")
    + return `
    + Less
    + ${quinSvgs}
    + More
    + `
    + }
    + getTileBodyStumpCode() {
    + const svg = this._getSvg()
    + return this.qFormat(this.bodyStumpTemplate, { svg })
    + }
    + _getDayMap(quins, rows, dayColumnName, countColumnName) {
    + const getQuin = (val) => {
    + for (let index = 0; index < quins.length; index++) {
    + if (val <= quins[index].value) return quins[index].percent
    + }
    + }
    + const dayMap = {}
    + rows.forEach((row) => {
    + dayMapoment(row[dayColumnName]).format("MM/DD/YYYY")] = {
    + Quin: getQuin(row[countColumnName]),
    + count: row[countColumnName],
    + row: row,
    + }
    + })
    + return dayMap
    + }
    + _getDaysArray(startDay, daysToShow) {
    + const days = []
    + const firstDay = parseInt(startDay.format("e"))
    + for (let dayIndex = 0; dayIndex <= daysToShow; dayIndex++) {
    + const day = startDay.clone().add(dayIndex, "days")
    + days.push({
    + day: day,
    + row: parseInt(day.format("e")),
    + col: Math.floor((firstDay + dayIndex) / 7),
    + })
    + }
    + return days
    + }
    + _getDayNamesG(squareSideWithPadding) {
    + const dayNames = [
    + { day: "Mon", row: 2 },
    + { day: "Wed", row: 4 },
    + { day: "Fri", row: 6 },
    + ]
    + .map((day) => {
    + const _top = 20 + day.row * squareSideWithPadding - 3
    + return `${day.day}`
    + })
    + .join("")
    + return `${dayNames}`
    + }
    + _getMonthNamesG(daysArray, squareSideWithPadding) {
    + const _usedMonths = {}
    + const monthNames = daysArray
    + .map((day) => {
    + const monthName = day.day.format("MMM")
    + const monthYear = day.day.format("MM/YYYY")
    + if (_usedMonthsonthYear]) return ""
    + _usedMonthsonthYear] = true
    + const left = 40 + day.col * squareSideWithPadding
    + return `${monthName}`
    + })
    + .join("")
    + return `${monthNames}`
    + }
    + _getDataSquaresG(daysArray, squareSideWithPadding, dayMap) {
    + const dayFormat = "MM/DD/YYYY"
    + const today = moment(Date.now()).format(dayFormat)
    + const theme = this.getTheme()
    + const dataSquares = daysArray
    + .map((day) => {
    + const dayKey = day.day.format(dayFormat)
    + const _top = 20 + day.row * squareSideWithPadding
    + const left = 40 + day.col * squareSideWithPadding
    + const value = dayMap[dayKey]
    + const todayStyle = dayKey === today ? "stroke-width:2;stroke:rgb(0,0,0);" : ""
    + const style = (value ? "fill: " + theme.getHeatColor(1 - value.Quin) : "") + ";" + todayStyle
    + const title = `${dayKey}: ${value ? value.count : 0}`
    + return `${title}`
    + })
    + .join("")
    + return `${dataSquares}`
    + }
    + _getSvg() {
    + const inputTable = this.getParentOrDummyTable()
    + const rows = inputTable.getJavascriptNativeTypedValues()
    + if (!rows.length) return ""
    + const tileStruct = this.getSettingsStruct()
    + const dayColumnName = tileStruct.dayColumn
    + const countColumnName = tileStruct.count
    + if (!dayColumnName || !countColumnName) return ""
    + const dayCol = inputTable.getTableColumnByName(dayColumnName)
    + const countCol = inputTable.getTableColumnByName(countColumnName)
    + let daysToShow = 365 * 1 // todo: make configurable
    + let endDay = moment(Date.now())
    + let startDay = endDay.clone().subtract(daysToShow, "days")
    + // todo: make configurable
    + // reductions = dayCol.getReductions()
    + // startDay = moment(reductions.min)
    + // endDay = moment(reductions.max)
    + // daysToShow = endDay.diff(startDay, "days")
    + const squareSide = 10
    + const squarePadding = 2
    + const squareSideWithPadding = squareSide + squarePadding
    + const width = squareSideWithPadding * (daysToShow / 6)
    + const height = 7 * squareSideWithPadding + 100
    + const quins = countCol.getQuins()
    + const dayMap = this._getDayMap(quins, rows, dayColumnName, countColumnName)
    + const daysArray = this._getDaysArray(startDay, daysToShow)
    + const dayNamesG = this._getDayNamesG(squareSideWithPadding)
    + const monthNamesG = this._getMonthNamesG(daysArray, squareSideWithPadding)
    + const squaresG = this._getDataSquaresG(daysArray, squareSideWithPadding, dayMap)
    + const keyG = this._getLegend(quins, squareSideWithPadding, { top: 110, left: 60 })
    + return `${dayNamesG + squaresG + monthNamesG + keyG}`
    + }
    + }
    +
    + class challengePlayNode extends abstractChartNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get challengeIdCell() {
    + return parseInt(this.getWord(1))
    + }
    + get challengeAnswerCell() {
    + return this.getWordsFrom(2).map((val) => parseFloat(val))
    + }
    + get tileSize() {
    + return `640 240`
    + }
    + getProgramTemplate(id) {
    + const challengeNode = this._getChallengeNode(parseInt(id))
    + return {
    + template: challengeNode.getNode("solution").childrenToString(),
    + name: "challenge-" + id + "-solution.ohayo",
    + }
    + }
    + _getChallengeNode(challengeId) {
    + const challenges = typeof challengesTree === "undefined" ? jtree.TreeNode.fromDisk("ohayo/packages/challenge/challenges.tree") : new jtree.TreeNode(challengesTree)
    + return challenges.nodeAt(challengeId - 1) || challenges.nodeAt(0)
    + }
    + getTileBodyStumpCode() {
    + const challengeId = parseInt(this.getWord(1))
    + const answer = this.getWord(2)
    + const challengeNode = this._getChallengeNode(challengeId)
    + const isCorrect = answer === challengeNode.get("answer")
    + const theme = this.getTheme()
    + const color = answer ? (isCorrect ? theme.successColor : theme.errorColor) : theme.warningColor
    + const answerMessage = answer !== undefined ? (isCorrect ? "CORRECT!" : "Wrong.") : ""
    + return `h3 Challenge #${challengeId}
    + style color:${color}
    + br
    + div ${challengeNode.evalTemplateString(`Question: {question}`)}
    + class TileSelectable
    + br
    + input
    + placeholder Enter your answer here. All answers are a number.
    + value ${answer !== undefined ? answer : ""}
    + style width: 300px;
    + name 2
    + changeCommand changeWordAndRenderCommand
    + span ${answerMessage}
    + style color: ${color};
    + br
    + div
    + a See a solution
    + clickCommand createProgramFromTemplateCommand
    + value ${challengeId}`
    + }
    + }
    - @media print {
    - .CodeMirror div.CodeMirror-cursors {
    - visibility: hidden
    + class debugDumpNode extends abstractChartNode {
    + get bodyStumpTemplate() {
    + return `div
    + style overflow: scroll; width: 100%; height: 100%; white-space: pre;
    + bern
    + {text}`
    + }
    + _getCharacterLimit() {
    + // Todo: great example of a scale test. I found it to be slow with:
    + /*
    + vega.sample movies.json
    + web.dump
    + So some tiles will have characterLimit, rowDisplayLimit, et cetera. And have "speedTestExamples" .
    + */
    + return 20000
    + }
    + getTileBodyStumpCode() {
    + const text = this._getTextToDump()
    + const characterLimit = this._getCharacterLimit()
    + let sub = text.substr(0, characterLimit)
    + if (text.length > characterLimit)
    + // todo: Show standardized truncation warning
    + sub = `(Notice: Results truncated to ${characterLimit} characters)
    ` + sub
    + return this.qFormat(this.bodyStumpTemplate, { text: sub || "No data to dump" })
    + }
    + _getTextToDump() {
    + return this.getPipishInput()
    + }
    + }
    +
    + class webDumpNode extends debugDumpNode {
    + _getTextToDump() {
    + return this.getParent().getWillowHttpResponse ? this.getParent().getWillowHttpResponse().text : `${this.constructor.name} requires a parent web tile.`
    + }
    + }
    +
    + class debugCommandsNode extends abstractChartNode {
    + get bodyStumpTemplate() {
    + return `a Run Speed Test on all Templates
    + clickCommand _runTemplateSpeedTestCommand
    + br
    + a Open all Templates Command
    + clickCommand _openAllTemplatesCommand
    + br
    + a Run Tile Quality Check
    + clickCommand _doTileQualityCheckCommand`
    + }
    + getTileBodyStumpCode() {
    + return this.bodyStumpTemplate
    + }
    + _runTemplateSpeedTestCommand() {
    + return this.getWebApp()._runTemplateSpeedTestCommand()
    + }
    + _openAllTemplatesCommand() {
    + return this.getWebApp()._openAllTemplatesCommand()
    + }
    + _doTileQualityCheckCommand() {
    + return this.getWebApp()._doTileQualityCheckCommand()
    + }
    + }
    +
    + class debugSleepNode extends abstractChartNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get millisecondsCell() {
    + return parseInt(this.getWord(1))
    + }
    + get dummyDataSetIdCell() {
    + return this.getWord(2)
    + }
    + get dummyDataSetName() {
    + return `waterBill`
    + }
    + async fetchTableInputs() {
    + const ms = parseInt(this.getWord(1) || 1)
    + await this.getWebApp().sleepCommand(ms)
    + return { rows: jtree.Utils.javascriptTableWithHeaderRowToObjects(DummyDataSets[this.getWord(2) || "stockPrice"]) }
    + }
    + }
    +
    + class debugNoOpNode extends abstractChartNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get anyCell() {
    + return this.getWordsFrom(1)
    + }
    + get visible() {
    + return false
    + }
    + }
    +
    + class debugThrowNode extends abstractChartNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get tileEventNameCell() {
    + return this.getWord(1)
    + }
    + async fetchTableInputs() {
    + this._throwIfMethodNameIs("fetchTableInputs")
    + return {
    + rows: [],
    + }
    + }
    + _throwIfMethodNameIs(name) {
    + // Never throw if no word provided. That ensures it wont throw during testing.
    + const lookingFor = this.getContent()
    + if (lookingFor === name) throw new Error(`DebugTile threw an error on purpose on event: "${lookingFor}"`)
    + }
    + getTileBodyStumpCode() {
    + this._throwIfMethodNameIs("getTileBodyStumpCode")
    + }
    + treeComponentDidMount() {
    + this._throwIfMethodNameIs("treeComponentDidMount")
    + }
    + treeComponentDidUpdate() {
    + this._throwIfMethodNameIs("treeComponentDidUpdate")
    + }
    + }
    +
    + class dtjsBasicNode extends abstractChartNode {
    + get rowStumpTemplate() {
    + return `tr
    + {cols}`
    + }
    + get cellStumpTemplate() {
    + return `td
    + bern
    + {box}`
    + }
    + get bodyStumpTemplate() {
    + return `div
    + table
    + class DataTable
    + thead
    + tr
    + {headerRows}
    + tbody
    + {rows}`
    + }
    + get tileScript() {
    + return `ohayo/packages/dtjs/datatables.min.js`
    + }
    + get tileCssScript() {
    + return `ohayo/packages/dtjs/datatables.min.css`
    + }
    + get tileSize() {
    + return `1200 500`
    + }
    + getTileBodyStumpCode() {
    + const columnDefs = this.getParentOrDummyTable().getColumnsArray().slice(0, 10)
    + const headerRows = this._getHeaderRowsStumpCode(columnDefs.map((col) => col.getColumnName()))
    + const rows = this._getTableRowsStumpCode(columnDefs)
    + return this.qFormat(this.bodyStumpTemplate, { headerRows, rows })
    + }
    + _getHeaderRowsStumpCode(columns) {
    + return columns.map((colName) => `th ${colName}`).join("\n")
    + }
    + _getTableRowsStumpCode(columns) {
    + return this.getRowsWithRowDisplayLimit()
    + .slice(0, 10)
    + .map((row, index) => {
    + const cols = columns
    + .map((column) => {
    + const box = row.getRowHtmlSafeValue(column.getColumnName()) // todo: cache?
    + return this.qFormat(this.cellStumpTemplate, { box })
    + })
    + .join("\n")
    + return this.qFormat(this.cellStumpTemplate, { cols })
    + })
    + .join("\n")
    + }
    + treeComponentWillUnmount() {
    + // cleanup
    + }
    + treeComponentDidUpdate() {
    + super.treeComponentDidUpdate()
    + const table = this.getParentOrDummyTable()
    + const columnDefs = this.getParentOrDummyTable().getColumnsArray().slice(0, 10)
    + const container = this.getStumpNode().findStumpNodeByChild("class DataTable")
    + if (this.isNodeJs()) return undefined
    + const width = this.getTileRunTimeWidth()
    + const height = this.getTileRunTimeHeight()
    + const shadow = container.getShadow()
    + const el = shadow.getShadowElement()
    + shadow.setShadowCss({ width, height })
    + const rows = this.getRowsWithRowDisplayLimit()
    + // todo: note, this is only works with jQuery
    + jQuery.fn.dataTable.ext.errMode = "throw"
    + this._dataTables = jQuery(el).DataTable({
    + data: this.getRowsAsDataTableArrayWithHeader(
    + rows,
    + columnDefs.map((col) => col.getColumnName())
    + ).slice(1),
    + pageLength: 10,
    + scrollY: height,
    + //"scrollCollapse": true,
    + //"paging": false
    + })
    + }
    + treeComponentDidMount() {
    + this.treeComponentDidUpdate()
    + }
    + }
    +
    + class editorGalleryNode extends abstractChartNode {
    + get miniStyleTemplate() {
    + return `div`
    + }
    + get bodyStumpTemplate() {
    + return `div
    + class MiniMapTile
    + {minis}`
    + }
    + get miniStumpTemplate() {
    + return `a
    + class miniMap
    + {onClick}
    + {value}
    + {href}
    + div
    + class miniPreview
    + {theTiles}
    + div {filename}
    + class miniFooter`
    + }
    + get hakonTemplate() {
    + return `.MiniMapTile
    + .miniMap
    + background {backgroundColor}
    + width 120px
    + height 90px
    + margin 6px
    + position relative
    + overflow hidden
    + box-sizing border-box
    + display inline-block
    + &:hover
    + border 1px solid {boxShadow}
    + &:active
    + border 2px solid {boxShadow}
    + .miniFooter
    + font-size 12px
    + position absolute
    + bottom 0
    + width 100%
    + height 15px
    + line-height 15px
    + white-space nowrap
    + text-align center
    + .miniPreview
    + position absolute
    + width 100%
    + height calc(100% - 15px)
    + top 0
    + overflow hidden
    + div
    + background {linkColor}
    + height 5px
    + margin 1px`
    + }
    + get dummyDataSetName() {
    + return `ohayoPrograms`
    + }
    + get tileSize() {
    + return `1080 600`
    + }
    + async openFullPathInNewTabAndFocusCommand(url) {
    + return this.getTab().getRootNode().openFullPathInNewTabAndFocusCommand(url)
    + }
    + _getMiniStumpCode(sourceCode, filename, permalink, width = 120, height = 75) {
    + const ohayoProgram = new ohayoNode(sourceCode)
    + const theTiles = ohayoProgram
    + .getTiles()
    + .filter((tile) => tile.isVisible())
    + .map((tile) => this.qFormat(this.miniStyleTemplate, {}))
    + .join("\n")
    + const onClick = permalink ? "clickCommand openFullPathInNewTabAndFocusCommand" : ""
    + const value = permalink ? `value ${permalink}` : ""
    + const href = permalink ? `href ${permalink}` : ""
    + return this.qFormat(this.miniStumpTemplate, { filename, theTiles, onClick, value, href })
    + }
    + getTileBodyStumpCode() {
    + // todo: cache.
    + const minis = this.getRowsWithRowDisplayLimit()
    + .map((row) => this._getMiniStumpCode(row.getRowOriginalValue("bytes"), row.getRowOriginalValue("filename"), row.getRowOriginalValue("link")))
    + .join("\n")
    + return this.qFormat(this.bodyStumpTemplate, { minis })
    + }
    + }
    +
    + class handsontableBasicNode extends abstractChartNode {
    + get bodyStumpTemplate() {
    + return `div
    + class hot`
    + }
    + get hakonTemplate() {
    + return `.hot
    + color black`
    + }
    + get tileScript() {
    + return `ohayo/packages/handsontable/handsontable.full.min.js`
    + }
    + get tileCssScript() {
    + return `ohayo/packages/handsontable/handsontable.min.css`
    + }
    + get tileSize() {
    + return `1200 500`
    + }
    + getTileBodyStumpCode() {
    + return this.bodyStumpTemplate
    + }
    + // todo: allow editing
    + treeComponentWillUnmount() {
    + if (this._hot) this._hot.destroy()
    + delete this._hot
    + }
    + treeComponentDidUpdate() {
    + super.treeComponentDidUpdate()
    + const table = this.getParentOrDummyTable()
    + const columnDefs = table.getColumnsByImportance()
    + const colNames = columnDefs.map((col) => col.getColumnName())
    + const rows = this.getRowsWithRowDisplayLimit()
    + const data = this.getRowsAsDataTableArrayWithHeader(rows, colNames)
    + const container = this.getStumpNode().findStumpNodeByChild("class hot")
    + const app = this.getWebApp()
    + if (this.isNodeJs()) return undefined
    + const width = this.getTileRunTimeWidth()
    + const height = this.getTileRunTimeHeight()
    + this._hot = new Handsontable(container.getShadow().getShadowElement(), {
    + data: data,
    + rowHeaders: true,
    + colHeaders: true,
    + stretchH: "all",
    + width,
    + minSpareCols: 10,
    + minSpareRows: 30,
    + afterSelection: () => app.pauseShortcutListener(),
    + afterDeselect: () => app.startShortcutListener(),
    + height,
    + })
    + return this._hot
    + }
    + treeComponentDidMount() {
    + this.treeComponentDidUpdate()
    + }
    + }
    +
    + class abstractHtmlNode extends abstractChartNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + undefined,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { style: styleNode, content: contentNode }),
    + undefined
    + )
    + }
    + get htmlCell() {
    + return this.getWordsFrom(0)
    + }
    + get bodyStumpTemplate() {
    + return `{tag}
    + {style}
    + {src}
    + bern
    + {content}`
    + }
    + get hakonTemplate() {
    + return `.abstractHtmlNode
    + code
    + user-select text`
    + }
    + getTileFooterStumpCode() {
    + return this.getTileMenuButtonStumpCode()
    + }
    + async fetchTableInputs() {
    + return { rows: [{ text: this.getHtmlContent() }] }
    + }
    + getHtmlContent() {
    + return this.getWordsFrom(2).join(" ") || "No html content to show."
    + }
    + getTag() {
    + return this.getWord(1) || "div" // todo: verify this is legal tag.
    + }
    + getSrc() {
    + return this.getSettingsStruct().src
    + }
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, {
    + tag: this.getTag(),
    + style: this.style ? `style ${this.style}` : "",
    + src: this.getSrc() ? `src ${this.getSrc()}` : "",
    + content: this.getHtmlContent() || "",
    + })
    + }
    + }
    +
    + class htmlTextNode extends abstractHtmlNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get htmlTextTagCell() {
    + return this.getWord(1)
    + }
    + get htmlCell() {
    + return this.getWordsFrom(2)
    + }
    + }
    +
    + class htmlPrintAsNode extends abstractHtmlNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get htmlTextTagCell() {
    + return this.getWord(1)
    + }
    + getHtmlContent() {
    + return this.getPipishInput()
    + }
    + }
    +
    + class abstractHTMLFixedTagTileNode extends abstractHtmlNode {
    + getHtmlContent() {
    + return this.getContent()
    + }
    + getTag() {
    + return this.htmlTagName
    + }
    + }
    +
    + class htmlH1Node extends abstractHTMLFixedTagTileNode {
    + get htmlCell() {
    + return this.getWordsFrom(0)
    + }
    + get style() {
    + return `text-align:center;`
    + }
    + get htmlTagName() {
    + return `h1`
    + }
    + get tileSize() {
    + return `600 75`
    + }
    + }
    +
    + class abstractHTMLContentIsSrcTileNode extends abstractHTMLFixedTagTileNode {
    + getHtmlContent() {
    + return ""
    + }
    + getSrc() {
    + return this.getContent() || super.getSrc()
    + }
    + }
    +
    + class htmlImgNode extends abstractHTMLContentIsSrcTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get urlCell() {
    + return this.getWord(1)
    + }
    + get style() {
    + return `width:100%;`
    + }
    + get htmlTagName() {
    + return `img`
    + }
    + }
    +
    + class htmlIframeNode extends abstractHTMLContentIsSrcTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get urlCell() {
    + return this.getWord(1)
    + }
    + get htmlTagName() {
    + return `iframe`
    + }
    + }
    +
    + class htmlCustomNode extends abstractChartNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { content: contentNode }), undefined)
    + }
    + get bodyStumpTemplate() {
    + return `div
    + bern
    + {content}`
    + }
    + getTileBodyStumpCode() {
    + // https://meta.stackexchange.com/questions/1777/what-html-tags-are-allowed-on-stack-exchange-sites
    + // todo: sanitize tags
    + const contentNode = this.getNode("content")
    + const content = contentNode ? contentNode.childrenToString() : "No HTML content to show"
    + return this.qFormat(this.bodyStumpTemplate, { content })
    + }
    + }
    +
    + class iconsIconNode extends abstractChartNode {}
    +
    + class iconsHumanNode extends iconsIconNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + undefined,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { genderColumn: genderColumnNode, headSize: headSizeNode }),
    + undefined
    + )
    + }
    + get dummyDataSetName() {
    + return `patients`
    + }
    + get bodyStumpTemplate() {
    + return `div
    + bern
    + {bern}`
    + }
    + get columnPredictionHints() {
    + return `headSize isString=false
    + genderColumn isString=true`
    + }
    + getTileBodyStumpCode() {
    + // Now, what if there is no input table?
    + const table = this.getParentOrDummyTable()
    + const rows = table.getRows()
    + // Now, what if we are using dummy input table?
    + const headSizeColumn = this.getSettingsStruct().headSize
    + const genderColumn = this.getSettingsStruct().genderColumn
    + const reducts = table.getColumnByName(headSizeColumn).getReductions()
    + const headColMax = reducts.max
    + const bern = rows
    + .map((row) => {
    + const typedRow = row.rowToObjectWithOnlyNativeJavascriptTypes()
    + const value = typedRow[headSizeColumn]
    + // TODO: ADD TYPINGS
    + const genderVal = typedRow[genderColumn].toLowerCase()
    + const gender = genderVal === "male" ? "blue" : "pink"
    + let character = "O"
    + let percent = value / headColMax
    + if (isNaN(value)) {
    + character = "x"
    + percent = reducts.median / headColMax
    + }
    + const title = row.getHoverTitle()
    + percent = Math.round(18 * percent)
    + return `${character}`
    + })
    + .join(" ")
    + return this.qFormat(this.bodyStumpTemplate, { bern: bern })
    + }
    + }
    +
    + class iconsCircleNode extends iconsIconNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { radius: radiusNode }), undefined)
    + }
    + get bodyStumpTemplate() {
    + return `div
    + bern
    + {bern}`
    + }
    + get dummyDataSetName() {
    + return `playerGoals`
    + }
    + get columnPredictionHints() {
    + return `radius isString=false`
    + }
    + getTileBodyStumpCode() {
    + const column = this.getSettingsStruct().radius
    + const bern = this.getParentOrDummyTable()
    + .getRows()
    + .map((row) => `O`)
    + .join(" ")
    + return this.qFormat(this.bodyStumpTemplate, { bern: bern })
    + }
    + }
    +
    + class listBasicNode extends abstractChartNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { label: labelNode }), undefined)
    + }
    + get columnNameCell() {
    + return this.getWordsFrom(0)
    + }
    + get columnPredictionHints() {
    + return `label getTitlePotential`
    + }
    + get dummyDataSetName() {
    + return `telescopes`
    + }
    + get tileSize() {
    + return `400 400`
    + }
    + get listItemStumpTemplate() {
    + return `li
    + span {label}`
    + }
    + get bodyStumpTemplate() {
    + return `ol
    + {items}`
    + }
    + _getListItem(label) {
    + return this.qFormat(this.listItemStumpTemplate, { label })
    + }
    + _getLabelColumnName() {
    + // todo: more automatic! Need to fix our columns/keywords issues
    + return this.getWord(1) || this.getSettingsStruct().label
    + }
    + getTileBodyStumpCode() {
    + const labelColumnName = this._getLabelColumnName()
    + const items = this.getRowsWithRowDisplayLimit()
    + .map((row) => this._getListItem(jtree.Utils.stripHtml(row.getRowOriginalValue(labelColumnName)), row))
    + .join("\n")
    + return this.qFormat(this.bodyStumpTemplate, { items })
    + }
    + }
    +
    + class listLinksNode extends listBasicNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + undefined,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { label: labelNode, link: linkNode }),
    + undefined
    + )
    + }
    + get columnNameCell() {
    + return this.getWordsFrom(0)
    + }
    + get columnPredictionHints() {
    + return `label getTitlePotential
    + link isLink`
    + }
    + get listItemHakonTemplate() {
    + return `li
    + a {label}
    + href {link}`
    + }
    + get dummyDataSetName() {
    + return `telescopes`
    + }
    + _getUrlColumnName() {
    + // todo: more automatic! Need to fix our columns/keywords issues
    + return this.getWord(2) || this.getSettingsStruct().link
    + }
    + _getListItem(label, row) {
    + const urlColumnName = this._getUrlColumnName()
    + if (!urlColumnName) return super._getListItem(label, row)
    + return this.qFormat(this.listItemHakonTemplate, { label, link: jtree.Utils.stripHtml(row.getRowOriginalValue(urlColumnName)) })
    + }
    + }
    +
    + class markdownToHtmlNode extends abstractChartNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { content: contentNode }), undefined)
    + }
    + get dummyDataSetName() {
    + return `markdown`
    + }
    + get tileSize() {
    + return `400 400`
    + }
    + get bodyStumpTemplate() {
    + return `div
    + class TileSelectable
    + bern
    + {md}`
    + }
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, { md: marked(this.getPipishInput()) })
    + }
    + }
    +
    + class abstractRoughJsChartNode extends abstractChartNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { roughness: roughnessNode }), undefined)
    + }
    + get titleCell() {
    + return this.getWordsFrom(0)
    + }
    + get bodyStumpTemplate() {
    + return `div
    + id {id}`
    + }
    + get tileScript() {
    + return `ohayo/packages/roughjs/roughviz.min.js`
    + }
    + _getRoughId() {
    + return `rough${this._getUid()}`
    + }
    + treeComponentDidUpdate() {
    + super.treeComponentDidUpdate()
    + if (this.isNodeJs()) return undefined
    + this._drawRough()
    + }
    + treeComponentDidMount() {
    + this.treeComponentDidUpdate()
    + }
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, { id: this._getRoughId() })
    + }
    + get _roughness() {
    + const value = this.get("roughness")
    + return value ? parseInt(value) : 1
    + }
    + _getOptions() {
    + return {}
    + }
    + _drawRough() {
    + const colors = this.get("colors") ? this.get("colors").split(" ") : undefined
    + const options = Object.assign(this._getOptions(), {
    + title: this.getContent() || "",
    + element: "#" + this._getRoughId(),
    + roughness: this._roughness,
    + width: this.getTileRunTimeWidth(),
    + height: this.getTileRunTimeHeight(),
    + colors,
    + data: this._getRoughData(),
    + })
    + const roughEl = new roughViz[this.roughChartType](options)
    + }
    + _getValues(settingName) {
    + const columName = this.mapSettingNamesToColumnNames([settingName])[0]
    + return this.getParentOrDummyTable().getColumnByName(columName).getValues()
    + }
    + }
    +
    + class abstractRoughJsLabelValueNode extends abstractRoughJsChartNode {
    + get columnPredictionHints() {
    + return `value getPrimitiveTypeName=number`
    + }
    + get dummyDataSetName() {
    + return `stockPrice`
    + }
    + _getRoughData() {
    + const data = { labels: this._getValues("label"), values: this._getValues("value") }
    + console.log(data)
    + return data
    + }
    + }
    +
    + class roughJsBarNode extends abstractRoughJsLabelValueNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + undefined,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { label: labelNode, value: valueNode }),
    + undefined
    + )
    + }
    + get roughChartType() {
    + return `Bar`
    + }
    + }
    +
    + class roughJsPieNode extends abstractRoughJsLabelValueNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + undefined,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { label: labelNode, value: valueNode }),
    + undefined
    + )
    + }
    + get roughChartType() {
    + return `Pie`
    + }
    + }
    +
    + class roughJsLineNode extends abstractRoughJsChartNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { colors: colorsNode }), undefined)
    + }
    + get roughChartType() {
    + return `Line`
    + }
    + _getNumericColumns() {
    + return Object.values(this.getParentOrDummyTable().getColumnsMap()).filter((col) => col.isNumeric())
    + }
    + _getRoughData() {
    + const data = {}
    + const numerics = this._getNumericColumns()
    + numerics.forEach((col) => {
    + data[col.getColumnName()] = col.getValues()
    + })
    + return data
    + }
    + _getOptions() {
    + const options = {}
    + const numerics = this._getNumericColumns()
    + numerics.forEach((col, index) => {
    + options["y" + index] = col.getColumnName()
    + })
    + return options
    + }
    + }
    +
    + class abstractShowTileNode extends abstractChartNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + get titleCell() {
    + return this.getWordsFrom(2)
    + }
    + get bodyStumpTemplate() {
    + return `h6 {title}
    + h3 {number}`
    + }
    + get hakonTemplate() {
    + return `.abstractShowTileNode
    + h3
    + text-align center
    + h6
    + text-align center
    + height 40px
    + overflow hidden`
    + }
    + get dummyDataSetName() {
    + return `stockPrice`
    + }
    + get tileSize() {
    + return `140 120`
    + }
    + getTileBodyStumpCode() {
    + const columnName = this.getWord(1)
    + if (!columnName) return `No data for ${this.getFirstWord()}`
    + const table = this.getParentOrDummyTable()
    + const col = table.getTableColumnByName(columnName)
    + if (!col) {
    + console.log(`No column named ${columnName}`)
    + return ""
    + }
    + const reductionName = this.reductionName || this.getWord(0).split(".")[1]
    + const title = this.getWordsFrom(2).join(" ") || [columnName, reductionName].join(" ")
    + const number = this.toDisplayString(col.getReductions()[reductionName], columnName)
    + return this.qFormat(this.bodyStumpTemplate, { title, number })
    + }
    + }
    +
    + class showRowCountNode extends abstractShowTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get titleCell() {
    + return this.getWordsFrom(1)
    + }
    + get defaultTitle() {
    + return `Total rows`
    + }
    + get dummyDataSetName() {
    + return `stockPrice`
    + }
    + get tileSize() {
    + return `140 120`
    + }
    + getTileBodyStumpCode() {
    + const title = this.getWordsFrom(1).join(" ") || this.defaultTitle
    + return this.qFormat(this.bodyStumpTemplate, { title, number: this._getNumber() })
    + }
    + _getNumber() {
    + return this.getParentOrDummyTable().getRowCount()
    + }
    + }
    +
    + class showColumnCountNode extends showRowCountNode {
    + get defaultTitle() {
    + return `Total columns`
    + }
    + _getNumber() {
    + return this.getParentOrDummyTable().getColumnNames().length
    + }
    + }
    +
    + class showStaticNode extends abstractShowTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get numberCell() {
    + return parseFloat(this.getWord(1))
    + }
    + get titleCell() {
    + return this.getWordsFrom(2)
    + }
    + getTileBodyStumpCode() {
    + const title = this.getWordsFrom(2).join(" ")
    + return this.qFormat(this.bodyStumpTemplate, { title, number: this.getWord(1) || "" })
    + }
    + }
    +
    + class showValueNode extends abstractShowTileNode {
    + get reductionName() {
    + return `median`
    + }
    + }
    +
    + class showMedianNode extends abstractShowTileNode {}
    +
    + class showSumNode extends abstractShowTileNode {}
    +
    + class showMeanNode extends abstractShowTileNode {}
    +
    + class showMinNode extends abstractShowTileNode {}
    +
    + class showMaxNode extends abstractShowTileNode {}
    +
    + class tablesBasicNode extends abstractChartNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { columnLimit: columnLimitNode }), undefined)
    + }
    + get bodyStumpTemplate() {
    + return `div
    + class tablesBasicNode
    + table
    + thead
    + {headerRows}
    + tbody
    + {bodyRows}`
    + }
    + get headerRowStumpTemplate() {
    + return `th
    + value {colName}
    + span {colName}
    + value {colName}`
    + }
    + get rowStumpTemplate() {
    + return `tr
    + class tableRow
    + value {value}
    + td {number}
    + {cols}`
    + }
    + get cellLinkStumpTemplate() {
    + return `td
    + a
    + href {content}
    + bern
    + {content}`
    + }
    + get cellStumpTemplate() {
    + return `td
    + bern
    + {content}`
    + }
    + get hakonTemplate() {
    + return `.tablesBasicNode
    + font-size 14px
    + box-sizing border-box
    + {enableTextSelect1}
    + table
    + width 100%
    + tr
    + white-space nowrap
    + padding 0
    + td
    + border 1px solid {lineColor}
    + tr:nth-child(even)
    + background-color {veryLightGrey}
    + td,th
    + padding 2px 3px
    + text-align left
    + overflow hidden
    + text-overflow ellipsis
    + max-width 250px
    + td:hover,th:hover
    + overflow visible
    + td:first-child,th:first-child
    + padding-left 5px
    + color {greyish}
    + width 60px
    + th
    + cursor pointer
    + background-color {lightGrey}
    + border 1px solid {lineColor}
    + border-bottom-color {greyish}`
    + }
    + get customBodyStyle() {
    + return `padding:0px;`
    + }
    + get tileSize() {
    + return `750 300`
    + }
    + get columnLimit() {
    + return 20
    + }
    + get rowDisplayLimit() {
    + return 100
    + }
    + _getTableRowsStumpCode(columns) {
    + return this.getRowsWithRowDisplayLimit()
    + .map((row, index) => {
    + const cols = columns
    + .map((column) => {
    + return this.qFormat(column.isLink() ? this.cellLinkStumpTemplate : this.cellStumpTemplate, {
    + content: row.getRowHtmlSafeValue(column.getColumnName()),
    + })
    + })
    + .join("\n")
    + return this.qFormat(this.rowStumpTemplate, { number: index + 1, value: row.getPuid(), cols })
    + })
    + .join("\n")
    + }
    + _getHeaderRowsStumpCode(columns) {
    + // todo: can we get a copy column command?
    + return ["Row"]
    + .concat(columns)
    + .map((colName) => this.qFormat(this.headerRowStumpTemplate, { colName }))
    + .join("\n")
    + }
    + getTileBodyStumpCode() {
    + const tileStruct = this.getSettingsStruct()
    + const table = this.getParentOrDummyTable()
    + if (table.isBlankTable()) return `div No data to show`
    + let columnDefs = tileStruct.columnOrder === "importance" ? table.getColumnsByImportance() : table.getColumnsArray()
    + columnDefs = columnDefs.slice(0, tileStruct.columnLimit || this.columnLimit)
    + const columnNames = columnDefs.map((col) => col.getColumnName())
    + // todo: if the types for a column are all equal, add a total row to the bottom.
    + // todo: if the types for a row are all equal, add a total column to the right.
    + const headerRows = this._getHeaderRowsStumpCode(columnNames)
    + const bodyRows = this._getTableRowsStumpCode(columnDefs)
    + return this.qFormat(this.bodyStumpTemplate, { headerRows, bodyRows })
    + }
    + }
    +
    + class tablesInterestingNode extends tablesBasicNode {
    + get columnOrder() {
    + return `importance`
    + }
    + }
    +
    + class tablesDumpNode extends tablesBasicNode {
    + get columnOrder() {
    + return `default`
    + }
    + }
    +
    + class textWordcloudNode extends abstractChartNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + undefined,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { column: columnNode, count: countNode }),
    + undefined
    + )
    + }
    + get columnPredictionHints() {
    + return `name isString=true
    + count isString=false`
    + }
    + get dummyDataSetName() {
    + return `wordCounts`
    + }
    + get tileScript() {
    + return `ohayo/packages/text/wordcloud2.min.js`
    + }
    + get bodyStumpTemplate() {
    + return `div
    + class divWhereWordCloudWillGo
    + style height: 300px;`
    + }
    + getTileBodyStumpCode() {
    + return this.bodyStumpTemplate
    + }
    + _getAllWords() {
    + return this.getRequiredTableWithHeader(["name", "count"])
    + }
    + treeComponentDidUpdate() {
    + this._draw()
    + }
    + treeComponentDidMount() {
    + this._draw()
    + }
    + _draw() {
    + if (this.isNodeJs()) return undefined
    + const tileStruct = this.getSettingsStruct()
    + const words = this._getAllWords()
    + if (!words.length) return
    + words.shift() // drop header
    + const shadow = this.getStumpNode().getShadow()
    + const width = shadow.getShadowOuterWidth()
    + const powConstant = 10 / Math.log(words.length) // breaks if too hgih.
    + const options = {
    + list: words.map((word) => [word[0], word[1]]),
    + shuffle: false,
    + gridSize: Math.round((16 * width) / 1024),
    + weightFactor: (size) => (Math.pow(size, powConstant) * width) / 1024,
    + backgroundColor: "transparent",
    + random: jtree.Utils.makeSemiRandomFn(),
    + wait: 0,
    + }
    + Object.assign(options, tileStruct)
    + const element = this.getStumpNode().findStumpNodeByChild("class divWhereWordCloudWillGo").getShadow().getShadowElement()
    + WordCloud(element, options)
    + }
    + }
    +
    + class treenotation3dNode extends abstractChartNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + undefined,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    + size: sizeNode,
    + cameraPosition: cameraPositionNode,
    + content: contentNode,
    + }),
    + undefined
    + )
    + }
    + get dummyDataSetName() {
    + return `treeProgram`
    + }
    + get tileScript() {
    + return `ohayo/packages/treenotation/vis.min.js`
    + }
    + get tileSize() {
    + return `800 500`
    + }
    + getTileBodyStumpCode() {
    + return `div
    + class visjs`
    + }
    + treeComponentDidMount() {
    + super.treeComponentDidMount()
    + this.treeComponentDidUpdate()
    + }
    + // Called when the Visualization API is loaded.
    + treeComponentDidUpdate() {
    + super.treeComponentDidUpdate()
    + if (this.isNodeJs()) return undefined
    + try {
    + this._tryVis()
    + } catch (err) {
    + // log error
    + console.error(err)
    + }
    + }
    + _tryVis() {
    + const tileStruct = this.getSettingsStruct()
    + const source = this.getPipishInput()
    + const app = this.getWebApp()
    + const program = new ohayoNode(source)
    + const rows = this._treeTo3D(program)
    + // Create and populate a data table.
    + const data = new vis.DataSet()
    + rows.forEach((row) => data.add(row))
    + const dotSize = tileStruct.size
    + const showGrid = tileStruct.showGrid
    + // specify options
    + // docs: http://visjs.org/docs/graph3d/
    + const cameraPositionNode = this.getNode("cameraPosition") || new jtree.TreeNode("cameraPosition 4 .1 1.5").getNode("cameraPosition")
    + const distance = parseFloat(cameraPositionNode.getWord(1))
    + const horizontal = parseFloat(cameraPositionNode.getWord(2))
    + const vertical = parseFloat(cameraPositionNode.getWord(3))
    + const options = {
    + width: this.getTileRunTimeWidth() + "px",
    + height: this.getTileRunTimeHeight() - 80 + "px",
    + style: "dot-color", // dot?
    + showPerspective: false,
    + showLegend: false,
    + showShadow: false,
    + keepAspectRatio: true,
    + xStep: 1,
    + yStep: 1,
    + zStep: 1,
    + zMax: 5,
    + showGrid: true,
    + showZAxis: false,
    + showXAxis: false,
    + showYAxis: false,
    + dotSizeRatio: dotSize,
    + dotSizeMinFraction: 1,
    + cameraPosition: {
    + distance: distance,
    + horizontal: horizontal,
    + vertical: vertical,
    + },
    + verticalRatio: 1.0,
    + // parameter point contains properties x, y, z, and data
    + // data is the original object passed to the point constructor
    + tooltip: (point) => point.data.line,
    + }
    + // create a graph3d
    + const element = this.getStumpNode().findStumpNodeByChild("class visjs").getShadow().getShadowElement()
    + this._graph3d = new vis.Graph3d(element, data, options)
    + const throttled = lodash.throttle((evt) => this._onCameraPositionChange(evt), 100)
    + this._graph3d.on("cameraPositionChange", throttled)
    + }
    + async _onCameraPositionChange(evt) {
    + // todo: throttle
    + const pos = this._graph3d.getCameraPosition()
    + const str = `${pos.distance} ${pos.horizontal} ${pos.vertical}`
    + this.touchNode("cameraPosition").setContent(str)
    + await this.getTab().autosaveTab()
    + }
    + _treeTo3D(program) {
    + // getCameraPosition
    + // setCameraPosition
    + // onCameraPositionChange
    + const theme = this.getWebApp().getTheme()
    + // todo: use node type for color.
    + const tagMap = {}
    + const tagTree = new jtree.TreeNode(program.toCellTypeTree())
    + // const outlineFn = node => node.getIndex()
    + // use language to get dict, use dict to get type overlay to get tag types.
    + const randomFn = jtree.Utils.makeSemiRandomFn()
    + const makeColor = (word) => {
    + if (!tagMap[word]) tagMap[word] = randomFn() // todo: give word types certain colors. green for keword, red for error, etc
    + const color = tagMap[word]
    + //console.log(color)
    + return color
    + }
    + const points = []
    + const nodeToPoint = (node, index) => {
    + const nodePath = node.getPathVector(program)
    + const tagNode = tagTree.nodeAt(nodePath)
    + node.getWords().forEach((word, wordIndex) => {
    + const wordType = tagNode.getWord(wordIndex)
    + const colorNumber = makeColor(wordType)
    + const xcc = node.getIndentLevel(program) + wordIndex
    + const ycc = -node.getLineNumber()
    + const zcc = 0
    + points.push({
    + x: xcc,
    + y: ycc,
    + z: zcc,
    + line: `cellType: ${wordType} | word: ${word}`,
    + style: colorNumber,
    + })
    + })
    + }
    + program.getTopDownArray().forEach(nodeToPoint)
    + return points
    + }
    + }
    +
    + class treenotationOutlineNode extends abstractChartNode {
    + get bodyStumpTemplate() {
    + return `pre
    + style overflow: scroll; width: 100%; height: 100%; margin: 0; box-sizing: border-box; font-family: monospace; line-height: 13px;
    + bern
    + {bern}`
    + }
    + get tileSize() {
    + return `800 500`
    + }
    + get dummyDataSetName() {
    + return `outerSpace`
    + }
    + _getTheBern() {
    + return new jtree.TreeNode(this.getPipishInput()).toOutline()
    + }
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, { bern: this._getTheBern() })
    + }
    + }
    +
    + class treenotationDotlineNode extends treenotationOutlineNode {
    + get dummyDataSetName() {
    + return `outerSpace`
    + }
    + get dots() {
    + return true
    + }
    + _getTheBern() {
    + return new jtree.TreeNode(this.getPipishInput()).toMappedOutline(
    + (node) =>
    + "o" +
    + node
    + .getLine()
    + .split(" ")
    + .map((word) => "º")
    + .join("")
    + )
    + }
    + }
    +
    + class abstractVegaNode extends abstractChartNode {
    + get titleCell() {
    + return this.getWordsFrom(0)
    + }
    + get bodyStumpTemplate() {
    + return `div
    + class divForExternalLibrary`
    + }
    + get markName() {
    + return `bar`
    + }
    + get dummyDataSetName() {
    + return `stockPrice`
    + }
    + get tileScript() {
    + return `ohayo/packages/vega/vega.combined.min.js`
    + }
    + get tileSize() {
    + return `800 300`
    + }
    + // todo: I don't think vega handles . in column names.
    + getTileBodyStumpCode() {
    + return this.bodyStumpTemplate
    + }
    + _getColumnToField(columnName) {
    + if (!columnName) return undefined
    + const columnsMap = this.getParentOrDummyTable().getColumnsMap()
    + const col = columnsMap[columnName]
    + const obj = { field: columnName, type: col.getVegaType() }
    + if (col.isTemporal()) {
    + const timeUnit = col.getVegaTimeUnit()
    + if (timeUnit) obj.timeUnit = timeUnit
    + }
    + return obj
    + }
    + _getElementForVega() {
    + return this.getStumpNode().findStumpNodeByChild("class divForExternalLibrary").getShadow().getShadowElement()
    + }
    + async _drawVega() {
    + // todo: don't rerun this if we dont need to.
    + await vegaEmbed(this._getElementForVega(), this._getVegaSpec())
    + }
    + treeComponentDidUpdate() {
    + super.treeComponentDidUpdate()
    + if (this.isNodeJs()) return undefined
    + this._drawVega()
    + }
    + treeComponentDidMount() {
    + this.treeComponentDidUpdate()
    + }
    + _getVegaData() {
    + return {
    + values: this.getParentOrDummyTable().cloneNativeJavascriptTypedRows().slice(0, this._getRowDisplayLimit()),
    + }
    + }
    + _getVegaTitle() {
    + return this.getContent()
    + }
    + _getVegaSpec() {
    + return {
    + description: "A simple bar chart with embedded data.",
    + data: this._getVegaData(),
    + width: this.getTileRunTimeWidth(),
    + height: this.getTileRunTimeHeight(),
    + mark: this._getVegaMarkObj(),
    + encoding: this._getEncodingMap(),
    + transform: this._getVegaTransform(),
    + title: this._getVegaTitle(),
    + config: this._getVegaConfig(),
    + }
    + }
    + _getVegaTransform() {
    + return undefined
    + }
    + _getVegaConfig() {
    + return undefined
    + }
    + _getEncodingMap() {
    + return {}
    + }
    + // todo: add type
    + _getVegaMarkObj() {
    + return { type: this._getVegaMark(), tooltip: { content: "data" } }
    + }
    + _getVegaMark() {
    + return this.markName
    + }
    + }
    +
    + class vegaBarNode extends abstractVegaNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + undefined,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    + colorColumn: colorColumnNode,
    + shapeColumn: shapeColumnNode,
    + xColumn: xColumnNode,
    + yColumn: yColumnNode,
    + }),
    + undefined
    + )
    + }
    + get columnPredictionHints() {
    + return `xColumn
    + yColumn isString=false,!xColumn`
    + }
    + _getEncodingMap() {
    + const columnNames = this.mapSettingNamesToColumnNames([this.xColumnKey, this.yColumnKey, this.colorColumnKey])
    + return {
    + x: this._getColumnToField(columnNames[0]),
    + y: this._getColumnToField(columnNames[1]),
    + color: this._getColumnToField(columnNames[2]),
    + }
    + }
    + }
    +
    + class vegaLineNode extends vegaBarNode {
    + get markName() {
    + return `line`
    + }
    + }
    +
    + class vegaAreaNode extends vegaLineNode {
    + get markName() {
    + return `area`
    + }
    + }
    +
    + class vegaScatterNode extends vegaBarNode {
    + get markName() {
    + return `point`
    + }
    + _getEncodingMap() {
    + const columnNames = this.mapSettingNamesToColumnNames([this.xColumnKey, this.yColumnKey, this.colorColumnKey, this.shapeColumnKey])
    + return {
    + x: this._getColumnToField(columnNames[0]),
    + y: this._getColumnToField(columnNames[1]),
    + color: this._getColumnToField(columnNames[2]),
    + shape: this._getColumnToField(columnNames[3]),
    + }
    + }
    + }
    +
    + class vegaBubbleNode extends vegaScatterNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + undefined,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { sizeColumn: sizeColumnNode, colorColumn: colorColumnNode }),
    + undefined
    + )
    + }
    + get columnPredictionHints() {
    + return `sizeColumn isString=false
    + xColumn isString=false`
    + }
    + get dummyDataSetName() {
    + return `gapMinder`
    + }
    + get markName() {
    + return `circle`
    + }
    + _getEncodingMap() {
    + const columnNames = this.mapSettingNamesToColumnNames([this.xColumnKey, this.yColumnKey, this.sizeColumnKey, this.colorColumnKey])
    + return {
    + y: {
    + field: columnNames[1],
    + type: "quantitative",
    + scale: { zero: false },
    + axis: { minExtent: 30 },
    + },
    + x: this._getColumnToField(columnNames[0]),
    + size: { field: columnNames[2], type: "quantitative" },
    + color: { value: "#000" },
    + }
    + }
    + }
    +
    + class vegaEmojiNode extends vegaBarNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + undefined,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { yColumn: yColumnNode, emojiColumn: emojiColumnNode }),
    + undefined
    + )
    + }
    + get dummyDataSetName() {
    + return `emojis`
    + }
    + get columnPredictionHints() {
    + return `emojiColumn isString=true
    + yColumn isString=false`
    + }
    + _getVegaConfig() {
    + return { view: { stroke: "" } }
    + }
    + _getVegaMark() {
    + return { type: "text", baseline: "middle" }
    + }
    + _getEncodingMap() {
    + const columnNames = this.mapSettingNamesToColumnNames([this.yColumnKey, "emoji"])
    + return {
    + x: { field: columnNames[1], type: "nominal", axis: null },
    + y: { field: columnNames[0], type: "quantitative", axis: null, sort: null },
    + text: { field: columnNames[1], type: "nominal" },
    + size: { value: 65 },
    + }
    + }
    + }
    +
    + class vegaHistogramNode extends abstractVegaNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { xColumn: xColumnNode }), undefined)
    + }
    + get dummyDataSetName() {
    + return `wordCounts`
    + }
    + get columnPredictionHints() {
    + return `xColumn isString=false`
    + }
    + _getEncodingMap() {
    + const columnName = this.getContent() || this.mapSettingNamesToColumnNames([this.xColumnKey])[0]
    + return {
    + x: {
    + bin: true,
    + field: columnName,
    + type: "quantitative",
    + },
    + y: {
    + aggregate: "count",
    + type: "quantitative",
    + },
    + }
    + }
    + }
    +
    + class vegaExampleNode extends abstractVegaNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get vegaExampleNameCell() {
    + return this.getWord(1)
    + }
    + _getVegaSpec() {
    + return this._spec
    + }
    + async _fetchSpec() {
    + // todo: localtesting.
    + if (this.isNodeJs()) return undefined
    + const exampleName = this.getContent() || "area" // todo: pull this default from the gram?
    + const url = `ohayo/packages/vega/ignore/vega-lite/examples/compiled/${exampleName}.vg.json`
    + const res = await this.getWebApp().getWillowBrowser().httpGetUrl(url)
    + const spec = JSON.parse(res.text)
    + // rewrite data urls
    + spec.data.forEach((row) => {
    + if (row.url) row.url = row.url.replace("data/", "packages/vega/datasets/")
    + })
    + this._spec = spec
    + return spec
    + }
    + // todo: clean this up.
    + async fetchTableInputs() {
    + const spec = await this._fetchSpec()
    + if (this.isNodeJs()) return { rows: [] }
    + const el = jQuery("
    ")[0]
    + const embedded = await vegaEmbed(el, spec)
    + const rows = await this._getVegaPostTransformOutputRows(spec, embedded)
    + return { rows: rows }
    + }
    + async _getVegaPostTransformOutputRows(spec, embedded) {
    + const tableName = spec.data[0] && spec.data[0].name
    + if (tableName) return embedded.view.data(tableName)
    + // const values = spec.data.values
    + // if (values && values.entries) return Array.from(values.entries())
    + // if (typeof values === "function") return []
    + // else if (values) return values
    + return []
    + }
    + }
    +
    + class DidYouMeanTileNode extends abstractTileTreeComponentNode {
    + get bodyStumpTemplate() {
    + return `div
    + span No tile '{input}' found. Line {lineNo}. Did you mean
    + a {closestTile}
    + collapse
    + tabindex -1
    + value {closestTile}
    + clickCommand changeTileTypeCommand
    + span ?`
    + }
    + getTileBodyStumpCode() {
    + const input = this.getFirstWord()
    + const lineNo = this.getLineNumber()
    + const closestTile = jtree.Utils.didYouMean(
    + input,
    + this.getRootNode()
    + .getHandGrammarProgram()
    + .getTopNodeTypeDefinitions()
    + .map((def) => def.get("crux"))
    + )
    + if (!closestTile) {
    + if (!input) return `div Your program has a blank line on line ${lineNo}.`
    + return `div No tile '${input}' found.`
    + }
    + return this.qFormat(this.bodyStumpTemplate, { input, lineNo, closestTile })
    + }
    + getErrors() {
    + return [new jtree.UnknownNodeTypeError(this)]
    + }
    + }
    +
    + class abstractDocTileNode extends abstractTileTreeComponentNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get tileStumpTemplate() {
    + return `div
    + class {classes}
    + id {id}
    + div
    + class TileBody
    + {body}
    + div
    + class TileFooter
    + {footer}`
    + }
    + get bodyStumpTemplate() {
    + return `{tagName}
    + bern
    + {content}`
    + }
    + _getBody() {
    + return this.qFormat(this.bodyStumpTemplate, { content: this.getContent() || "", tagName: this.tagName })
    + }
    + toStumpCode() {
    + return this.qFormat(this.tileStumpTemplate, {
    + classes: this.getCssClassNames().join(" "),
    + footer: this.getTileMenuButtonStumpCode(),
    + id: this.getTreeComponentId(),
    + body: this._getBody(),
    + })
    + }
    + }
    +
    + class docTitleNode extends abstractDocTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get stringCell() {
    + return this.getWordsFrom(1)
    + }
    + get tagName() {
    + return `h1`
    + }
    + get tileSize() {
    + return `600 75`
    + }
    + }
    +
    + class docSubtitleNode extends docTitleNode {
    + get tagName() {
    + return `h2`
    + }
    + }
    +
    + class docSectionNode extends abstractDocTileNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + undefined,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    + subtitle: docSectionSubtitleNode,
    + paragraph: docSectionParagraphNode,
    + link: docSectionLinkNode,
    + code: docSectionCodeNode,
    + }),
    + undefined
    + )
    + }
    + _getBody() {
    + return this.compile()
    + }
    + _getCompiledLine() {
    + return ""
    + }
    + }
    +
    + class docReferenceNode extends abstractDocTileNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { url: docReferenceUrlNode }), undefined)
    + }
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get referenceIdCell() {
    + return this.getWord(1)
    + }
    + get tagName() {
    + return `p`
    + }
    + }
    +
    + class docCommentNode extends abstractTileTreeComponentNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(commentLineNode, undefined, undefined)
    + }
    + get commentKeywordCell() {
    + return this.getWord(0)
    + }
    + get commentCell() {
    + return this.getWordsFrom(1)
    + }
    + get visible() {
    + return false
    + }
    + }
    +
    + class docToolingNode extends docCommentNode {}
    +
    + class abstractProviderNode extends abstractTileTreeComponentNode {
    + get tileFooterTemplate() {
    + return `span Rows Out: {outputCount} Columns Out: {columnCount} Time: {time}s Parser: {parserId} {errorMessageHtml}
    + {tileMenuButton}`
    + }
    + get tileStumpTemplate() {
    + return `div
    + class {classes}
    + id {id}
    + div
    + class TileBody
    + {body}
    + div
    + class TileFooter
    + {footer}`
    + }
    + get tileSize() {
    + return `140 60`
    + }
    + getTileFooterStumpCode() {
    + const table = this.getOutputOrInputTable()
    + const time = (this.getTimeToLoad() / 1000).toFixed(1)
    + const parserId = this.getParserId() || "?"
    + return this.qFormat(this.tileFooterTemplate, {
    + parserId,
    + errorMessageHtml: this.getErrorMessageHtml() || "",
    + time,
    + outputCount: table.getRowCount(),
    + columnCount: table.getColumnCount(),
    + tileMenuButton: this.getTileMenuButtonStumpCode(),
    + })
    + }
    + getRowClass() {
    + return Row
    + }
    + getTileBodyStumpCode() {
    + const description = this._getDescription()
    + return "div " + (description ? jtree.Utils.linkify(description) : "")
    + }
    + _getDescription() {
    + return this.getDefinition().get("description")
    + }
    + toStumpCode() {
    + return this.qFormat(this.tileStumpTemplate, {
    + classes: this.getCssClassNames().join(" "),
    + id: this.getTreeComponentId(),
    + body: this._getBodyStumpCodeCache(),
    + footer: this.getTileFooterStumpCode(),
    + })
    + }
    + getParserId() {
    + return this.getSettingsStruct().parser
    + }
    + async fetchTableInputs() {
    + return {
    + rows: [],
    + }
    + }
    + async _execute() {
    + const timeLoadStarted = this._getProcessTimeInMilliseconds()
    + this._timeLastLoadStarted = timeLoadStarted
    + const fetchedTableInputs = await this.fetchTableInputs()
    + // If a new request happened after this one, abort this one.
    + // todo: what happens to children?
    + // todo: add testing for this.
    + if (this._timeLastLoadStarted !== timeLoadStarted) {
    + console.log("superceded")
    + return null
    + }
    + this._outputTable = new Table(fetchedTableInputs.rows, fetchedTableInputs.columnDefinitions, this.getRowClass())
    + this._timeToLoad = this._getProcessTimeInMilliseconds() - timeLoadStarted
    + this.setIsDataLoaded(true)
    + await this._executeChildNodes()
    + }
    + }
    +
    + class abstractUrlNoCellsNode extends abstractProviderNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + undefined,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { parser: parserNode, useCache: useCacheNode }),
    + undefined
    + )
    + }
    + get tileSize() {
    + return `300 150`
    + }
    + get useCache() {
    + return true
    + }
    + getUrl() {
    + const struct = Object.assign(this.getSettingsStruct(), this.getDefinition().getConstantsObject())
    + if (struct.urlTemplate && this.getContent()) return new jtree.TreeNode({ content: this.getContent() }).evalTemplateString(struct.urlTemplate)
    + if (struct.urlPrefix && this.getContent()) return struct.urlPrefix + this.getContent()
    + return struct.urlCell || this.getContent() || this.url || ""
    + }
    + getParserId() {
    + if (this.parser) return this.parser
    + const url = this.getUrl()
    + if (super.getParserId()) return super.getParserId()
    + const extension = jtree.Utils.getFileExtension(url)
    + if (new TableParser().getAllTableParserIds().includes(extension)) return extension
    + }
    + getWillowHttpResponse() {
    + return this._willowHttpResponse
    + }
    + _setWillowHttpResponse(willowHttpResponse) {
    + this._willowHttpResponse = willowHttpResponse
    + return this
    + }
    + // todo: add support for Arrow.
    + // todo: remove this cache. use higher level.
    + async _getData(url) {
    + const useCache = this.getSettingsStruct().useCache !== "false" || this.useCache
    + const willowBrowser = this.getWebApp().getWillowBrowser()
    + let response
    + if (useCache) response = await willowBrowser.httpGetUrlFromCache(url)
    + else response = await willowBrowser.httpGetUrl(url)
    + if (response.fromCache)
    + this.emitLogMessage(`div
    + bern
    + Loading from cache: ${url}`)
    + this._setWillowHttpResponse(response)
    + return response.getParsedDataOrText()
    + }
    + async fetchTableInputs() {
    + let url = this.getUrl()
    + if (!url) return { rows: [] }
    + url = encodeURI(url)
    + const parserId = this.getParserId()
    + this.setRunTimePhaseError("fetchUrl")
    + try {
    + const data = await this._getData(url)
    + const parser = new TableParser()
    + if (typeof data === "string") return parser.parseTableInputsFromString(data, parserId)
    + if (this.jsonPath) return parser.parseTableInputsFromObject(data[this.jsonPath], parserId)
    + return parser.parseTableInputsFromObject(data, parserId)
    + } catch (err) {
    + // todo: solve the superagent not throwing response message thing.
    + const txt = (err.text || err.toString()).substr(0, 280)
    + this.emitLogMessage(`Error getting url: ${url}
    + ${txt}`)
    + this.setRunTimePhaseError("fetchUrl", txt)
    + return { rows: [] }
    + }
    + }
    + }
    +
    + class abstractUrlNode extends abstractUrlNoCellsNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get urlCell() {
    + return this.getWord(1)
    + }
    + get tileSize() {
    + return `300 100`
    + }
    + }
    +
    + class abstractUrlsNode extends abstractUrlNode {
    + getUrls() {
    + return this.getWordsFrom(1).map((url) => (this.urlPrefix || "") + url)
    + }
    + async fetchTableInputs() {
    + // todo: allow cache breaking.
    + const app = this.getWebApp()
    + const willowBrowser = app.getWillowBrowser()
    + let allResults = []
    + const urls = this.getUrls()
    + const fetchMethod = async (url) => (app.isUrlGetProxyAvailable() ? willowBrowser.httpGetUrlFromProxyCache(url) : willowBrowser.httpGetUrlFromCache(url))
    + for (let url of urls) {
    + const response = await fetchMethod(url)
    + allResults.push(response)
    + }
    + return { rows: allResults.map((res) => res.asJson) }
    + }
    + }
    +
    + class githubInfoNode extends abstractUrlsNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get githubRepoCell() {
    + return this.getWordsFrom(1)
    + }
    + get urlPrefix() {
    + return `https://api.github.com/repos/`
    + }
    + get dataDomain() {
    + return `github.com`
    + }
    + }
    +
    + class diskBrowseNode extends abstractUrlNode {
    + get pathCell() {
    + return this.getWordsFrom(0)
    + }
    + get tileSize() {
    + return `500 500`
    + }
    + get hakonTemplate() {
    + return `.DiskTile
    + table
    + width 100%
    + td,th
    + overflow hidden
    + text-overflow ellipsis
    + tr
    + white-space nowrap`
    + }
    + getUrl() {
    + return this.getContent() ? "/disk?path=" + this.getContent() : "/disk"
    + }
    + getTileBodyStumpCode() {
    + const labelCol = "name"
    + const path = this.getContent() || ""
    + const parentPath = path.replace(/\/[^\/]*$/, "")
    + const rowDisplayLimit = 1000 // todo: adjustable?
    + let rows = this.getOutputTable().getRows().slice(0, rowDisplayLimit)
    + rows = lodash.sortBy(rows, (row) => row.getRowOriginalValue("isDirectory") === "false")
    + return `input
    + placeholder Filepath
    + value ${path}
    + changeCommand changeTileContentAndRenderCommand
    + class LargeTileInput
    + table
    + tr
    + td
    + a ..
    + clickCommand changeTileContentAndRenderCommand
    + value ${parentPath}
    + ${rows
    + .map((row) => {
    + const label = jtree.Utils.stripHtml(row.getRowOriginalValue(labelCol))
    + const isDir = row.getRowOriginalValue("isDirectory") === "true"
    + const size = row.getRowOriginalValue("bytes")
    + const mtime = row.getRowOriginalValue("mtime")
    + if (!isDir)
    + return ` tr
    + td ${label}
    + td ${numeral(size).format("0.0 b")}
    + td ${moment(parseFloat(mtime)).fromNow()}`
    + return ` tr
    + td
    + a ${label}
    + clickCommand changeTileContentAndRenderCommand
    + value ${path.replace(/\/$/, "") + "/" + label}`
    + })
    + .join("\n")}`
    + }
    + }
    +
    + class diskReadNode extends abstractUrlNode {
    + get urlPrefix() {
    + return `/disk.read?path=`
    + }
    + }
    +
    + class abstractHackernewsNode extends abstractUrlNode {
    + get dataDomain() {
    + return `news.ycombinator.com`
    + }
    + }
    +
    + class hackernewsTopNode extends abstractHackernewsNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get quantityCell() {
    + return parseInt(this.getWord(1))
    + }
    + async fetchTableInputs() {
    + // todo: allow cache breaking.
    + const willowBrowser = this.getWebApp().getWillowBrowser()
    + const firstUrls = this._getFirstUrls()
    + if (!firstUrls.length || this.isNodeJs()) return []
    + let allResults = []
    + const fetchMethod = async (url) => (this.getWebApp().isUrlGetProxyAvailable() ? willowBrowser.httpGetUrlFromProxyCache(url) : willowBrowser.httpGetUrlFromCache(url))
    + for (let mainUrl of firstUrls) {
    + const response = await fetchMethod(mainUrl)
    + const nextUrls = this._parseNextUrls(response)
    + const batchResults = await Promise.all(nextUrls.slice(0, this._getLimit()).map((url) => fetchMethod(url)))
    + allResults = allResults.concat(batchResults)
    + }
    + return { rows: allResults.map((res) => res.asJson) }
    + }
    + _getLimit() {
    + return parseInt(this.getContent() || 10)
    + }
    + _parseNextUrls(response) {
    + return response.asJson.map((id) => `https://hacker-news.firebaseio.com/v0/item/${id}.json?print=pretty`)
    + }
    + _getFirstUrls() {
    + return ["https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"]
    + }
    + }
    +
    + class hackernewsSubmissionsNode extends hackernewsTopNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get quantityCell() {
    + return parseInt(this.getWord(1))
    + }
    + get hackerNewsUserNameCell() {
    + return this.getWordsFrom(2)
    + }
    + _getFirstUrls() {
    + return this.getWordsFrom(2).map((username) => `https://hacker-news.firebaseio.com/v0/user/${username}.json?print=pretty`)
    + }
    + _getLimit() {
    + return parseInt(this.getWord(1) || 10)
    + }
    + _parseNextUrls(response) {
    + return response.asJson.submitted.map((id) => `https://hacker-news.firebaseio.com/v0/item/${id}.json?print=pretty`)
    + }
    + }
    +
    + class publicApisNode extends abstractUrlNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get jsonPath() {
    + return `entries`
    + }
    + get parser() {
    + return `json`
    + }
    + get url() {
    + return `https://api.publicapis.org/entries`
    + }
    + get dataDomain() {
    + return `publicapis.org`
    + }
    + }
    +
    + class webGetNode extends abstractUrlNode {
    + get tileSize() {
    + return `400 100`
    + }
    + get bodyStumpTemplate() {
    + return `span {kind}
    + class LargeLabel
    + input
    + value {content}
    + placeholder {placeholderMessage}
    + changeCommand changeTileContentAndRenderCommand
    + class LargeTileInput`
    + }
    + get placeholderMessage() {
    + return `Enter a url.`
    + }
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, { kind: this.getFirstWord(), content: this.getContent() || "", placeholderMessage: this.placeholderMessage })
    + }
    + }
    +
    + class webPostNode extends abstractUrlNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { post: postNode }), undefined)
    + }
    + get tileSize() {
    + return `400 130`
    + }
    + get webPostBodyStumpTemplate() {
    + return `textarea
    + bern
    + {post}
    + placeholder This data will be sent as the value of the 'q' param
    + name post
    + changeCommand changeTileSettingMultilineCommand
    + class TileTextArea`
    + }
    + getTileBodyStumpCode() {
    + return super.getTileBodyStumpCode() + this.qFormat(this.webPostBodyStumpTemplate, { post: jtree.Utils.stripHtml(this.getSettingsStruct().post || "") })
    + }
    + async _getData(url) {
    + const settings = this.getSettingsStruct()
    + // todo, but make a separate tile
    + // if (settings.pushButton) {
    + // if (!settings.pushed) return ""
    + // settings.pushed = false
    + // }
    + const postData = settings.post || ""
    + const res = await this.getWebApp().getWillowBrowser().httpPostUrl(url, { q: postData.trim() })
    + this._setWillowHttpResponse(res)
    + return res.getParsedDataOrText()
    + }
    + }
    +
    + class wikipediaContentNode extends abstractUrlNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get wikipediaPermalinkCell() {
    + return this.getWordsFrom(1)
    + }
    + get urlPrefix() {
    + return `https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro&explaintext&redirects=1&origin=*&titles=`
    + }
    + get dataDomain() {
    + return `wikipedia.org`
    + }
    + getUrl() {
    + return this.urlPrefix + this.wikipediaPermalinkCell.join("|")
    + }
    + async fetchTableInputs() {
    + const inputs = await super.fetchTableInputs()
    + // todo: cleanup
    + return { rows: Object.values(inputs.rows[0].query.pages) }
    + }
    + }
    +
    + class abstractFixedDatasetFromUrlNode extends abstractUrlNoCellsNode {
    + _getDescription() {
    + const desc = super._getDescription()
    + if (this.dataUrl) return (desc ? desc + " from " : "") + this.dataUrl
    + return desc
    + }
    + }
    +
    + class abstractFixedDatasetFromOhayoCollectionNode extends abstractFixedDatasetFromUrlNode {
    + get tileSize() {
    + return `300 150`
    + }
    + async _getData(url) {
    + if (!this.isNodeJs()) return super._getData(url)
    + const fs = require("fs")
    + const filepath = __dirname + "/../" + url
    + return fs.readFileSync(filepath, "utf8")
    + }
    + }
    +
    + class cancerCasesNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/cancer/cases.csv`
    + }
    + }
    +
    + class abstractCdcInfantPercentileNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get dataUrl() {
    + return `https://www.cdc.gov/growthcharts/percentile_data_files.htm`
    + }
    + get isDataPublicDomain() {
    + return true
    + }
    + }
    +
    + class weightPercentilesNode extends abstractCdcInfantPercentileNode {
    + get url() {
    + return `ohayo/packages/cdc/wtageinf.csv`
    + }
    + }
    +
    + class lengthPercentilesNode extends abstractCdcInfantPercentileNode {
    + get url() {
    + return `ohayo/packages/cdc/lenageinf.csv`
    + }
    + }
    +
    + class headPercentilesNode extends abstractCdcInfantPercentileNode {
    + get url() {
    + return `ohayo/packages/cdc/hcageinf.csv`
    + }
    + }
    +
    + class kaggleDatasetsHeartNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/kaggle/heart.csv`
    + }
    + }
    +
    + class mozTop500Node extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/moz/top500Domains.csv`
    + }
    + get isDataPublicDomain() {
    + return true
    + }
    + get dataUrl() {
    + return `https://moz.com/top500`
    + }
    + }
    +
    + class lifeExpectancyNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/owid/life-expectancy.csv`
    + }
    + }
    +
    + class owidListNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/owid/owid.tree`
    + }
    + get parser() {
    + return `treeRows`
    + }
    + }
    +
    + class samplesTelescopesNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/samples/telescopes.tsv`
    + }
    + get dataUrl() {
    + return `https://github.com/treenotation/ohayo/blob/master/ohayo/packages/samples/telescopes.tsv`
    + }
    + get isDataPublicDomain() {
    + return true
    + }
    + get dataDescription() {
    + return `## Provenance
    + This list was put together by a group of remote workers in a Google spreadsheet in 2017 and hasn't been updated in a while.`
    + }
    + }
    +
    + class samplesMtcarsNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/samples/mtcars.tsv`
    + }
    + get dataUrl() {
    + return `https://stat.ethz.ch/R-manual/R-devel/library/datasets/html/mtcars.html`
    + }
    + get isDataPublicDomain() {
    + return true
    + }
    + }
    +
    + class samplesIrisNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/samples/iris.tsv`
    + }
    + get isDataPublicDomain() {
    + return true
    + }
    + get dataUrl() {
    + return `https://archive.ics.uci.edu/ml/datasets/iris`
    + }
    + }
    +
    + class samplesFlights14Node extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/samples/flights14-sample.csv`
    + }
    + get isDataPublicDomain() {
    + return true
    + }
    + get dataUrl() {
    + return `https://github.com/Rdatatable/data.table/blob/master/vignettes/flights14.csv`
    + }
    + }
    +
    + class samplesSiNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get parser() {
    + return `text`
    + }
    + get url() {
    + return `ohayo/packages/samples/si.tree`
    + }
    + get dataUrl() {
    + return `https://github.com/treenotation/ohayo/blob/master/ohayo/packages/samples/si.tree`
    + }
    + get isDataPublicDomain() {
    + return true
    + }
    + }
    +
    + class samplesPortalNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/samples/portals.ssv`
    + }
    + get dataUrl() {
    + return `https://github.com/treenotation/ohayo/blob/master/ohayo/packages/samples/portals.ssv`
    + }
    + get isDataPublicDomain() {
    + return true
    + }
    + }
    +
    + class samplesStarWarsNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/samples/starwars.json`
    + }
    + get dataLicense() {
    + return `BSD`
    + }
    + get isDataPublicDomain() {
    + return false
    + }
    + }
    +
    + class samplesPopulationsNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/samples/populations.tsv`
    + }
    + }
    +
    + class samplesBabyNamesNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/samples/baby-names-sample.csv`
    + }
    + }
    +
    + class samplesDeclarationNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/samples/declaration-of-independence.text`
    + }
    + get isDataPublicDomain() {
    + return true
    + }
    + }
    +
    + class samplesPeriodicTableNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/samples/periodic-table.csv`
    + }
    + get dataUrl() {
    + return `https://gist.github.com/GoodmanSciences/c2dd862cd38f21b0ad36b8f96b4bf1ee`
    + }
    + }
    +
    + class samplesLettersNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/samples/letters.tsv`
    + }
    + }
    +
    + class samplesPresidentsNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/samples/presidents.csv`
    + }
    + get isDataPublicDomain() {
    + return true
    + }
    + }
    +
    + class ucimlrDatasetsNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get url() {
    + return `ohayo/packages/ucimlr/datasets.tsv`
    + }
    + }
    +
    + class vegaDataNode extends abstractFixedDatasetFromOhayoCollectionNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get vegaDataSetCell() {
    + return this.getWord(1)
    + }
    + get urlPrefix() {
    + return `ohayo/packages/vega/datasets/`
    + }
    + }
    +
    + class redditAllNode extends abstractUrlNoCellsNode {
    + get offlineDataSet() {
    + return `ohayo/packages/reddit/all.json`
    + }
    + get url() {
    + return `https://www.reddit.com/r/all/top/.json?sort=top`
    + }
    + get dataDomain() {
    + return `reddit.com`
    + }
    + async fetchTableInputs() {
    + const inputs = await super.fetchTableInputs()
    + // Todo: add tests/external dependency, as reddit API changes.
    + // Here it looks like we have the equivalent of a custom parser just for a Reddit Data source.
    + // todo: explore/define/typescriptAPI this custom parser pattern more. probably will be common.
    + return inputs.rows.length ? { rows: inputs.rows[0].data.children.map((obj) => obj.data) } : inputs
    + }
    + getParserId() {
    + return "json"
    + }
    + }
    +
    + class redditSubsNode extends redditAllNode {
    + get url() {
    + return `https://www.reddit.com/reddits.json`
    + }
    + }
    +
    + class redditSubNode extends redditAllNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get subredditNameCell() {
    + return this.getWord(1)
    + }
    + getUrl() {
    + const subreddit = this.getContent() || "all"
    + return `https://www.reddit.com/r/${subreddit}/top/.json?sort=top`
    + }
    + }
    +
    + class abstractDummyNode extends abstractProviderNode {
    + get tileSize() {
    + return `300 150`
    + }
    + async _execute() {
    + this.setIsDataLoaded(true)
    + await this._executeChildNodes()
    + }
    + }
    +
    + class samplesPatientsNode extends abstractDummyNode {
    + get isDataPublicDomain() {
    + return true
    + }
    + get dummyDataSetName() {
    + return `patients`
    + }
    + }
    +
    + class samplesPoemNode extends abstractDummyNode {
    + get isDataPublicDomain() {
    + return true
    + }
    + get dummyDataSetName() {
    + return `poem`
    + }
    + }
    +
    + class samplesOuterSpaceNode extends abstractDummyNode {
    + get dummyDataSetName() {
    + return `outerSpace`
    + }
    + }
    +
    + class samplesTreeProgramNode extends abstractDummyNode {
    + get isDataPublicDomain() {
    + return true
    + }
    + get dummyDataSetName() {
    + return `treeProgram`
    + }
    + }
    +
    + class samplesWaterBillNode extends abstractDummyNode {
    + get isDataPublicDomain() {
    + return true
    + }
    + get dummyDataSetName() {
    + return `waterBill`
    + }
    + }
    +
    + class samplesGapMinderNode extends abstractDummyNode {
    + get dummyDataSetName() {
    + return `gapMinder`
    + }
    + }
    +
    + class abstractTransformerNode extends abstractProviderNode {
    + get tileFooterTemplate() {
    + return `span Rows In: {inputCount} Rows Out: {outputCount} Columns Out: {columnCount}
    + {tileMenuButton}`
    + }
    + get bodyStumpTemplate() {
    + return `span {kind}
    + class LargeLabel
    + input
    + value {content}
    + placeholder {placeholderMessage}
    + changeCommand changeTileContentAndRenderCommand
    + class LargeTileInput`
    + }
    + get placeholderMessage() {
    + return ``
    + }
    + get tileSize() {
    + return `160 100`
    + }
    + getTileFooterStumpCode() {
    + const table = this.getParentOrDummyTable()
    + const inputCount = table.getRowCount()
    + const outputTable = this.getOutputOrInputTable()
    + return this.qFormat(this.tileFooterTemplate, {
    + inputCount,
    + outputCount: table.getRowCount(),
    + columnCount: outputTable.getColumnCount(),
    + tileMenuButton: this.getTileMenuButtonStumpCode(),
    + })
    + }
    + async _execute() {
    + this._outputTable = this._createOutputTable()
    + this.setIsDataLoaded(true)
    + await this._executeChildNodes()
    + }
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, { kind: this.getFirstWord(), content: this.getContent() || "", placeholderMessage: this.placeholderMessage })
    + }
    + }
    +
    + class abstractColumnAdderTileNode extends abstractTransformerNode {
    + _createOutputTable() {
    + return this.getParentOrDummyTable().addColumns(this.getNewColumns())
    + }
    + }
    +
    + class dateAddColumnsNode extends abstractColumnAdderTileNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { sourceColumn: sourceColumnNode }), undefined)
    + }
    + get dateColumnTypeCell() {
    + return this.getWordsFrom(0)
    + }
    + get placeholderMessage() {
    + return `Enter the source column and new date columns you want, or leave blank to get 'day month year'.`
    + }
    + get columnPredictionHints() {
    + return `sourceColumn isTemporal=true`
    + }
    + getNewColumns() {
    + const inputColumnName = this.getSettingsStruct().sourceColumn // todo: this is probably broken. need to fix settings timing issues.
    + if (!inputColumnName) return []
    + const addColumns = this.getContent() ? this.getWordsFrom(1) : ["day", "week", "month"]
    + // what happened to dayName? timeOfDay?
    + return addColumns.map((outputCol) => {
    + return {
    + source: inputColumnName,
    + name: outputCol,
    + type: outputCol,
    + }
    + })
    + }
    + }
    +
    + class genConstantNode extends abstractColumnAdderTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + get primitiveTypeCell() {
    + return this.getWord(2)
    + }
    + get anyCell() {
    + return this.getWord(3)
    + }
    + getNewColumns() {
    + return [
    + {
    + name: this.columnNameCell,
    + type: this.primitiveTypeCell,
    + accessorFn: (row) => this.anyCell,
    + },
    + ]
    + }
    + }
    +
    + class genGrowthNode extends abstractColumnAdderTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + get minCell() {
    + return parseFloat(this.getWord(2))
    + }
    + get growthRateCell() {
    + return parseFloat(this.getWord(3))
    + }
    + getNewColumns() {
    + let total = this.minCell
    + return [
    + {
    + name: this.columnNameCell,
    + accessorFn: (row, rowIndex) => {
    + total = total * (1 + this.growthRateCell)
    + return total
    + },
    + },
    + ]
    + }
    + }
    +
    + class mathLogNode extends abstractColumnAdderTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + getNewColumns() {
    + const inputColumnName = this.getWord(1)
    + if (!inputColumnName) return []
    + const inputCol = this.getParentOrDummyTable().getColumnByName(inputColumnName)
    + return [
    + {
    + source: inputColumnName,
    + name: inputColumnName + "Log",
    + type: inputCol.getPrimitiveTypeName(),
    + mathFn: Math.log,
    + },
    + ]
    + }
    + }
    +
    + class rowsAddIndexColumnNode extends abstractColumnAdderTileNode {
    + getNewColumns() {
    + let index = 0
    + return [
    + {
    + name: "index",
    + accessorFn: (row) => index++,
    + },
    + ]
    + }
    + }
    +
    + class rowsRunningTotalNode extends abstractColumnAdderTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + getNewColumns() {
    + const sourceColumnName = this.getWord(1)
    + let total = 0
    + return [
    + {
    + source: sourceColumnName,
    + name: "total",
    + accessorFn: (row) => {
    + total += row[sourceColumnName]
    + return total
    + },
    + },
    + ]
    + }
    + }
    +
    + class textLengthNode extends abstractColumnAdderTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + getNewColumns() {
    + const sourceColumnName = this.getWord(1)
    + const destinationColumnName = sourceColumnName + "Length"
    + return [
    + {
    + source: sourceColumnName,
    + name: destinationColumnName,
    + accessorFn: (row) => row[sourceColumnName].length,
    + },
    + ]
    + }
    + }
    +
    + class textSplitNode extends abstractColumnAdderTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + get delimiterCell() {
    + return this.getWord(2)
    + }
    + get newColumnNamesCell() {
    + return this.getWordsFrom(3)
    + }
    + get dummyDataSetName() {
    + return `poem`
    + }
    + // note: delimiter can probably be ""
    + // todo: how would we split on a space???
    + // perhaps its better to use getContent() as delimiter, and if you want to name the columns, you can do that later?
    + getNewColumns() {
    + const sourceColumnName = this.getWord(1)
    + const delimiter = this.getWord(2)
    + const destinationColumns = this.getWordsFrom(3)
    + return destinationColumns.map((destinationColumnName, index) => {
    + return {
    + source: sourceColumnName,
    + name: destinationColumnName,
    + accessorFn: (row) => {
    + const words = row[sourceColumnName].split(delimiter)
    + return this.reverseSplit ? words.reverse()[index] : words[index]
    + },
    + }
    + })
    + return [
    + {
    + source: sourceColumnName,
    + name: destinationColumnName,
    + accessorFn: (row) => row[sourceColumnName].length,
    + },
    + ]
    + }
    + }
    +
    + class reverseTextSplitNode extends textSplitNode {
    + get reverseSplit() {
    + return [true]
    + }
    + }
    +
    + class textToLowerCaseNode extends abstractColumnAdderTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + get dummyDataSetName() {
    + return `poem`
    + }
    + getNewColumns() {
    + const sourceColumnName = this.getWord(1) || "text"
    + return [
    + {
    + source: sourceColumnName,
    + name: sourceColumnName,
    + accessorFn: (row) => row[sourceColumnName].toLowerCase(),
    + },
    + ]
    + }
    + }
    +
    + class textTemplateNode extends abstractColumnAdderTileNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { content: contentNode }), undefined)
    + }
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get newColumnNameCell() {
    + return this.getWordsFrom(1)
    + }
    + get bodyStumpTemplate() {
    + return `textarea
    + name content
    + changeCommand changeTileSettingMultilineCommand
    + placeholder Enter template here.
    + class TileTextArea savable
    + bern
    + {text}`
    + }
    + getNewColumns() {
    + const contentNode = this.getNode("content")
    + const templateString = contentNode ? contentNode.childrenToString() : ""
    + const destColumnName = this.getWord(1) || "Output"
    + return [
    + {
    + name: destColumnName,
    + accessorFn: (row) => new jtree.TreeNode(templateString).templateToString(row),
    + },
    + ]
    + }
    + getDataContent() {
    + const node = this.getNode("content")
    + return node ? node.childrenToString() : ""
    + }
    + getTileBodyStumpCode() {
    + const text = lodash.escape(this.getDataContent())
    + return this.qFormat(this.bodyStumpTemplate, { text })
    + }
    + }
    +
    + class textPermalinkNode extends abstractColumnAdderTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + get newColumnNameCell() {
    + return this.getWord(2)
    + }
    + getNewColumns() {
    + const sourceColumnName = this.getWord(1) || "text"
    + const destinationColumnName = this.getWord(2) || "Permalink"
    + return [
    + {
    + source: sourceColumnName,
    + name: destinationColumnName,
    + accessorFn: (row) => jtree.Utils.stringToPermalink(row[sourceColumnName]),
    + },
    + ]
    + }
    + }
    +
    + class textReplaceNode extends abstractColumnAdderTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + get anyCell() {
    + return this.getWordsFrom(2)
    + }
    + getNewColumns() {
    + const sourceColumnName = this.getWord(1) || "text"
    + const simpleSearch = this.getWord(2)
    + const simpleReplace = this.getWord(3)
    + const destinationColumnName = sourceColumnName
    + return [
    + {
    + source: sourceColumnName,
    + name: destinationColumnName,
    + accessorFn: (row) => row[sourceColumnName].replace(new RegExp(simpleSearch, "g"), simpleReplace),
    + },
    + ]
    + }
    + }
    +
    + class textTrimNode extends abstractColumnAdderTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + get anyCell() {
    + return this.getWordsFrom(2)
    + }
    + getNewColumns() {
    + const sourceColumnName = this.getWord(1) || "text"
    + const trimChar = this.getWord(2)
    + const destinationColumnName = sourceColumnName
    + return [
    + {
    + source: sourceColumnName,
    + name: destinationColumnName,
    + accessorFn: (row) => (trimChar ? row[sourceColumnName].replace(new RegExp(`(^${trimChar}|${trimChar}$)`, "g"), "") : row[sourceColumnName].trim()),
    + },
    + ]
    + }
    + }
    +
    + class textSubstringNode extends abstractColumnAdderTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + get startIndexCell() {
    + return parseInt(this.getWord(2))
    + }
    + get lengthCell() {
    + return parseInt(this.getWord(3))
    + }
    + get destinationColumnName() {
    + return `substring`
    + }
    + get dummyDataSetName() {
    + return `poem`
    + }
    + getNewColumns() {
    + const sourceColumnName = this.getWord(1)
    + const startPosition = typeof this.startIndex !== undefined ? this.startIndex : parseInt(this.getWord(2))
    + const endPosition = typeof this.endIndex !== undefined ? this.endIndex : this.getWord(3) === undefined ? undefined : parseInt(this.getWord(3))
    + return [
    + {
    + source: sourceColumnName,
    + name: this.destinationColumnName,
    + accessorFn: (row) => (row[sourceColumnName] ? row[sourceColumnName].toString().substr(startPosition, endPosition) : ""),
    + },
    + ]
    + }
    + }
    +
    + class testFirstLetterNode extends textSubstringNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + get endIndex() {
    + return 1
    + }
    + get startIndex() {
    + return 0
    + }
    + get destinationColumnName() {
    + return `firstLetter`
    + }
    + }
    +
    + class abstractNewRowsTransformerTileNode extends abstractTransformerNode {
    + _createOutputTable() {
    + // todo: remove this
    + return new Table(this.makeNewRows())
    + }
    + }
    +
    + class columnsDescribeNode extends abstractNewRowsTransformerTileNode {
    + makeNewRows() {
    + return this.getParentOrDummyTable().getColumnNamesAndTypesAndReductions()
    + }
    + }
    +
    + class columnsListNode extends columnsDescribeNode {
    + makeNewRows() {
    + return this.getParentOrDummyTable().getColumnNamesAndTypes()
    + }
    + }
    +
    + class dataEvalNode extends abstractNewRowsTransformerTileNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { content: contentNode }), undefined)
    + }
    + makeNewRows() {
    + const node = this.getNode(this.contentKey)
    + const code = node && node.childrenToString() // "rows => { return []}"
    + let fn
    + try {
    + fn = code && eval(code)
    + } catch (err) {
    + // todo: warn user
    + console.error(err)
    + }
    + const inputRows = this.getParentOrDummyTable().cloneNativeJavascriptTypedRows()
    + return fn ? fn(inputRows) : inputRows
    + }
    + }
    +
    + class joinByNode extends abstractNewRowsTransformerTileNode {
    + get columnNameCell() {
    + return this.getWordsFrom(0)
    + }
    + makeNewRows() {
    + // Todo: move to table project
    + const parentTile = this.getParent()
    + if (parentTile.isRoot()) return []
    + const grandParentTile = parentTile.getParent()
    + if (grandParentTile.isRoot()) return parentTile.getOutputOrInputTable().cloneNativeJavascriptTypedRows()
    + const tiles = [parentTile, grandParentTile]
    + const arrays = tiles.map((tile) => tile.getOutputOrInputTable().cloneNativeJavascriptTypedRows())
    + const joinOn = this.getContent()
    + if (!joinOn) return jtree.Utils.flatten(arrays)
    + const cols = tiles.map((tile) => tile.getOutputOrInputTable().getColumnNames())
    + return jtree.Utils.joinArraysOn(joinOn, arrays, cols)
    + }
    + }
    +
    + class matchColumnsFuzzyNode extends abstractNewRowsTransformerTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get needleColumnNameCell() {
    + return this.getWord(1)
    + }
    + get haystackColumnNameCell() {
    + return this.getWord(2)
    + }
    + get tileScript() {
    + return `ohayo/packages/match/fuse.min.js`
    + }
    + makeNewRows() {
    + // Todo: move some of this logic to table project?
    + const parentTile = this.getParent()
    + if (parentTile.isRoot()) return []
    + const grandParentTile = parentTile.getParent()
    + if (grandParentTile.isRoot()) return parentTile.getOutputOrInputTable().cloneNativeJavascriptTypedRows()
    + const tiles = [parentTile, grandParentTile]
    + const arrays = tiles.map((tile) => tile.getOutputOrInputTable().cloneNativeJavascriptTypedRows())
    + return this._addFuzz(arrays[0], arrays[1])
    + }
    + get fuse() {
    + return this.isNodeJs() ? require("fuse.js") : Fuse
    + }
    + _addFuzz(needles, haystacks) {
    + const needleColumnName = this.getWord(1) || "name"
    + const haystackColumnName = this.getWord(2) || "name"
    + const options = {
    + shouldSort: true,
    + includeScore: true,
    + threshold: 0.6,
    + location: 0,
    + distance: 100,
    + maxPatternLength: 32,
    + minMatchCharLength: 1,
    + keys: [haystackColumnName],
    + }
    + const fuse = new this.fuse(haystacks, options) // "list" is the item array
    + return needles.map((needle) => {
    + const searchValue = needle[needleColumnName]
    + const result = fuse.search(searchValue)
    + if (!result.length)
    + return {
    + search: searchValue,
    + match: "",
    + }
    + const match = result[0]
    + return {
    + search: searchValue,
    + match: match.item[haystackColumnName],
    + confidence: parseFloat((1 - match.score).toFixed(3)),
    + }
    + })
    + }
    + }
    +
    + class schemaTypeScriptNode extends abstractNewRowsTransformerTileNode {
    + makeNewRows() {
    + return [{ text: this.getParentOrDummyTable().toTypeScriptInterface() }]
    + }
    + }
    +
    + class schemaSimpleNode extends abstractNewRowsTransformerTileNode {
    + makeNewRows() {
    + const schema = this.getParentOrDummyTable().toSimpleSchema()
    + const oneLiner = schema.replace(/ /g, ":").replace(/\n/g, " ")
    + return [{ text: oneLiner + "\n\n" + schema }]
    + }
    + }
    +
    + class textWordCountNode extends abstractNewRowsTransformerTileNode {
    + get dummyDataSetName() {
    + return `poem`
    + }
    + makeNewRows() {
    + return this._getAllWords(this.getPipishInput())
    + }
    + _getAllWords(text) {
    + const rows = []
    + if (!text) return rows
    + const words = text
    + .split(/\s/g)
    + .map((word) => word.replace(/[^a-z0-9\-]/gi, ""))
    + .filter((word) => word)
    + const index = {}
    + words.forEach((word) => {
    + if (!index[word]) index[word] = 1
    + else index[word]++
    + })
    + Object.keys(index).forEach((word) => {
    + const trimmedWord = word.trim()
    + if (trimmedWord)
    + rows.push({
    + word: trimmedWord,
    + count: index[trimmedWord],
    + })
    + })
    + return rows
    + }
    + }
    +
    + class textLineCountNode extends abstractNewRowsTransformerTileNode {
    + get dummyDataSetName() {
    + return `poem`
    + }
    + makeNewRows() {
    + return [{ lines: this.getPipishInput().split(/\n/g).length }]
    + }
    + }
    +
    + class treenotationWordTypesNode extends abstractNewRowsTransformerTileNode {
    + get dummyDataSetName() {
    + return `treeProgram`
    + }
    + makeNewRows() {
    + return [{ text: new ohayoNode(this.getPipishInput()).toCellTypeTree() }]
    + }
    + }
    +
    + class abstractColumnFilterTileNode extends abstractTransformerNode {
    + _createOutputTable() {
    + return this.getParentOrDummyTable().dropAllColumnsExcept(this.getColumnNamesToKeep())
    + }
    + }
    +
    + class columnsFirstNode extends abstractColumnFilterTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get intCell() {
    + return parseInt(this.getWord(1))
    + }
    + get placeholderMessage() {
    + return `Enter the number of columns you want to keep`
    + }
    + getColumnNamesToKeep() {
    + return this.getParentOrDummyTable()
    + .getColumnsArrayOfObjects()
    + .slice(0, parseInt(this.getContent()))
    + .map((col) => col.name)
    + }
    + }
    +
    + class columnsLastNode extends abstractColumnFilterTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get intCell() {
    + return parseInt(this.getWord(1))
    + }
    + get placeholderMessage() {
    + return `Enter the number of columns you want to keep`
    + }
    + getColumnNamesToKeep() {
    + const cols = this.getParentOrDummyTable().getColumnsArrayOfObjects()
    + return cols.slice(cols.length - parseInt(this.getContent())).map((col) => col.name)
    + }
    + }
    +
    + class columnsDropNode extends abstractColumnFilterTileNode {
    + get columnNameCell() {
    + return this.getWordsFrom(0)
    + }
    + getColumnNamesToKeep() {
    + const colsToDrop = this.getWordsFrom(1)
    + return this.getParentOrDummyTable()
    + .getColumnsArrayOfObjects()
    + .filter((col) => !colsToDrop.includes(col.name))
    + .map((col) => col.name)
    + }
    + }
    +
    + class columnsDropConstantsNode extends abstractColumnFilterTileNode {
    + getColumnNamesToKeep() {
    + return this.getParentOrDummyTable()
    + .getColumnsArray()
    + .filter((col) => col.getReductions().uniqueValues > 1)
    + .map((col) => col.getColumnName())
    + }
    + }
    +
    + class columnsKeepNode extends abstractColumnFilterTileNode {
    + get columnNameCell() {
    + return this.getWordsFrom(0)
    + }
    + get placeholderMessage() {
    + return `Enter the column names to keep.`
    + }
    + getColumnNamesToKeep() {
    + const colsToKeep = this.getWordsFrom(1)
    + return this.getParentOrDummyTable()
    + .getColumnsArrayOfObjects()
    + .filter((col) => colsToKeep.includes(col.name))
    + .map((col) => col.name)
    + }
    + }
    +
    + class columnsKeepNumericsNode extends abstractColumnFilterTileNode {
    + getColumnNamesToKeep() {
    + return Object.values(this.getParentOrDummyTable().getColumnsMap())
    + .filter((col) => col.isNumeric())
    + .map((col) => col.getColumnName())
    + }
    + }
    +
    + class abstractTransformerNoParamsTileNode extends abstractTransformerNode {
    + getTileBodyStumpCode() {
    + return `span ${this.getFirstWord()}
    + class LargeLabel`
    + }
    + }
    +
    + class rowsShuffleNode extends abstractTransformerNoParamsTileNode {
    + _createOutputTable() {
    + return this.getParentOrDummyTable().shuffleRows()
    + }
    + }
    +
    + class rowsReverseNode extends abstractTransformerNoParamsTileNode {
    + _createOutputTable() {
    + return this.getParentOrDummyTable().reverseRows()
    + }
    + }
    +
    + class abstractRowFilterTileNode extends abstractTransformerNode {
    + get placeholderMessage() {
    + return `Enter a string to filter by.`
    + }
    + // todo: pass thru.
    + // todo: remove this?
    + _createOutputTable() {
    + const fn = this.getRowFilterFn()
    + if (!fn) return this.getParentOrDummyTable().clone()
    + return this.getParentOrDummyTable().filterRowsByFn(fn)
    + }
    + }
    +
    + class filterWhereNode extends abstractRowFilterTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + get comparisonCell() {
    + return this.getWord(2)
    + }
    + get scalarValueCell() {
    + return this.getWord(3)
    + }
    + get tileSize() {
    + return `250 100`
    + }
    + _createOutputTable() {
    + // todo: use cells here.
    + const columnName = this.getWord(1)
    + const comparison = this.getWord(2)
    + let untypedScalarValue = this.getWord(3)
    + const table = this.getParentOrDummyTable()
    + if (!columnName || !comparison || untypedScalarValue === undefined) return table.clone()
    + const column = table.getColumnByName(columnName)
    + if (!column) return table
    + return table.filterClonedRowsByScalar(columnName, comparison, untypedScalarValue)
    + }
    + }
    +
    + class filterWithNode extends abstractRowFilterTileNode {
    + get stringCell() {
    + return this.getWordsFrom(0)
    + }
    + get expectedBooleanValue() {
    + return true
    + }
    + get tileSize() {
    + return `250 100`
    + }
    + getRowFilterFn() {
    + const words = this.getWordsFrom(1)
    + // todo: problem here is, getRows has too many columns if after a transformed column.
    + if (!words.length) return undefined
    + const len = words.length
    + const expectedValue = this.expectedBooleanValue
    + return (row) => {
    + const str = JSON.stringify(row)
    + for (let index = 0; index < len; index++) {
    + if (str.includes(words[index]) !== expectedValue) return false
    + }
    + return true
    + }
    + }
    + }
    +
    + class filterWithoutNode extends filterWithNode {
    + get expectedBooleanValue() {
    + return false
    + }
    + }
    +
    + class filterAnyNode extends filterWithNode {
    + getRowFilterFn() {
    + const words = this.getWordsFrom(1)
    + if (!words.length) return undefined
    + const len = words.length
    + // todo: problem here is, getRows has too many columns if after a transformed column.
    + return (row) => {
    + const str = JSON.stringify(row)
    + for (let index = 0; index < len; index++) {
    + if (str.includes(words[index])) return true
    + }
    + return false
    + }
    + }
    + }
    +
    + class rowsFirstNode extends abstractRowFilterTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get intCell() {
    + return parseInt(this.getWord(1))
    + }
    + getRowFilterFn() {
    + const limit = parseInt(this.getContent())
    + if (isNaN(limit)) return undefined
    + return (row, rowIndex) => rowIndex < limit
    + }
    + }
    +
    + class rowsSampleNode extends abstractRowFilterTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get intCell() {
    + return parseInt(this.getWord(1))
    + }
    + getRowFilterFn() {
    + // todo: move to jtable?
    + const sampleCount = parseInt(this.getContent())
    + if (isNaN(sampleCount)) return undefined
    + const totalCount = this.getParentOrDummyTable().getRowCount()
    + if (totalCount <= sampleCount) return undefined
    + const every = Math.floor(totalCount / sampleCount)
    + let total = 0
    + return (row, rowIndex) => {
    + if (total === totalCount) return false
    + if (rowIndex % every !== 0) return false
    + total++
    + return true
    + }
    + }
    + }
    +
    + class rowsDropIfMissingNode extends abstractRowFilterTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWordsFrom(1)
    + }
    + get placeholderMessage() {
    + return `Leave blank to filter a row if it is missing any column, or specifiy column name(s).`
    + }
    + getRowFilterFn() {
    + const column = this.getContent()
    + if (column) return (row) => !jtree.Utils.isValueEmpty(row[column])
    + return (row) => !Object.values(row).some(jtree.Utils.isValueEmpty)
    + }
    + }
    +
    + class rowsLastNode extends abstractRowFilterTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get intCell() {
    + return parseInt(this.getWord(1))
    + }
    + getRowFilterFn() {
    + const limit = parseInt(this.getContent())
    + if (isNaN(limit)) return undefined
    + const start = this.getParentOrDummyTable().getRowCount() - limit
    + return (row, rowIndex) => rowIndex >= start
    + }
    + }
    +
    + class pcaNode extends abstractTransformerNode {
    + get tileScript() {
    + return `ohayo/packages/bitanath/pca.js`
    + }
    + get github() {
    + return `https://github.com/bitanath/pca`
    + }
    + get pcaLib() {
    + return this.isNodeJs() ? require(__dirname + "/packages/bitanath/pca.js") : PCA
    + }
    + get mathLib() {
    + return this.isNodeJs() ? require(__dirname + "/packages/mathjs/math.min.js") : math
    + }
    + _createOutputTable() {
    + const table = this.getParentOrDummyTable()
    + const matrix = table.toNumericMatrix()
    + const vectors = this.pcaLib.getEigenVectors(matrix)
    + const pcaRows = vectors.map((vec) => vec.vector)
    + const rows = table.getRows().map((row, index) => {
    + const obj = row.rowToObjectWithOnlyNativeJavascriptTypes()
    + const vec = matrix[index]
    + obj.pc1 = this.mathLib.dot(vec, pcaRows[0])
    + obj.pc2 = this.mathLib.dot(vec, pcaRows[1])
    + obj.pc3 = this.mathLib.dot(vec, pcaRows[2])
    + return obj
    + })
    + return new Table(rows)
    + }
    + }
    +
    + class columnsRenameNode extends abstractTransformerNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + get newColumnNameCell() {
    + return this.getWord(2)
    + }
    + _createOutputTable() {
    + const renameMap = {}
    + renameMap[this.getWord(1)] = this.getWord(2)
    + return this.getParentOrDummyTable().renameColumns(renameMap)
    + }
    + }
    +
    + class columnsCleanNamesNode extends abstractTransformerNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + _createOutputTable() {
    + return this.getParentOrDummyTable().cloneWithCleanColumnNames()
    + }
    + }
    +
    + class columnsSetTypeNode extends abstractTransformerNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + get primitiveTypeCell() {
    + return this.getWord(2)
    + }
    + _createOutputTable() {
    + const colToChange = this.getWord(1)
    + const newType = this.getWord(2)
    + return this.getParentOrDummyTable().changeColumnType(colToChange, newType)
    + }
    + }
    +
    + class dataSynthNode extends abstractTransformerNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { schema: schemaNode }), undefined)
    + }
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get intCell() {
    + return parseInt(this.getWord(1))
    + }
    + get schemaSimpleCell() {
    + return this.getWordsFrom(2)
    + }
    + _createOutputTable() {
    + const schema = this._getSchema()
    + const table = !schema ? this.getParentOrDummyTable() : new Table([], schema)
    + return table.synthesizeTable(this.intCell || 30, Date.now())
    + }
    + _getSchema() {
    + const schema = this.getNode("schema")
    + if (schema) return schema.toJTableColumnDefinitionMap()
    + const words = this.getWordsFrom(2)
    + if (words.length)
    + return words.map((word) => {
    + const parts = word.split(":")
    + return {
    + name: parts[0],
    + type: parts[1],
    + }
    + })
    + }
    + }
    +
    + class dataAboutNode extends abstractTransformerNode {
    + _getDataSetInfo() {
    + const parentTile = this.getParent()
    + const def = parentTile.getDefinition()
    + return {
    + licenseSpecified: parentTile.isDataPublicDomain,
    + tags: def.get("tags"),
    + overviewDescription: parentTile.dataDescription || def.get("description"),
    + dataUrl: parentTile.dataUrl,
    + }
    + }
    + _createOutputTable() {
    + return new Table([this._getDataSetInfo()])
    + }
    + }
    +
    + class dataUsabilityScoreNode extends dataAboutNode {
    + _createOutputTable() {
    + const row = this._getDataSetInfo()
    + // todo: a very simplistic approximation of Kaggle's data usability score
    + row.score = Object.values(row).filter((item) => !!item).length * 2.5
    + return new Table([row])
    + }
    + }
    +
    + class fillMissingNode extends abstractTransformerNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + get anyCell() {
    + return this.getWord(2)
    + }
    + _createOutputTable() {
    + return this.getParentOrDummyTable().fillMissing(this.getWord(1), this.getWord(2))
    + }
    + }
    +
    + class genRangeNode extends abstractTransformerNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get newColumnNameCell() {
    + return this.getWord(1)
    + }
    + get minCell() {
    + return parseFloat(this.getWord(2))
    + }
    + get maxCell() {
    + return parseFloat(this.getWord(3))
    + }
    + get stepCell() {
    + return parseFloat(this.getWord(4))
    + }
    + _createOutputTable() {
    + const rows = []
    + // todo: protect against infinite loops
    + let currentValue = this.minCell
    + if (!this.stepCell) throw new Error("Step cannot be zero.")
    + while (currentValue <= this.maxCell) {
    + const row = []
    + row[this.newColumnNameCell] = currentValue
    + rows.push(row)
    + currentValue += this.stepCell
    + }
    + return new Table(rows)
    + }
    + }
    +
    + class groupByNode extends abstractTransformerNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), { reduce: reduceNode }), undefined)
    + }
    + get columnNameCell() {
    + return this.getWordsFrom(0)
    + }
    + get placeholderMessage() {
    + return `Enter the column to groupby.`
    + }
    + _createOutputTable() {
    + const groupByColNames = this.getWordsFrom(1)
    + if (!groupByColNames.length) return this.getParentOrDummyTable().clone()
    + const newCols = this.findNodes("reduce").map((reduceNode) => {
    + return {
    + source: reduceNode.getWord(1),
    + reduction: reduceNode.getWord(2),
    + name: reduceNode.getWord(3) || reduceNode.getWordsFrom(1).join("_"),
    + }
    + })
    + return this.getParentOrDummyTable().makePivotTable(groupByColNames, newCols)
    + }
    + }
    +
    + class rowsSortByNode extends abstractTransformerNode {
    + get columnNameCell() {
    + return this.getWordsFrom(0)
    + }
    + get placeholderMessage() {
    + return `Columns you want to sort by`
    + }
    + _createOutputTable() {
    + const table = this.getParentOrDummyTable().sortBy(this.getWordsFrom(1))
    + if (this.getFirstWord().includes("Reverse")) return table.reverseRows()
    + return table
    + }
    + }
    +
    + class rowsSortByReverseNode extends rowsSortByNode {}
    +
    + class rowsAddOneNode extends abstractTransformerNode {
    + get anyCell() {
    + return this.getWordsFrom(0)
    + }
    + _createOutputTable() {
    + return this.getParentOrDummyTable().addRow(this.getWordsFrom(1))
    + }
    + }
    +
    + class textMatchesNode extends abstractTransformerNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get anyCell() {
    + return this.getWordsFrom(1)
    + }
    + _createOutputTable() {
    + return new Table([{ count: this.getPipishInput().match(new RegExp(this.getContent(), "g")).length }])
    + }
    + }
    +
    + class textCombineNode extends abstractTransformerNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + _createOutputTable() {
    + // todo: cleanup
    + const text = this.getParentOrDummyTable()
    + .getRows()
    + .map((row) => row.getRowOriginalValue(this.columnNameCell))
    + .join("\n")
    + return new Table([{ text }])
    + }
    + }
    +
    + class dataInlineNode extends abstractProviderNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + undefined,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    + parser: parserNode,
    + treeLanguage: treeLanguageNode,
    + content: contentNode,
    + }),
    + undefined
    + )
    + }
    + get bodyStumpTemplate() {
    + return `textarea
    + name content
    + changeCommand changeTileSettingMultilineCommand
    + placeholder Enter data in any format here. It will be saved directly in your document.
    + class TileTextArea savable
    + bern
    + {text}`
    + }
    + getDataContent() {
    + const node = this.getNode("content")
    + return node ? node.childrenToString() : ""
    + }
    + getTileBodyStumpCode() {
    + const text = lodash.escape(this.getDataContent())
    + return this.qFormat(this.bodyStumpTemplate, { text })
    + }
    + getRowClass() {
    + class InlineDataTileRow extends Row {}
    + return InlineDataTileRow
    + }
    + getParserId() {
    + return super.getParserId() || new TableParser().guessTableParserId(this.getDataContent())
    + }
    + async fetchTableInputs() {
    + return new TableParser().parseTableInputsFromString(this.getDataContent(), this.getParserId())
    + }
    + }
    +
    + class dataLocalStorageNode extends dataInlineNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get localStorageKeyCell() {
    + return this.getWord(1)
    + }
    + get bodyStumpTemplate() {
    + return `textarea
    + changeCommand triggerTileMethodCommand
    + placeholder Enter data in any format here. It will be saved in your browser's localStorage.
    + name storeValueCommand
    + class TileTextArea savable
    + bern
    + {text}`
    + }
    + // Note: for now, only way to clear a key is to do it manually through UI (select all delete) or console. That might be good enough.
    + _getStoreKey() {
    + return this.getContent()
    + }
    + getDataContent() {
    + const key = this._getStoreKey()
    + return key ? this.getWebApp().getFromStore(key) || "" : ""
    + }
    + storeValueCommand(value) {
    + let key = this._getStoreKey()
    + if (key) this.getWebApp().storeValue(key, value)
    + else this.setContent(this.getWebApp().initLocalDataStorage(this.constructor.name + ".data", value))
    + }
    + getTileBodyStumpCode() {
    + const text = lodash.escape(this.getDataContent())
    + return this.qFormat(this.bodyStumpTemplate, { text })
    + }
    + }
    +
    + class debugParserTestNode extends abstractProviderNode {
    + async fetchTableInputs() {
    + const parentTile = this.getParent()
    + if (parentTile.getWillowHttpResponse) {
    + const probs = new TableParser().guessProbabilitiesForAllTableParsers(parentTile.getWillowHttpResponse().text)
    + return {
    + rows: Object.keys(probs).map((key) => {
    + return {
    + parser: key,
    + probability: probs[key],
    + }
    + }),
    + }
    + }
    + return [{ rows: [] }]
    + }
    + }
    +
    + class debugGrammarNode extends abstractProviderNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + async fetchTableInputs() {
    + return { rows: [{ text: new ohayoNode("").getHandGrammarProgram().toString() }] }
    + }
    + }
    +
    + class debugGrammarTreeNode extends abstractProviderNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + async fetchTableInputs() {
    + return {
    + rows: [
    + {
    + text: new ohayoNode("").getHandGrammarProgram().getNodeTypeFamilyTree().toString(),
    + },
    + ],
    + }
    + }
    + }
    +
    + class editorFilesNode extends abstractProviderNode {
    + get tileSize() {
    + return `140 120`
    + }
    + getRowClass() {
    + // todo: remove?
    + class FileRow extends Row {
    + destroyRow(app) {
    + return app.deleteFileCommand(this.getRowOriginalValue("link"))
    + }
    + }
    + return FileRow
    + }
    + async fetchTableInputs() {
    + const files = await this.getWebApp().getDefaultDisk().readFiles()
    + return { rows: files.map((file) => file.toFileObject()) }
    + }
    + }
    +
    + class editorCommandHistoryNode extends abstractProviderNode {
    + get methodName() {
    + return `getCommandsBuffer`
    + }
    + async fetchTableInputs() {
    + return { rows: this.getWebApp()[this.methodName]() }
    + }
    + }
    +
    + class mathGenNode extends abstractProviderNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get mathFunctionNameCell() {
    + return this.getWord(1)
    + }
    + get fromCell() {
    + return parseFloat(this.getWord(2))
    + }
    + get toCell() {
    + return parseFloat(this.getWord(3))
    + }
    + get incrementCell() {
    + return parseFloat(this.getWord(4))
    + }
    + async fetchTableInputs() {
    + const rows = []
    + const fn = Math[this.getWord(1)]
    + for (let input = parseFloat(this.fromCell); input < parseFloat(this.toCell); input += parseFloat(this.incrementCell)) {
    + rows.push({ input, output: fn(input) })
    + }
    + return {
    + rows,
    + }
    + }
    + }
    +
    + class abstractRandomTileNode extends abstractProviderNode {
    + async fetchTableInputs() {
    + let howMany = this.quantityCell || 30
    + const rows = []
    + for (let index = 1; index <= howMany; index++) {
    + rows.push(this._genRow(index))
    + }
    + return { rows }
    + }
    + }
    +
    + class randomFloatNode extends abstractRandomTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get quantityCell() {
    + return parseInt(this.getWord(1))
    + }
    + get minCell() {
    + return parseFloat(this.getWord(2))
    + }
    + get maxCell() {
    + return parseFloat(this.getWord(3))
    + }
    + get max() {
    + return 1
    + }
    + get min() {
    + return 0
    + }
    + _genRow(index) {
    + return { index, number: jtree.Utils.randomUniformFloat(this.minCell, this.maxCell, Math.random()) }
    + }
    + }
    +
    + class randomIntNode extends abstractRandomTileNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get quantityCell() {
    + return parseInt(this.getWord(1))
    + }
    + get minCell() {
    + return parseFloat(this.getWord(2))
    + }
    + get maxCell() {
    + return parseFloat(this.getWord(3))
    + }
    + get max() {
    + return 100
    + }
    + get min() {
    + return 0
    + }
    + _genRow(index) {
    + return { index, number: jtree.Utils.randomUniformInt(this.minCell, this.maxCell, Math.random()) }
    + }
    + }
    +
    + class samplesTinyIrisNode extends abstractProviderNode {
    + get bodyStumpTemplate() {
    + return `pre
    + class TileSelectable
    + style overflow: scroll; max-height: 100%;
    + bern
    + {text}`
    + }
    + get data() {
    + return `petal_length,petal_width,species
    + 4.9,1.8,virginica
    + 4.2,1.3,versicolor
    + 4.9,2,virginica
    + 1.5,0.2,setosa`
    + }
    + get isDataPublicDomain() {
    + return true
    + }
    + getDataContent() {
    + return this.data
    + }
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, { text: this.getDataContent() })
    + }
    + getParserId() {
    + return super.getParserId() || new TableParser().guessTableParserId(this.getDataContent())
    + }
    + async fetchTableInputs() {
    + return new TableParser().parseTableInputsFromString(this.getDataContent(), this.getParserId())
    + }
    + }
    +
    + class assertRowCountNode extends abstractTileTreeComponentNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get intCell() {
    + return parseInt(this.getWord(1))
    + }
    + get visible() {
    + return false
    + }
    + async execute() {
    + const num = this.getWord(1)
    + if (!num) return super.execute()
    + const expected = parseInt(num)
    + const actual = this.getParentOrDummyTable().getRowCount()
    + if (actual !== expected) throw new Error(`Expected ${expected} but got ${actual}`)
    + return super.execute()
    + }
    + }
    +
    + class printNode extends abstractTileTreeComponentNode {
    + execute() {
    + console.log(this._getMessage())
    + }
    + _getMessage() {
    + return this.getPipishInput()
    + }
    + }
    +
    + class printCsvNode extends printNode {
    + _getMessage() {
    + return this.getParentOrDummyTable().toDelimited(",")
    + }
    + }
    +
    + class abstractTileSettingNode extends jtree.GrammarBackedNode {
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + }
    +
    + class abstractTileSettingTerminalNode extends abstractTileSettingNode {
    + getSettingValue() {
    + return this.getContent()
    + }
    + }
    +
    + class abstractColumnNode extends abstractTileSettingTerminalNode {
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + getRunTimeEnumOptions(cell) {
    + // todo: only works if codemirror === tab
    + try {
    + // todo: handle at static time.
    + const mirrorNode = typeof app === "undefined" ? this : app.mountedProgram.nodeAtLine(this.getLineNumber() - 1)
    + const mirrorParent = mirrorNode && mirrorNode.getParent()
    + if (cell.getCellTypeId() === "columnNameCell" && mirrorParent && mirrorParent.isLoaded()) {
    + const options = mirrorParent.getParentOrDummyTable().getColumnNames()
    + return options
    + }
    + } catch (err) {
    + console.log(err)
    + }
    + }
    + }
    +
    + class columnNode extends abstractColumnNode {}
    +
    + class sourceColumnNode extends abstractColumnNode {}
    +
    + class labelNode extends abstractColumnNode {}
    +
    + class linkNode extends abstractColumnNode {}
    +
    + class sizeColumnNode extends abstractColumnNode {}
    +
    + class colorColumnNode extends abstractColumnNode {}
    +
    + class shapeColumnNode extends abstractColumnNode {}
    +
    + class valueNode extends abstractColumnNode {}
    +
    + class countNode extends abstractColumnNode {}
    +
    + class dayColumnNode extends abstractColumnNode {}
    +
    + class xColumnNode extends abstractColumnNode {}
    +
    + class yColumnNode extends abstractColumnNode {}
    +
    + class genderColumnNode extends abstractColumnNode {}
    +
    + class headSizeNode extends abstractColumnNode {}
    +
    + class radiusNode extends abstractColumnNode {}
    +
    + class emojiColumnNode extends abstractColumnNode {}
    +
    + class parserNode extends abstractTileSettingTerminalNode {
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + get parserIdsCell() {
    + return this.getWord(1)
    + }
    + }
    +
    + class useCacheNode extends abstractTileSettingTerminalNode {
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + get booleanCell() {
    + return this.getWord(1)
    + }
    + }
    +
    + class reductionNode extends abstractTileSettingTerminalNode {
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + get reductionTypeCell() {
    + return this.getWord(1)
    + }
    + }
    +
    + class abstractCoreTileSettingTerminalNode extends abstractTileSettingTerminalNode {}
    +
    + class hiddenNode extends abstractCoreTileSettingTerminalNode {}
    +
    + class visibleNode extends abstractCoreTileSettingTerminalNode {}
    +
    + class maximizedNode extends abstractCoreTileSettingTerminalNode {}
    +
    + class abstractPagePositionNode extends abstractCoreTileSettingTerminalNode {
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + get intCell() {
    + return parseInt(this.getWord(1))
    + }
    + }
    +
    + class leftNode extends abstractPagePositionNode {}
    +
    + class topNode extends abstractPagePositionNode {}
    +
    + class widthNode extends abstractPagePositionNode {}
    +
    + class heightNode extends abstractPagePositionNode {}
    +
    + class reduceNode extends abstractTileSettingTerminalNode {
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + get columnNameCell() {
    + return this.getWord(1)
    + }
    + get reductionTypeCell() {
    + return this.getWord(2)
    + }
    + get newColumnNameCell() {
    + return this.getWord(3)
    + }
    + }
    +
    + class styleNode extends abstractTileSettingTerminalNode {}
    +
    + class columnLimitNode extends abstractTileSettingTerminalNode {
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + get intCell() {
    + return parseInt(this.getWord(1))
    + }
    + }
    +
    + class howManyNode extends abstractTileSettingTerminalNode {
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + get quantityCell() {
    + return parseInt(this.getWord(1))
    + }
    + }
    +
    + class sizeNode extends abstractTileSettingTerminalNode {
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + get numberCell() {
    + return parseFloat(this.getWord(1))
    + }
    + }
    +
    + class rowDisplayLimitNode extends abstractTileSettingTerminalNode {
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + get intCell() {
    + return parseInt(this.getWord(1))
    + }
    + }
    +
    + class srcNode extends abstractTileSettingTerminalNode {
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + get urlCell() {
    + return this.getWord(1)
    + }
    + }
    +
    + class roughnessNode extends abstractTileSettingTerminalNode {
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + get roughnessCell() {
    + return parseInt(this.getWord(1))
    + }
    + }
    +
    + class colorsNode extends abstractTileSettingTerminalNode {
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + get anyCell() {
    + return this.getWordsFrom(1)
    + }
    + }
    +
    + class cameraPositionNode extends abstractTileSettingTerminalNode {
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + get cameraDistanceNumberCell() {
    + return parseFloat(this.getWord(1))
    + }
    + get horizontalNumberCell() {
    + return parseFloat(this.getWord(2))
    + }
    + get verticalNumberCell() {
    + return parseFloat(this.getWord(3))
    + }
    + }
    +
    + class treeLanguageNode extends abstractTileSettingTerminalNode {
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + get supportedTreeLanguageCell() {
    + return this.getWord(1)
    + }
    + }
    +
    + class abstractTileSettingNonTerminalNode extends abstractTileSettingNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(tileSettingNonTerminalContentNode, undefined, undefined)
    + }
    + getSettingValue() {
    + return this.childrenToString()
    + }
    + }
    +
    + class contentNode extends abstractTileSettingNonTerminalNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(lineOfContentNode, undefined, undefined)
    + }
    + }
    +
    + class catchAllNodesPostContentNode extends abstractTileSettingNonTerminalNode {
    + get anyCell() {
    + return this.getWordsFrom(0)
    + }
    + }
    +
    + class postNode extends abstractTileSettingNonTerminalNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(catchAllNodesPostContentNode, undefined, undefined)
    + }
    + }
    +
    + class abstractDocSettingNode extends jtree.GrammarBackedNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get visible() {
    + return false
    + }
    + }
    +
    + class docCategoriesNode extends abstractDocSettingNode {
    + get documentCategoryCell() {
    + return this.getWordsFrom(0)
    + }
    + }
    +
    + class docAuthorNode extends abstractDocSettingNode {
    + get stringCell() {
    + return this.getWordsFrom(0)
    + }
    + }
    +
    + class docDateNode extends abstractDocSettingNode {
    + get dateCell() {
    + return this.getWordsFrom(0)
    + }
    + }
    +
    + class abstractDocSectionComponentNode extends jtree.GrammarBackedNode {}
    +
    + class docSectionSubtitleNode extends abstractDocSectionComponentNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get stringCell() {
    + return this.getWordsFrom(1)
    + }
    + compile() {
    + return `h2 ${this.getContent()}`
    + }
    + }
    +
    + class docSectionParagraphNode extends abstractDocSectionComponentNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(docParagraphLineNode, undefined, undefined)
    + }
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get stringCell() {
    + return this.getWordsFrom(1)
    + }
    + get stumpTemplate() {
    + return `p
    + bern
    + {content}`
    + }
    + compile() {
    + return new jtree.TreeNode(this.stumpTemplate).templateToString({ content: this.getContentWithChildren() })
    + }
    + }
    +
    + class docSectionLinkNode extends abstractDocSectionComponentNode {
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get urlCell() {
    + return this.getWord(1)
    + }
    + get stringCell() {
    + return this.getWordsFrom(2)
    + }
    + get stumpTemplate() {
    + return `a {content}
    + href {url}`
    + }
    + compile() {
    + return new jtree.TreeNode(this.stumpTemplate).templateToString({ content: this.getWordsFrom(2).join(" "), url: this.getWord(1) })
    + }
    + }
    +
    + class docSectionCodeNode extends abstractDocSectionComponentNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(docLineOfCodeNode, undefined, undefined)
    + }
    + get tileKeywordCell() {
    + return this.getWord(0)
    + }
    + get programmingLanguageNameCell() {
    + return this.getWord(1)
    + }
    + get stumpTemplate() {
    + return `code
    + bern
    + {content}`
    + }
    + compile() {
    + return new jtree.TreeNode(this.stumpTemplate).templateToString({ content: this.childrenToString().replace(/
    + }
    + }
    +
    + class docLineOfCodeNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(docLineOfCodeNode, undefined, undefined)
    + }
    + get codeCell() {
    + return this.getWordsFrom(0)
    + }
    + }
    +
    + class docParagraphLineNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(docParagraphLineNode, undefined, undefined)
    + }
    + get stringCell() {
    + return this.getWordsFrom(0)
    + }
    + }
    +
    + class commentLineNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(commentLineNode, undefined, undefined)
    + }
    + get commentCell() {
    + return this.getWordsFrom(0)
    + }
    + }
    +
    + class docReferenceUrlNode extends jtree.GrammarBackedNode {
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + get urlCell() {
    + return this.getWord(1)
    + }
    + }
    +
    + class catchAllErrorNode extends jtree.GrammarBackedNode {
    + getErrors() {
    + return this._getErrorNodeErrors()
    + }
    + get errorCell() {
    + return this.getWordsFrom(0)
    + }
    + }
    +
    + class hashBangNode extends jtree.GrammarBackedNode {
    + get hashBangWordCell() {
    + return this.getWordsFrom(0)
    + }
    + }
    +
    + class ohayoNode extends AbstractTreeComponent {
    + createParser() {
    + return new jtree.TreeNode.Parser(
    + DidYouMeanTileNode,
    + Object.assign(Object.assign({}, super.createParser()._getFirstWordMapAsObject()), {
    + "amazon.history": amazonHistoryNode,
    + "fitbit.all": fitbitAllNode,
    + "datawrapper.comingSoon": datawrapperComingSoonNode,
    + "dcjs.comingSoon": dcjsComingSoonNode,
    + "finos.perspective.comingSoon": finosPerspectiveComingSoonNode,
    + "fivethirtyeight.comingSoon": fivethirtyeightComingSoonNode,
    + "gov.comingSoon": GovNode,
    + "highcharts.comingSoon": highchartsComingSoonNode,
    + "re3data.comingSoon": re3dataComingSoonNode,
    + "zing.comingSoon": zingComingSoonNode,
    + "editor.helloWorld": editorHelloWorldNode,
    + "challenge.list": challengeListNode,
    + "samples.list": samplesListNode,
    + "vega.data.list": vegaDataListNode,
    + "vega.example.list": vegaExampleListNode,
    + "doc.picker": PickerTileNode,
    + "templates.list": templatesListNode,
    + "asciichart.line": asciiChartNode,
    + "calendar.heat": calendarHeatNode,
    + "challenge.play": challengePlayNode,
    + "debug.dump": debugDumpNode,
    + "web.dump": webDumpNode,
    + "debug.commands": debugCommandsNode,
    + "debug.sleep": debugSleepNode,
    + "debug.noop": debugNoOpNode,
    + "debug.throw": debugThrowNode,
    + "dtjs.basic": dtjsBasicNode,
    + "editor.gallery": editorGalleryNode,
    + "handsontable.basic": handsontableBasicNode,
    + "html.text": htmlTextNode,
    + "html.printAs": htmlPrintAsNode,
    + "html.h1": htmlH1Node,
    + "html.img": htmlImgNode,
    + "html.iframe": htmlIframeNode,
    + "html.custom": htmlCustomNode,
    + "icons.human": iconsHumanNode,
    + "icons.circle": iconsCircleNode,
    + "list.basic": listBasicNode,
    + "list.links": listLinksNode,
    + "markdown.toHtml": markdownToHtmlNode,
    + "roughjs.bar": roughJsBarNode,
    + "roughjs.pie": roughJsPieNode,
    + "roughjs.line": roughJsLineNode,
    + "show.rowCount": showRowCountNode,
    + "show.columnCount": showColumnCountNode,
    + "show.static": showStaticNode,
    + "show.value": showValueNode,
    + "show.median": showMedianNode,
    + "show.sum": showSumNode,
    + "show.mean": showMeanNode,
    + "show.min": showMinNode,
    + "show.max": showMaxNode,
    + "tables.basic": tablesBasicNode,
    + "tables.interesting": tablesInterestingNode,
    + "tables.dump": tablesDumpNode,
    + "text.wordcloud": textWordcloudNode,
    + "treenotation.3d": treenotation3dNode,
    + "treenotation.outline": treenotationOutlineNode,
    + "treenotation.dotline": treenotationDotlineNode,
    + "vega.bar": vegaBarNode,
    + "vega.line": vegaLineNode,
    + "vega.area": vegaAreaNode,
    + "vega.scatter": vegaScatterNode,
    + "vega.bubble": vegaBubbleNode,
    + "vega.emoji": vegaEmojiNode,
    + "vega.histogram": vegaHistogramNode,
    + "vega.example": vegaExampleNode,
    + "tiles.didyoumean": DidYouMeanTileNode,
    + "doc.title": docTitleNode,
    + "doc.subtitle": docSubtitleNode,
    + "doc.section": docSectionNode,
    + "doc.ref": docReferenceNode,
    + "doc.comment": docCommentNode,
    + "doc.tooling": docToolingNode,
    + "github.info": githubInfoNode,
    + "disk.browse": diskBrowseNode,
    + "disk.read": diskReadNode,
    + "hackernews.top": hackernewsTopNode,
    + "hackernews.submissions": hackernewsSubmissionsNode,
    + "publicapis.entries": publicApisNode,
    + "web.get": webGetNode,
    + "web.post": webPostNode,
    + "wikipedia.page": wikipediaContentNode,
    + "cancer.cases": cancerCasesNode,
    + "cdc.infants.weight": weightPercentilesNode,
    + "cdc.infants.length": lengthPercentilesNode,
    + "cdc.infants.headCircumference": headPercentilesNode,
    + "kaggle.datasets.heart": kaggleDatasetsHeartNode,
    + "moz.top500": mozTop500Node,
    + "owid.lifeExpectancy": lifeExpectancyNode,
    + "owid.list": owidListNode,
    + "samples.telescopes": samplesTelescopesNode,
    + "samples.mtcars": samplesMtcarsNode,
    + "samples.iris": samplesIrisNode,
    + "samples.flights14": samplesFlights14Node,
    + "samples.si": samplesSiNode,
    + "samples.portals": samplesPortalNode,
    + "samples.starWars": samplesStarWarsNode,
    + "samples.populations": samplesPopulationsNode,
    + "samples.babyNames": samplesBabyNamesNode,
    + "samples.declaration": samplesDeclarationNode,
    + "samples.periodicTable": samplesPeriodicTableNode,
    + "samples.letters": samplesLettersNode,
    + "samples.presidents": samplesPresidentsNode,
    + "ucimlr.datasets": ucimlrDatasetsNode,
    + "vega.data": vegaDataNode,
    + "reddit.all": redditAllNode,
    + "reddit.subs": redditSubsNode,
    + "reddit.sub": redditSubNode,
    + "samples.patients": samplesPatientsNode,
    + "samples.poem": samplesPoemNode,
    + "samples.outerSpace": samplesOuterSpaceNode,
    + "samples.treeProgram": samplesTreeProgramNode,
    + "samples.waterBill": samplesWaterBillNode,
    + "samples.gapMinder": samplesGapMinderNode,
    + "date.addColumns": dateAddColumnsNode,
    + "gen.constant": genConstantNode,
    + "gen.growth": genGrowthNode,
    + "math.log": mathLogNode,
    + "rows.addIndexColumn": rowsAddIndexColumnNode,
    + "rows.runningTotal": rowsRunningTotalNode,
    + "text.length": textLengthNode,
    + "text.split": textSplitNode,
    + "text.reverseSplit": reverseTextSplitNode,
    + "text.toLowerCase": textToLowerCaseNode,
    + "text.template": textTemplateNode,
    + "text.permalink": textPermalinkNode,
    + "text.replace": textReplaceNode,
    + "text.trim": textTrimNode,
    + "text.substring": textSubstringNode,
    + "text.firstLetter": testFirstLetterNode,
    + "columns.describe": columnsDescribeNode,
    + "columns.list": columnsListNode,
    + "data.eval": dataEvalNode,
    + "join.by": joinByNode,
    + "match.columnsFuzzy": matchColumnsFuzzyNode,
    + "schema.toTypescript": schemaTypeScriptNode,
    + "schema.toSimple": schemaSimpleNode,
    + "text.wordCount": textWordCountNode,
    + "text.lineCount": textLineCountNode,
    + "treenotation.wordTypes": treenotationWordTypesNode,
    + "columns.first": columnsFirstNode,
    + "columns.last": columnsLastNode,
    + "columns.drop": columnsDropNode,
    + "columns.dropConstants": columnsDropConstantsNode,
    + "columns.keep": columnsKeepNode,
    + "columns.keepNumerics": columnsKeepNumericsNode,
    + "rows.shuffle": rowsShuffleNode,
    + "rows.reverse": rowsReverseNode,
    + "filter.where": filterWhereNode,
    + "filter.with": filterWithNode,
    + "filter.without": filterWithoutNode,
    + "filter.withAny": filterAnyNode,
    + "rows.first": rowsFirstNode,
    + "rows.sample": rowsSampleNode,
    + "rows.dropIfMissing": rowsDropIfMissingNode,
    + "rows.last": rowsLastNode,
    + "bitanath.pca": pcaNode,
    + "columns.rename": columnsRenameNode,
    + "columns.cleanNames": columnsCleanNamesNode,
    + "columns.setType": columnsSetTypeNode,
    + "data.synth": dataSynthNode,
    + "data.about": dataAboutNode,
    + "data.usabilityScore": dataUsabilityScoreNode,
    + "fill.missing": fillMissingNode,
    + "gen.range": genRangeNode,
    + "group.by": groupByNode,
    + "rows.sortBy": rowsSortByNode,
    + "rows.sortByReverse": rowsSortByReverseNode,
    + "rows.addOne": rowsAddOneNode,
    + "text.matches": textMatchesNode,
    + "text.combine": textCombineNode,
    + "data.inline": dataInlineNode,
    + "data.localStorage": dataLocalStorageNode,
    + "debug.parserTest": debugParserTestNode,
    + "debug.ohayoGrammar": debugGrammarNode,
    + "debug.ohayoGrammarTree": debugGrammarTreeNode,
    + "editor.files": editorFilesNode,
    + "editor.commandHistory": editorCommandHistoryNode,
    + "math.gen": mathGenNode,
    + "random.float": randomFloatNode,
    + "random.int": randomIntNode,
    + "samples.tinyIris": samplesTinyIrisNode,
    + "assert.rowCount": assertRowCountNode,
    + "print.text": printNode,
    + "print.csv": printCsvNode,
    + "doc.categories": docCategoriesNode,
    + "doc.author": docAuthorNode,
    + "doc.date": docDateNode,
    + "#!": hashBangNode,
    + }),
    + [{ regex: /^$/, nodeConstructor: tileBlankLineNode }]
    + )
    + }
    + getTileClosestToLine(lineIndex) {
    + let current = this.nodeAtLine(lineIndex)
    + while (current) {
    + if (current.doesExtend("abstractTileTreeComponentNode")) return current
    + current = current.getParent()
    + }
    + }
    + setTab(tab) {
    + this._tab = tab
    + }
    + getTheme() {
    + const tab = this.getTab()
    + return tab ? tab.getTheme() : super.getTheme()
    + }
    + getTab() {
    + return this._tab
    + }
    + async loadAndIncrementalRender() {
    + const app = this.getTab().getRootNode()
    + await Promise.all(this.getTiles().map((tile) => tile.loadBrowserRequirements()))
    + await Promise.all(
    + this.getRootLevelTiles().map(async (tile) => {
    + await tile.execute()
    + app.renderApp()
    + })
    + )
    + app.renderApp() // this one might be superfluous
    + return this
    + }
    + getTiles() {
    + return this.getTopDownArray().filter((node) => node.doesExtend("abstractTileTreeComponentNode"))
    + }
    + getRootLevelTiles() {
    + return this.filter((node) => node.doesExtend("abstractTileTreeComponentNode"))
    + }
    + _getProjectRootDir() {
    + return this.isNodeJs() ? jtree.Utils.findProjectRoot(__dirname, "ohayo") : ""
    + }
    + toRunTimeStats() {
    + const tiles = this.getTiles()
    + const stats = {
    + tiles: tiles.length,
    + treeLanguage: this.getHandGrammarProgram().getExtensionName(),
    + url: this.getTab().getFileName(),
    + }
    + stats.timeToLoad = this.getTiles()
    + .map((tile) => tile.getTimeToLoad())
    + .sort()
    + .reverse()[0]
    + stats.timeToRender = this.getTiles()
    + .map((tile) => tile.getNewestTimeToRender())
    + .sort()
    + .reverse()[0]
    + return stats
    + }
    + async execute() {
    + await Promise.all(this.map((node) => node.execute()))
    + // Use shell tiles to do any outputs
    + }
    + _getProgramRowCount() {
    + return this.getAllRowsFromAllOutputTables().reduce((acc, curr) => acc + curr.length, 0)
    + }
    + getOutputOrInputTable() {
    + // todo: remove this?
    + if (!this._outputTable) this._outputTable = new Table()
    + return this._outputTable
    + }
    + getRowsFromLastTable() {
    + const tiles = this.getTopDownArray()
    + return tiles[tiles.length - 1].getOutputOrInputTable().getRows()
    + }
    + getAllRowsFromAllOutputTables() {
    + return jtree.Utils.flatten(
    + this.getTiles()
    + .map((tile) => tile.getOutputTable())
    + .filter((table) => table)
    + .map((table) => table.getRows())
    + )
    + }
    + getHandGrammarProgram() {
    + if (!this._cachedHandGrammarProgramRoot)
    + this._cachedHandGrammarProgramRoot = new jtree.HandGrammarProgram(`emptyCell
    + quantityCell
    + extends intCell
    + minCell
    + extends numberCell
    + maxCell
    + extends numberCell
    + stepCell
    + extends numberCell
    + millisecondsCell
    + extends intCell
    + titleCell
    + extends stringCell
    + anyCell
    + todo remove
    + columnNameCell
    + highlightScope entity.other.attribute-name
    + newColumnNameCell
    + highlightScope entity.other.attribute-name
    + newColumnNamesCell
    + description When you are creating new columns.
    + highlightScope entity.other.attribute-name
    + primitiveTypeCell
    + highlightScope constant.numeric
    + description In Ohayo, all columns have a primitive type chosen from one of these. The type affects how the values in the column are understood and displayed. For example, a 0 could be interpretted as a "false", the number 0, or a string "0". Ohayo attempts to choose the correct type, but you can override the default with the columns.setType tile.
    + enum boolean code date day dir feet hour hourMinute html int millisecond minute month monthDay number numberString object path second string text url usd week year
    + programmingLanguageNameCell
    + enum javascript latex css html ruby rust python csv tsv xml php typescript lisp swift java c cpp markdown bash
    + highlightScope constant
    + codeCell
    + highlightScope string
    + documentCategoryCell
    + highlightScope constant
    + enum shopping biology chemistry programming socialMedia math parenting writing dataScience ohayo geography web history wikipedia
    + referenceIdCell
    + highlightScope string
    + commentCell
    + highlightScope comment
    + commentKeywordCell
    + highlightScope comment
    + errorCell
    + highlightScope invalid
    + hashBangWordCell
    + highlightScope comment
    + parserIdsCell
    + description Ohayo has these parsers which convert your raw data to tables.
    + enum csv tsv json treeRows tree ssv xml psv text spaced sections json list txt jsonMap jsonVector jsonCounts jsonDataTableWithHeader
    + highlightScope constant
    + booleanCell
    + enum false true
    + highlightScope constant.numeric
    + pathCell
    + highlightScope constant
    + description A filepath
    + alphanumericCell
    + regex [a-zA-Z0-9]+
    + extraWordCell
    + todo Remove this? It looks like its a standard cell type.
    + highlightScope invalid
    + stringCell
    + highlightScope string
    + urlCell
    + highlightScope constant
    + dateCell
    + highlightScope string
    + intCell
    + regex \\-?[0-9]+
    + numberCell
    + regex \\-?[0-9]*\\.?[0-9]*
    + reductionTypeCell
    + enum count sum mean min max median
    + highlightScope constant
    + tileKeywordCell
    + highlightScope keyword
    + intCell
    + tileSettingKeywordCell
    + highlightScope variable.language
    + challengeIdCell
    + extends intCell
    + challengeAnswerCell
    + extends numberCell
    + localStorageKeyCell
    + schemaSimpleCell
    + highlightScope string
    + examples name:string score:int
    + dateColumnTypeCell
    + enum day month year monthDay
    + highlightScope constant
    + dummyDataSetIdCell
    + enum ohayoPrograms waterBill gapMinder markdown webPages outerSpace wordCounts treeProgram poem playerGoals patients regionalMarkets stockPrice
    + tileEventNameCell
    + enum fetchTableInputs getTileBodyStumpCode treeComponentDidMount treeComponentDidUpdate
    + scalarValueCell
    + highlightScope constant.numeric
    + comparisonCell
    + enum < > <= >= = !=
    + highlightScope constant
    + growthRateCell
    + extends numberCell
    + githubRepoCell
    + extends anyCell
    + hackerNewsUserNameCell
    + highlightScope string
    + htmlTextTagCell
    + enum div pre p h1 h2 h3 h4 h5 h6 code
    + htmlCell
    + highlightScope string
    + needleColumnNameCell
    + extends columnNameCell
    + haystackColumnNameCell
    + extends columnNameCell
    + mathFunctionNameCell
    + enum sin cos tan log exp
    + fromCell
    + extends numberCell
    + toCell
    + extends numberCell
    + incrementCell
    + extends numberCell
    + subredditNameCell
    + roughnessCell
    + extends intCell
    + todo add min of 0 and max of 20
    + delimiterCell
    + startIndexCell
    + extends intCell
    + lengthCell
    + extends intCell
    + supportedTreeLanguageCell
    + enum ohayo
    + cameraDistanceNumberCell
    + extends numberCell
    + horizontalNumberCell
    + extends numberCell
    + verticalNumberCell
    + extends numberCell
    + vegaDataSetCell
    + highlightScope constant.numeric
    + enum 7zip.png airports.csv anscombe.json barley.json birdstrikes.json budget.json budgets.json burtin.json cars.json climate.json co2-concentration.csv countries.json crimea.json descriptions.json disasters.csv driving.json earthquakes.json ffox.png flare-dependencies.json flare.json flights-10k.json flights-200k.json flights-20k.json flights-2k.json flights-3m.csv flights-5k.json flights-airport.csv gapminder-health-income.csv gapminder.json gimp.png github.csv graticule.json income.json iowa-electricity.csv iris.json jobs.json la-riots.csv londonBoroughs.json londonCentroids.json londonTubeLines.json lookup_groups.csv lookup_people.csv miserables.json monarchs.json movies.json normal-2d.json obesity.json points.json population.json population_engineers_hurricanes.csv seattle-temps.csv seattle-weather.csv sf-temps.csv sp500.csv stocks.csv udistrict.json unemployment-across-industries.json unemployment.tsv us-10m.json us-employment.csv us-state-capitals.json weather.csv weather.json weball26.json wheat.json windvectors.csv world-110m.json zipcodes.csv
    + vegaExampleNameCell
    + highlightScope constant.numeric
    + enum airport_connections area area_cumulative_freq area_horizon area_overlay area_temperature_range area_vertical bar bar_1d bar_1d_rangestep_config bar_aggregate bar_aggregate_count bar_aggregate_format bar_aggregate_size bar_aggregate_sort_by_encoding bar_aggregate_sort_mean bar_aggregate_transform bar_aggregate_vertical bar_argmax bar_argmax_transform bar_array_aggregate bar_binned_data bar_color_disabled_scale bar_column_fold bar_custom_sort_full bar_custom_sort_partial bar_distinct bar_diverging_stack_transform bar_filter_calc bar_fit bar_gantt bar_grouped bar_grouped_horizontal bar_layered_transparent bar_layered_weather bar_month bar_month_temporal bar_size_default bar_size_explicit bar_size_explicit_bad bar_size_fit bar_size_rangestep_small bar_sort_by_count bar_swap_axes bar_swap_custom bar_title bar_title_start bar_tooltip bar_tooltip_multi bar_yearmonth bar_yearmonth_custom_format boxplot_1D_horizontal boxplot_1D_horizontal_custom_mark boxplot_1D_horizontal_explicit boxplot_1D_vertical boxplot_2D_horizontal boxplot_2D_horizontal_color_size boxplot_2D_vertical boxplot_minmax_2D_horizontal boxplot_minmax_2D_horizontal_custom_midtick_color boxplot_minmax_2D_vertical boxplot_tooltip_aggregate boxplot_tooltip_not_aggregate brush_table circle circle_binned circle_binned_maxbins_2 circle_binned_maxbins_20 circle_binned_maxbins_5 circle_bubble_health_income circle_flatten circle_github_punchcard circle_natural_disasters circle_opacity circle_scale_quantile circle_scale_quantize circle_scale_threshold concat_bar_layer_circle concat_bar_scales_discretize concat_bar_scales_discretize_2_cols concat_hover concat_hover_filter concat_layer_voyager_result_future concat_marginal_histograms concat_population_pyramid concat_weather connected_scatterplot embedded_csv errorband_2d_horizontal_color_encoding errorband_2d_vertical_borders errorbar_2d_vertical_ticks errorbar_aggregate errorbar_horizontal_aggregate facet_bullet facet_column_facet_column_point_future facet_column_facet_row_point_future facet_cross_independent_scale facet_custom facet_custom_header facet_independent_scale facet_independent_scale_layer_broken facet_row_facet_row_point_future geo_choropleth geo_circle geo_constant_value geo_custom_projection geo_graticule geo_graticule_object geo_layer geo_layer_line_london geo_layer_multi geo_line geo_point geo_repeat geo_rule geo_sphere geo_text geo_trellis hconcat_weather histogram histogram_bin_change histogram_bin_transform histogram_log histogram_no_spacing histogram_ordinal histogram_ordinal_sort interactive_area_brush interactive_bar_select_highlight interactive_brush interactive_concat_layer interactive_dashboard_europe_pop interactive_layered_crossfilter interactive_layered_crossfilter_discrete interactive_multi_line_label interactive_multi_line_tooltip interactive_overview_detail interactive_paintbrush interactive_paintbrush_color interactive_paintbrush_color_nearest interactive_paintbrush_interval interactive_paintbrush_simple_all interactive_paintbrush_simple_none interactive_panzoom_splom interactive_panzoom_vconcat_shared interactive_query_widgets interactive_seattle_weather interactive_splom interactive_stocks_nearest_index isotype_bar_chart isotype_bar_chart_emoji isotype_grid joinaggregate_mean_difference joinaggregate_mean_difference_by_year joinaggregate_percent_of_total joinaggregate_residual_graph layer_bar_annotations layer_bar_labels layer_bar_labels_style layer_bar_line layer_bar_line_union layer_bar_month layer_boxplot_circle layer_candlestick layer_circle_independent_color layer_color_legend_left layer_cumulative_histogram layer_dual_axis layer_falkensee layer_histogram layer_histogram_global_mean layer_line_co2_concentration layer_line_color_rule layer_line_errorband_2d_horizontal_borders_strokedash layer_line_errorband_ci layer_line_errorband_pre_aggregated layer_line_mean_point_raw layer_overlay layer_point_errorbar_1d_horizontal layer_point_errorbar_1d_vertical layer_point_errorbar_2d_horizontal layer_point_errorbar_2d_horizontal_ci layer_point_errorbar_2d_horizontal_color_encoding layer_point_errorbar_2d_horizontal_custom_ticks layer_point_errorbar_2d_horizontal_iqr layer_point_errorbar_2d_horizontal_stdev layer_point_errorbar_2d_vertical layer_point_errorbar_ci layer_point_errorbar_pre_aggregated_asymmetric_error layer_point_errorbar_pre_aggregated_symmetric_error layer_point_errorbar_pre_aggregated_upper_lower layer_point_errorbar_stdev layer_precipitation_mean layer_ranged_dot layer_rect_extent layer_scatter_errorband_1D_stdev_global_mean layer_scatter_errorband_1d_stdev layer_single_color layer_text_heatmap line line_calculate line_color line_color_binned line_detail line_encoding_impute_keyvals line_encoding_impute_keyvals_sequence line_impute_frame line_impute_keyvals line_impute_method line_impute_transform_frame line_impute_transform_value line_impute_value line_inside_domain_using_clip line_inside_domain_using_transform line_max_year line_mean_month line_mean_year line_monotone line_month line_outside_domain line_overlay line_overlay_stroked line_quarter_legend line_shape_overlay line_skip_invalid line_skip_invalid_mid line_skip_invalid_mid_cap_square line_skip_invalid_mid_overlay line_slope line_step line_timeunit_transform lookup parallel_coordinate point_1d point_1d_array point_2d point_2d_aggregate point_2d_array point_2d_array_named point_2d_tooltip_data point_aggregate_detail point_background point_binned_color point_binned_opacity point_binned_size point_bubble point_color point_color_custom point_color_ordinal point_color_quantitative point_color_shape_constant point_color_with_shape point_colorramp_size point_diverging_color point_dot_timeunit_color point_filled point_href point_invalid_color point_log point_no_axis_domain_grid point_ordinal_color point_overlap point_shape_custom point_tooltip rect_binned_heatmap rect_heatmap rect_heatmap_weather rect_lasagna_future rect_mosaic_labelled rect_mosaic_labelled_with_offset rect_mosaic_simple repeat_histogram repeat_histogram_flights repeat_independent_colors repeat_layer repeat_line_weather repeat_splom_cars repeat_splom_iris rule_color_mean rule_extent sample_scatterplot selection_bind_cylyr selection_bind_origin selection_brush_timeunit selection_clear_brush selection_composition_and selection_composition_or selection_concat selection_filter selection_filter_composition selection_heatmap selection_insert selection_interval_mark_style selection_layer_bar_month selection_multi_condition selection_project_binned_interval selection_project_interval selection_project_interval_x selection_project_interval_x_y selection_project_interval_y selection_project_multi selection_project_multi_cylinders selection_project_multi_cylinders_origin selection_project_multi_origin selection_project_single selection_project_single_cylinders selection_project_single_cylinders_origin selection_project_single_origin selection_resolution_global selection_resolution_intersect selection_resolution_union selection_toggle_altKey selection_toggle_altKey_shiftKey selection_toggle_shiftKey selection_translate_brush_drag selection_translate_brush_shift-drag selection_translate_scatterplot_drag selection_translate_scatterplot_shift-drag selection_type_interval selection_type_interval_invert selection_type_multi selection_type_single selection_type_single_dblclick selection_type_single_mouseover selection_zoom_brush_shift-wheel selection_zoom_brush_wheel selection_zoom_scatterplot_shift-wheel selection_zoom_scatterplot_wheel sequence_line square stacked_area stacked_area_normalize stacked_area_ordinal stacked_area_overlay stacked_area_stream stacked_bar_1d stacked_bar_count stacked_bar_h stacked_bar_h_order stacked_bar_h_order_custom stacked_bar_normalize stacked_bar_population stacked_bar_population_transform stacked_bar_size stacked_bar_sum_opacity stacked_bar_unaggregate stacked_bar_v stacked_bar_weather test_aggregate_nested test_field_with_spaces test_single_point_color test_subobject test_subobject_missing test_subobject_nested text_format text_scatterplot_colored tick_dot tick_dot_thickness tick_sort tick_strip time_output_utc_scale time_output_utc_timeunit time_parse_local time_parse_utc time_parse_utc_format trail_color trellis_anscombe trellis_area trellis_area_sort_array trellis_bar trellis_bar_histogram trellis_bar_histogram_label_rotated trellis_barley trellis_barley_independent trellis_barley_layer_median trellis_column_year trellis_cross_sort trellis_cross_sort_array trellis_line_quarter trellis_row_column trellis_scatter trellis_scatter_binned_row trellis_scatter_small trellis_selections trellis_stacked_bar vconcat_flatten vconcat_weather waterfall_chart wheat_wages window_cumulative_running_average window_percent_of_total window_rank window_top_k window_top_k_others
    + wikipediaPermalinkCell
    + extends anyCell
    + tileBlankLineNode
    + boolean visible false
    + pattern ^$
    + tags doNotSynthesize
    + cells emptyCell
    + abstractTileTreeComponentNode
    + abstract
    + cells tileKeywordCell
    + _extendsJsClass AbstractTreeComponent
    + inScope tileBlankLineNode abstractTileTreeComponentNode abstractCoreTileSettingTerminalNode
    + string settingKey setting
    + string rowDisplayLimitKey rowDisplayLimit
    + string contentKey content
    + string xColumnKey xColumn
    + string yColumnKey yColumn
    + string colorColumnKey colorColumn
    + string shapeColumnKey shapeColumn
    + string sizeColumnKey sizeColumn
    + string columnPredictionHintsKey columnPredictionHints
    + string ohayoFileExtensionKey .ohayo
    + string dayKey day
    + boolean needsData true
    + string monthKey month
    + string yearKey year
    + catchAllNodeType catchAllErrorNode
    + string hiddenKey hidden
    + string visibleKey visible
    + string tileLoadingTemplate
    + div
    + class abstractTileTreeComponentNode
    + id {id}
    + div Loading {name}...
    + class TileBody
    + div
    + class TileFooter
    + {footer}
    + string errorLogMessageStumpTemplate
    + div Error occurred. See console.
    + class OhayoError
    + string pencilStumpTemplate
    + span ➕
    + class TileInsertBetweenButton
    + clickCommand insertTileBetweenCommand
    + span ▼
    + class TileDropDownButton
    + clickCommand toggleTileMenuCommand
    + string errorStateStumpTemplate
    + div
    + class {classes}
    + id {id}
    + div
    + class TileBody
    + div ERROR
    + {content}
    + div
    + class TileFooter
    + {footer}
    + string tileStumpTemplate
    + div
    + class {classes}
    + id {id}
    + div
    + style {bodyStyle}
    + class TileBody
    + {body}
    + div
    + class TileFooter
    + {footer}
    + string inspectionStumpTemplate
    + div TileConstructor: {constructorName} ParentConstructor: {parentConstructorName}
    + div Messages:
    + ol
    + {messages}
    + div Tree:
    + pre
    + bern
    + {sourceCode}
    + div All Tile Settings:
    + pre
    + bern
    + {settings}
    + div Input rows: {inputCount} Output rows: {outputCount}
    + div Load time: {timeToLoad} Render time: {renderTime}
    + div Input Columns:
    + pre
    + bern
    + {inputColumnsAsTable}
    + div Output Columns
    + pre
    + bern
    + {outputColumnsAsTable}
    + div Output Numeric Values:
    + pre
    + bern
    + {outputNumericValues}
    + div TypeScript Interface:
    + pre
    + bern
    + {typeScriptInterface}
    + div Input Numeric Values:
    + pre
    + bern
    + {inputNumericValues}
    + javascript
    + // todo: ADD TYPINGS
    + getPipishInput() {
    + // todo: add placeholder property?
    + return this.getSettingsStruct().content || this.getParentOrDummyTable().getFirstColumnAsString() || ""
    + }
    + getDependencies() {
    + return [{ getLineModifiedTime: () => this.getParentOrDummyTable().getTableCTime() }] // todo: we removed this: this.getOutputOrInputTable().getTableCTime()...i think we had it because we want to return true to update children.
    + }
    + getRunTimeEnumOptions(cell) {
    + // todo: only works if codemirror === tab
    + try {
    + // todo: handle at static time.
    + if (cell.getCellTypeId() === "columnNameCell" && this.isLoaded()) {
    + const mirrorNode = typeof app === "undefined" ? this : app.mountedProgram.nodeAtLine(this.getLineNumber() - 1)
    + return mirrorNode.getParentOrDummyTable().getColumnNames()
    + }
    + } catch (err) {
    + console.log(err)
    + }
    + }
    + mapSettingNamesToColumnNames(settingNames) {
    + const tileStruct = this.getSettingsStruct()
    + return settingNames.map(name => tileStruct[name])
    + }
    + getOutputOrInputTable() {
    + return this._outputTable || this.getParentOrDummyTable()
    + }
    + getOutputTable() {
    + return this._outputTable
    + }
    + getParentOrDummyTable() {
    + // Returns: non-empty input table || dummy table || empty input table.
    + const parentTable = this.getParent().getOutputOrInputTable()
    + if (!parentTable.isBlankTable()) return parentTable
    + return this._getDummyTable() || parentTable
    + }
    + _getDummyTable() {
    + const dataSet = DummyDataSets[this.dummyDataSetName]
    + if (!this._dummyTable && dataSet) this._dummyTable = new Table(jtree.Utils.javascriptTableWithHeaderRowToObjects(dataSet))
    + return this._dummyTable
    + }
    + getRequiredTableWithHeader(headerSettingNames) {
    + const columnNames = this.mapSettingNamesToColumnNames(headerSettingNames)
    + const table = this.getParentOrDummyTable()
    + const columns = columnNames.map(name => table.getTableColumnByName(name))
    + if (columns.some(col => !col)) return []
    + return this.getRowsAsDataTableArrayWithHeader(table.getRows(), columnNames)
    + }
    + setIsDataLoaded(value) {
    + this._isDataLoaded = value
    + this.makeDirty() // todo: remove
    + return this
    + }
    + getRowsAsDataTableArrayWithHeader(rows, header) {
    + const data = rows.map(row => row.getAsArray(header))
    + data.unshift(header)
    + return data
    + }
    + getTileQualityCheck() {
    + const definition = this.getDefinition()
    + const name = this.getFirstWord()
    + let score = 0
    + return {
    + name: name,
    + namespace: name.split(".")[0],
    + description: definition.getDescription() ? 1 : 0,
    + dummyDataSetName: this.dummyDataSetName,
    + runTimeErrors: Object.values(this.getRunTimePhaseErrors()).length,
    + examples: definition.getExamples().length,
    + edgeTests: 0,
    + speedTests: 0,
    + roadMap: 0,
    + idealStyleUXDescription: 0,
    + secPriTests: 0,
    + userType: 0
    + }
    + }
    + _getCachedSettings() {
    + if (this._cache_settingsObject) return this._cache_settingsObject
    + this._cache_settingsObject = {}
    + this.filter(child => child.doesExtend("abstractTileSettingTerminalNode") || child.doesExtend("abstractTileSettingNonTerminalNode")).forEach(setting => {
    + this._cache_settingsObject[setting.getFirstWord()] = setting.getSettingValue()
    + })
    + return this._cache_settingsObject
    + }
    + // todo: ADD TYPINGS
    + getSettingsStruct() {
    + const settingsFromCache = this._getCachedSettings()
    + // todo: this wont work anymore
    + const hintsNode = this.getDefinition().getConstantsObject()[this.columnPredictionHintsKey]
    + if (hintsNode) Object.assign(settingsFromCache, this.getParentOrDummyTable().getPredictionsForAPropertyNameToColumnNameMapGivenHintsNode(new jtree.TreeNode(hintsNode), settingsFromCache))
    + return settingsFromCache
    + }
    + getProgramTemplate(id) {}
    + getSnippetTemplate(id) {}
    + getExampleTemplate(index) {
    + // todo: right now we only have 1 example per tile.
    + const exampleNode = this.getDefinition().getNode(jtree.GrammarConstants.example)
    + return exampleNode ? exampleNode.childrenToString() : ""
    + }
    + toStumpLoadingCode() {
    + return this.qFormat(this.tileLoadingTemplate, { classes: this.getCssClassNames().join(" "), id: this.getTreeComponentId(), name: this.getWord(0), footer: this.getTileMenuButtonStumpCode() })
    + }
    + emitLogMessage(message) {
    + const tab = this.getTab()
    + if (tab) tab.addStumpCodeMessageToLog(message)
    + else if (this.isNodeJs()) console.log(message)
    + }
    + getTheme() {
    + return this.getTab().getTheme()
    + }
    + qFormat(str, obj) {
    + return new jtree.TreeNode(str).templateToString(obj)
    + }
    + scrollIntoView() {
    + const el = this.getStumpNode()
    + .getShadow()
    + .getShadowElement()
    + if (el) el.scrollIntoView()
    + }
    + async loadBrowserRequirements() {
    + const loadingMap = this.getTab()
    + .getRootNode()
    + .getDefinitionLoadingPromiseMap()
    + if (!loadingMap.has(this.constructor)) loadingMap.set(this.constructor, this._makeBrowserLoadRequirementsPromise(loadingMap))
    + await loadingMap.get(this.constructor)
    + }
    + async _makeBrowserLoadRequirementsPromise(loadingMap) {
    + const app = this.getWebApp()
    + const cssScript = this[OhayoConstants.tileCssScript]
    + if (cssScript) this._loadTileCss(cssScript)
    + const def = this.getDefinition()
    + const scriptPaths = def.nodesThatStartWith("string " + OhayoConstants.tileScript).map(node => node.getWord(2))
    + const thisScript = this[OhayoConstants.tileScript]
    + if (thisScript && !scriptPaths.includes(thisScript)) scriptPaths.push(thisScript)
    + if (scriptPaths.length) await Promise.all(scriptPaths.map(scriptPath => app.getWillowBrowser().appendScript(scriptPath)))
    + loadingMap.set(this.constructor, true)
    + }
    + _loadTileCss(css) {
    + const app = this.getWebApp()
    + app
    + .getWillowBrowser()
    + .getBodyStumpNode()
    + .insertChildNode(
    + css
    + .split(" ")
    + .map(
    + url => \`link
    + rel stylesheet
    + media screen
    + href \${url}\`
    + )
    + .join("\\n")
    + )
    + }
    + _hasBrowserRequirements() {
    + return this.tileScript
    + }
    + _areBrowserRequirementsLoaded() {
    + if (this.isNodeJs()) return true
    + // todo: cleanup. assumes app is here in browser.
    + const loadingMap = app.getDefinitionLoadingPromiseMap()
    + return !this._hasBrowserRequirements() || loadingMap.get(this.constructor) === true
    + }
    + isLoaded() {
    + return this._areBrowserRequirementsLoaded() && (!this.needsData || this._isDataLoaded)
    + }
    + getErrorMessageHtml() {
    + const errors = Object.values(this.getRunTimePhaseErrors())
    + return errors.length ? \` \${errors.join(" ")}\` : "" //todo: cleanup
    + }
    + toStumpErrorStateCode(err) {
    + return this.qFormat(this.errorStateStumpTemplate, { classes: this.getCssClassNames().join(" "), id: this.getTreeComponentId(), content: \`div \` + err, footer: this.getTileMenuButtonStumpCode() })
    + }
    + // todo: delete this
    + makeDirty() {
    + delete this._cache_settingsObject
    + delete this._bodyStumpCodeCache // todo: cleanup
    + this._setLastRenderedTime(0)
    + }
    + getAllTileSettingsDefinitions() {
    + const def = this.getDefinition()
    + return Object.values(def.getFirstWordMapWithDefinitions()).filter(def => def.isOrExtendsANodeTypeInScope([OhayoConstants.abstractTileSetting]))
    + }
    + getTab() {
    + return this.getRootNode().getTab()
    + }
    + getChildTiles() {
    + return this.getChildInstancesOfNodeTypeId("abstractTileTreeComponentNode")
    + }
    + selectTile() {
    + this.selectNode()
    + if (this.isMounted()) this.getStumpNode().addClassToStumpNode(OhayoConstants.selectedClass)
    + }
    + unselectNode() {
    + super.unselectNode()
    + if (this.isMounted()) this.getStumpNode().removeClassFromStumpNode(OhayoConstants.selectedClass)
    + }
    + getCssClassNames() {
    + const classNames = super.getCssClassNames()
    + if (this._isMaximized()) classNames.push("TileMaximized")
    + return classNames
    + }
    + toStumpCode() {
    + return this.qFormat(this.tileStumpTemplate, {
    + classes: this.getCssClassNames().join(" "),
    + id: this.getTreeComponentId(),
    + bodyStyle: this.customBodyStyle || "",
    + body: this._getBodyStumpCodeCache() || "",
    + footer: this.getTileFooterStumpCode()
    + })
    + }
    + _getBodyStumpCodeCache() {
    + if (!this._bodyStumpCodeCache) this._bodyStumpCodeCache = this.getTileBodyStumpCode()
    + return this._bodyStumpCodeCache
    + }
    + getTileBodyStumpCode() {
    + return \`\`
    + }
    + _getCss() {
    + const selector = "#" + this.getTreeComponentId()
    + const theme = this.getTheme()
    + const visibleCss = this.isVisible() ? "" : "display: none"
    + const hakonCode = this.hakonTemplate ? new jtree.TreeNode(theme).evalTemplateString(this.hakonTemplate) : this.toHakonCode()
    + return \`\${selector} { \${visibleCss} }
    + \${theme.hakonToCss(hakonCode)}\`
    + }
    + handleTileError(err) {
    + if (!this._errorCount) this._errorCount = 0
    + this._errorCount++
    + this.getRootNode().goRed(err)
    + }
    + async insertTileBetweenCommand() {
    + const tab = this.getTab()
    + const newNode = this.appendLine("doc.picker")
    + this.getChildTiles().forEach(tile => {
    + if (tile === newNode) return true
    + newNode.appendNode(tile)
    + tile.unmountAndDestroy()
    + })
    + tab.autosaveTab()
    + await this.getRootNode().loadAndIncrementalRender()
    + }
    + getWall() {
    + return this.getWebApp().getAppWall()
    + }
    + getWebApp() {
    + return this.getTab().getRootNode()
    + }
    + async runAndrenderAndGetRenderReport() {
    + await this.execute()
    + return this.renderAndGetRenderReport()
    + }
    + getTimeToLoad() {
    + return this._timeToLoad || 0
    + }
    + toHakonCode() {
    + return ""
    + }
    + getTileFooterStumpCode() {
    + return this.getTileMenuButtonStumpCode()
    + }
    + getTileMenuButtonStumpCode() {
    + return this.qFormat(this.pencilStumpTemplate)
    + }
    + // Tile child rendering is done at the wall level.
    + _getChildTreeComponents() {
    + return []
    + }
    + getStumpNodeForChildren() {
    + // We render all Tiles on the Wall.
    + return this.getStumpNode().getParent()
    + }
    + toInspectionStumpCode() {
    + const messages = this.getMessageBuffer().map(message => \`li \${moment(message.getLineModifiedTime()).fromNow()} - \${message.childrenToString()}\`)
    + // const settings = this.getAllTileSettingsDefinitions()
    + // .map(setting => \`\${setting.getFirstWord()} \${setting.getDescription()}\`)
    + // .join("\\n")
    + const settings = JSON.stringify(this.getSettingsStruct(), null, 2)
    + const parentConstructorName = this.getParent().constructor.name
    + const constructorName = this.constructor.name
    + const sourceCode = this.toString()
    + const inputTable = this.getParentOrDummyTable()
    + const outputTable = this.getOutputOrInputTable()
    + const outputColumns = outputTable.getColumnsArrayOfObjects()
    + const inputCols = inputTable.getColumnsArrayOfObjects()
    + const inputCount = inputTable.getRowCount()
    + const outputCount = outputTable.getRowCount()
    + const timeToLoad = this.getTimeToLoad()
    + const renderTime = this.getNewestTimeToRender()
    + const inputColumnsAsTable = new jtree.TreeNode(inputCols).toTable()
    + const outputColumnsAsTable = new jtree.TreeNode(outputColumns).toTable()
    + const outputNumericValues = new jtree.TreeNode(outputTable.getJavascriptNativeTypedValues()).toTable()
    + const typeScriptInterface = outputTable.toTypeScriptInterface()
    + const inputNumericValues = new jtree.TreeNode(inputTable.getJavascriptNativeTypedValues()).toTable()
    + return this.qFormat(this.inspectionStumpTemplate, {
    + settings,
    + inputCount,
    + outputCount,
    + timeToLoad,
    + renderTime,
    + inputColumnsAsTable,
    + outputColumnsAsTable,
    + outputNumericValues,
    + typeScriptInterface,
    + inputNumericValues,
    + constructorName,
    + parentConstructorName,
    + sourceCode,
    + messages
    + })
    + }
    + isVisible() {
    + if (this.has(this.visibleKey)) return true
    + if (this.visible === false) return false
    + if (this.has(this.hiddenKey)) return false
    + return true
    + }
    + _isMaximized() {
    + return this.has(OhayoConstants.maximized)
    + }
    + async _executeChildNodes() {
    + await Promise.all(this.getChildTiles().map(tile => tile.execute()))
    + }
    + async _execute() {
    + this.setIsDataLoaded(true)
    + await this._executeChildNodes()
    + }
    + async execute() {
    + try {
    + this.setRunTimePhaseError("execute")
    + await this._execute()
    + } catch (err) {
    + this.setRunTimePhaseError("execute", err)
    + console.error(err)
    + this.emitLogMessage(this.errorLogMessageStumpTemplate)
    + }
    + return this
    + }
    + cloneTileCommand() {
    + this.duplicateLineCommand()
    + return this.getTab().autosaveAndRender()
    + }
    + duplicateLineCommand() {
    + return this.getParent().insertLineAndChildren(this.getLine(), undefined, this.getIndex() + 1)
    + }
    + async toggleTileMaximizeCommand() {
    + if (this.has(OhayoConstants.maximized)) this.delete(OhayoConstants.maximized)
    + else this.touchNode(OhayoConstants.maximized)
    + await this._runAfterTileUpdate(this)
    + }
    + async triggerTileMethodCommand(value, methodName) {
    + await thisethodName](value)
    + await this._runAfterTileUpdate(this)
    + }
    + // todo: refactor.
    + async changeTileTypeCommand(newValue) {
    + const tab = this.getTab()
    + this.setFirstWord(newValue)
    + const newNode = this.duplicate()
    + // todo: destroy or something? how do we reparse.
    + this.getChildTiles().forEach(tile => tile.unmountAndDestroy())
    + this.unmountAndDestroy()
    + tab.autosaveTab()
    + this.getRootNode().loadAndIncrementalRender()
    + }
    + changeParentCommand(pathVector) {
    + // if (tile.getFirstWordPath() === value) return; // todo: do we need this line?
    + const program = this.getRootNode()
    + const indexPath = pathVector ? pathVector.split(" ").map(num => parseInt(num)) : ""
    + const destinationTree = indexPath ? program.nodeAt(indexPath) : program
    + // todo: on jtree should we make copyTo second param optional?
    + this.copyTo(destinationTree, destinationTree.length)
    + this.unmountAndDestroy()
    + return this.getTab().autosaveAndRender()
    + }
    + async removeTileCommand() {
    + const tab = this.getTab()
    + this.getChildTiles().forEach(tile => {
    + tile.unmount()
    + tile.shiftLeft()
    + })
    + this.unmountAndDestroy()
    + tab.autosaveTab()
    + this.getRootNode().loadAndIncrementalRender()
    + }
    + getNewDataCommand() {
    + // todo: have some type of paging system to fetch new data.
    + }
    + async changeTileSettingAndRenderCommand(value, settingName) {
    + // note the unusual ordering of params.
    + this.touchNode(settingName).setContent(value.toString())
    + // todo: sometimes size needs to be redone (maximize, for example)
    + await this._runAfterTileUpdate(this)
    + }
    + // todo: remove
    + async changeTileSettingMultilineCommand(val, settingName) {
    + this.touchNode(settingName).setChildren(val)
    + await this._runAfterTileUpdate(this)
    + }
    + async changeTileSettingCommand(settingName, value) {
    + this.touchNode(settingName).setContent(value)
    + }
    + async changeWordAndRenderCommand(value, index) {
    + this.setWord(parseInt(index), value)
    + await this._runAfterTileUpdate(this)
    + }
    + async changeWordsAndRenderCommand(value, index) {
    + index = parseInt(index)
    + const edgeSymbol = this.getEdgeSymbol()
    + const words = this.getWords().slice(0, index)
    + this.setLine(words.concat(value.split(edgeSymbol)).join(edgeSymbol))
    + await this._runAfterTileUpdate(this)
    + }
    + async updateChildrenCommand(val) {
    + this.setChildren(val)
    + // reload the whole doc for now.
    + await this._runAfterTileUpdate(this)
    + }
    + async _runAfterTileUpdate(tile) {
    + tile.makeDirty() // ugly!
    + tile.getChildTiles().forEach(tile => {
    + tile.makeDirty() // todo: ugly!
    + })
    + // todo: what if you have a tile that has a contextare that allows editing of its children/
    + // if you edit a child, then that parent tile needs to update to...should we allow that or ban that?
    + await tile.getTab().autosaveTab()
    + await tile.runAndrenderAndGetRenderReport()
    + tile
    + .getTab()
    + .getRootNode()
    + .renderApp() // Need to render full app because of code editor
    + }
    + // todo: downstream data changes?
    + async changeTileContentAndRenderCommand(value) {
    + this.setContent(value)
    + await this._runAfterTileUpdate(this)
    + }
    + async copyTileCommand() {
    + // todo: remove cousin tiles?
    + this.getRootNode()
    + .getWillowBrowser()
    + .copyTextToClipboard(this.getFirstAncestor().toString())
    + }
    + async createProgramFromTileExampleCommand(index) {
    + const template = this.getExampleTemplate(index)
    + if (!template) return undefined
    + const fileExtension = "ohayo" // todo: generalize
    + const tab = await this.getTab()
    + .getRootNode()
    + ._createAndOpen(template, \`help-for-\${this.getFirstWord()}.\${fileExtension}\`)
    + tab.addStumpCodeMessageToLog(\`div Created '\${tab.getFullTabFilePath()}'\`)
    + }
    + async inspectTileCommand() {
    + if (!this.isNodeJs()) {
    + console.log("Tile available at window.tile")
    + window.tile = this
    + console.log(this)
    + }
    + this.getTab().addStumpCodeMessageToLog(this.toInspectionStumpCode())
    + this.getTab()
    + .getRootNode()
    + .renderApp()
    + }
    + async toggleTileMenuCommand() {
    + const app = this.getTab().getRootNode()
    + app.setTargetTile(this)
    + app.toggleAndRender(\`\${StudioConstants.tileMenu}\`)
    + }
    + async createProgramFromTemplateCommand(id) {
    + const programTemplate = this.getProgramTemplate(id)
    + if (!programTemplate) return undefined
    + const tab = await this.getTab()
    + .getRootNode()
    + ._createAndOpen(programTemplate.template, programTemplate.name)
    + tab.addStumpCodeMessageToLog(\`div Created '\${tab.getFullTabFilePath()}'\`)
    + }
    + async appendSnippetTemplateCommand(id) {
    + const snippet = this.getSnippetTemplate(id)
    + if (!snippet) return undefined
    + const tab = this.getTab()
    + const tabProgram = tab.getTabProgram()
    + const newNodes = tabProgram.concat(snippet)
    + const newTiles = newNodes.filter(tile => tile.doesExtend && tile.doesExtend("abstractTileTreeComponentNode"))
    + tab.autosaveTab()
    + tabProgram.clearSelection()
    + tab.getTabWall().unmount()
    + await tabProgram.loadAndIncrementalRender()
    + newTiles.forEach(tile => tile.selectTile())
    + newTiles[0].scrollIntoView()
    + }
    + async copyDataCommand(delimiter) {
    + this.getRootNode()
    + .getWillowBrowser()
    + .copyTextToClipboard(this.getOutputOrInputTable().toDelimited(delimiter))
    + }
    + async copyDataAsJavascriptCommand() {
    + const table = this.getOutputOrInputTable()
    + this.getRootNode()
    + .getWillowBrowser()
    + .copyTextToClipboard(JSON.stringify(table.toTree().toDataTable(table.getColumnNames()), null, 2))
    + }
    + async copyDataAsTreeCommand() {
    + const text = this.getOutputOrInputTable()
    + .toTree()
    + .toString()
    + this.getRootNode()
    + .getWillowBrowser()
    + .copyTextToClipboard(text)
    + }
    + async exportTileDataCommand(format = "csv") {
    + // todo: figure this out. use the browsers filename? tile title? id?
    + let extension = "csv"
    + let type = "text/csv"
    + let str = this.getOutputOrInputTable().toDelimited(",")
    + if (format === "tree") {
    + extension = "tree"
    + type = "text"
    + str = this.getOutputOrInputTable()
    + .toTree()
    + .toString()
    + }
    + this.getRootNode()
    + .getWillowBrowser()
    + .downloadFile(str, this.getTab().getFileName() + "." + extension, type)
    + }
    + abstractChartNode
    + inScope rowDisplayLimitNode
    + int rowDisplayLimit 10000
    + extends abstractTileTreeComponentNode
    + abstract
    + string tileFooterTemplate
    + span Rows: {rowCount} Columns Out: {columnCount}
    + {tileMenuButton}
    + javascript
    + getTileFooterStumpCode() {
    + const table = this.getParentOrDummyTable()
    + return this.qFormat(this.tileFooterTemplate, { rowCount: table.getRowCount(), columnCount: table.getColumnCount(), tileMenuButton: this.getTileMenuButtonStumpCode() })
    + }
    + getTileRunTimeWidth() {
    + return this.isNodeJs() ? 456 : jQuery(".WallTreeComponent").width() - 100
    + }
    + getTileRunTimeHeight() {
    + return 300
    + }
    + toDisplayString(value, columnName) {
    + // todo: remove.
    + if (value === undefined) return ""
    + return this.getParentOrDummyTable()
    + .getTableColumnByName(columnName)
    + .toDisplayString(value)
    + }
    + _getRowDisplayLimit() {
    + const limitStr = this.getSettingsStruct()[this.rowDisplayLimitKey] || this.rowDisplayLimit
    + const limit = parseInt(limitStr)
    + if (!limitStr || isNaN(limit)) return undefined
    + return limit
    + }
    + getRowsWithRowDisplayLimit() {
    + return this.getParentOrDummyTable()
    + .getRows()
    + .slice(0, this._getRowDisplayLimit())
    + }
    + abstractTextNode
    + catchAllCellType stringCell
    + frequency 0
    + description Prints a message
    + inScope contentNode
    + string bodyStumpTemplate
    + div
    + class TileSelectable
    + bern
    + {content}
    + javascript
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, { content: this.content ? jtree.Utils.linkify(this.content) : "" })
    + }
    + extends abstractChartNode
    + abstract
    + abstractInstructionsNode
    + string tileSize 600 240
    + string content Instructions go here.
    + extends abstractTextNode
    + abstract
    + amazonHistoryNode
    + description Instructions on how to get your Amazon order history.
    + string content Step 1. Go to https://www.amazon.com/gp/b2b/reports to download your Amazon order history.
    Step 2. Add the data here.
    + string dummyDataSetName amazonPurchases
    + extends abstractInstructionsNode
    + crux amazon.history
    + fitbitAllNode
    + description Instructions on how to get your Fitbit data.
    + string content Step 1. Go to https://www.fitbit.com/settings/data/export to download your Fitbit data.
    Step 2. Drop the CSV onto this page.
    + extends abstractInstructionsNode
    + crux fitbit.all
    + abstractComingSoonNode
    + frequency 0
    + description Coming soon
    + string tileSize 600 240
    + string content Instructions go here.
    + extends abstractTextNode
    + abstract
    + datawrapperComingSoonNode
    + string content We don't have support yet for https://www.datawrapper.de/
    + extends abstractComingSoonNode
    + crux datawrapper.comingSoon
    + dcjsComingSoonNode
    + string content We don't have support yet for https://github.com/dc-js/dc.js
    + extends abstractComingSoonNode
    + crux dcjs.comingSoon
    + finosPerspectiveComingSoonNode
    + string content We don't have support yet for https://perspective.finos.org/
    + extends abstractComingSoonNode
    + crux finos.perspective.comingSoon
    + fivethirtyeightComingSoonNode
    + string content We don't have support yet for https://github.com/fivethirtyeight/data/
    + extends abstractComingSoonNode
    + crux fivethirtyeight.comingSoon
    + GovNode
    + string content We don't have support yet for https://www.data.gov/
    + extends abstractComingSoonNode
    + crux gov.comingSoon
    + highchartsComingSoonNode
    + string content We don't have support yet for https://www.highcharts.com/blog/snippets/3d-solar-system/
    + extends abstractComingSoonNode
    + crux highcharts.comingSoon
    + re3dataComingSoonNode
    + string content We don't have support yet for https://www.re3data.org/
    + extends abstractComingSoonNode
    + crux re3data.comingSoon
    + zingComingSoonNode
    + string content We don't have support yet for https://www.zingchart.com/
    + extends abstractComingSoonNode
    + crux zing.comingSoon
    + editorHelloWorldNode
    + description Prints hello world
    + example Say hello.
    + editor.helloWorld
    + string content Ohayo world!
    + extends abstractTextNode
    + crux editor.helloWorld
    + abstractSnippetGalleryNode
    + string tileSize 600 240
    + extends abstractChartNode
    + abstract
    + string bodyStumpTemplate
    + h4 {title}
    + ol
    + class TileSelectable
    + {options}
    + string optionStumpTemplate
    + li
    + a {title}
    + value {value}
    + class appendSnippetButton
    + clickCommand appendSnippetTemplateCommand
    + javascript
    + getGalleryNodes() {}
    + async _execute() {
    + this._outputTable = new Table(
    + this.getGalleryNodes()
    + .toDataTable()
    + .slice(1)
    + )
    + this.setIsDataLoaded(true)
    + await this._executeChildNodes()
    + }
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, {
    + title: this.title,
    + options: new jtree.TreeNode(
    + this.getGalleryNodes()
    + .map(node => this.qFormat(this.optionStumpTemplate, { title: node.evalTemplateString(this.itemFormat), value: node.get("id") }))
    + .join("\\n")
    + ).toString()
    + })
    + }
    + abstractTemplateGalleryNode
    + extends abstractSnippetGalleryNode
    + abstract
    + string optionStumpTemplate
    + li
    + a {title}
    + value {value}
    + class createProgramButton
    + clickCommand createProgramFromTemplateCommand
    + challengeListNode
    + description View all challenges
    + string title Try a challenge:
    + string itemFormat {question}
    + extends abstractSnippetGalleryNode
    + crux challenge.list
    + javascript
    + getGalleryNodes() {
    + return typeof challengesTree === "undefined" ? jtree.TreeNode.fromDisk("ohayo/packages/challenge/challenges.tree") : new jtree.TreeNode(challengesTree)
    + }
    + getSnippetTemplate(id) {
    + return \`challenge.play \${id}\`
    + }
    + samplesListNode
    + description View all available sample tiles
    + string title All samples:
    + string itemFormat {id} - {description}
    + boolean isDataPublicDomain true
    + extends abstractSnippetGalleryNode
    + crux samples.list
    + javascript
    + getGalleryNodes() {
    + // todo: cleanup.
    + const ohayo = this.getWebApp().getOhayoGrammarAsTree()
    + const hits = ohayo.getNodesByRegex(/^samples/).map(node => {
    + return {
    + id: node.get("crux"),
    + description: node.get("description")
    + }
    + })
    + return new jtree.TreeNode(hits)
    + }
    + getSnippetTemplate(id) {
    + return id
    + }
    + vegaDataListNode
    + description View all available Vega datasets
    + frequency .001
    + string title All Vega datasets:
    + string itemFormat {id}
    + extends abstractSnippetGalleryNode
    + crux vega.data.list
    + javascript
    + getGalleryNodes() {
    + // todo: cleanup this line.
    + const node = this.getWebApp()
    + .getOhayoGrammarAsTree()
    + .getNodesByRegex(/^vegaDataSetCell/)[0]
    + return new jtree.TreeNode(
    + node
    + .get("enum")
    + .split(" ")
    + .map(item => {
    + return {
    + id: item
    + }
    + })
    + )
    + }
    + getSnippetTemplate(id) {
    + return \`vega.data \${id}\`
    + }
    + vegaExampleListNode
    + description View all available Vega examples
    + frequency .001
    + string title All Vega examples:
    + string itemFormat {id}
    + extends abstractSnippetGalleryNode
    + crux vega.example.list
    + javascript
    + getGalleryNodes() {
    + // todo: cleanup this line.
    + const node = this.getWebApp()
    + .getOhayoGrammarAsTree()
    + .getNodesByRegex(/^vegaExampleNameCell/)[0]
    + return new jtree.TreeNode(
    + node
    + .get("enum")
    + .split(" ")
    + .map(item => {
    + return {
    + id: item
    + }
    + })
    + )
    + }
    + getSnippetTemplate(id) {
    + return \`vega.example \${id}\`
    + }
    + abstractPickerTileNode
    + extends abstractChartNode
    + string tileSize 480 420
    + boolean needsData false
    + abstract
    + string hakonTemplate
    + .abstractPickerTileNode
    + .PickerCategory
    + width 100%
    + margin-top 20px
    + text-align center
    + .TileBody
    + display flex
    + flex-flow row wrap
    + a
    + &:hover
    + background-color {borderColor}
    + padding 10px
    + margin 5px
    + height 30px
    + background-color {backgroundColor}
    + border 1px solid {borderColor}
    + overflow hidden
    + text-align center
    + text-overflow ellipsis
    + font-size 14px
    + width 120px
    + span
    + font-size 70%
    + string itemStumpTemplate
    + {categoryBreak}
    + a {name}
    + br
    + span {description}
    + title {description}
    + tabindex -1
    + value {value}
    + class pickerItemButton
    + clickCommand {command}
    + string categoryBreakStumpTemplate
    + div {category}
    + class PickerCategory
    + javascript
    + async fetchTableInputs() {
    + return { rows: this.getChoices() }
    + }
    + getTileBodyStumpCode() {
    + let lastCat = ""
    + return this.getChoices()
    + .map(choice => {
    + choice.categoryBreak = lastCat !== choice.category ? this.qFormat(this.categoryBreakStumpTemplate, { category: choice.category }) : ""
    + lastCat = choice.category
    + return this.qFormat(this.itemStumpTemplate, choice)
    + })
    + .join("\\n")
    + }
    + PickerTileNode
    + extends abstractPickerTileNode
    + description Displays list of available tiles.
    + crux doc.picker
    + javascript
    + getChoices() {
    + const allChoices = this.getRootNode()
    + .getHandGrammarProgram()
    + .getTopNodeTypeDefinitions()
    + const filteredChoices = allChoices.filter(nodeDef => !(nodeDef.get(jtree.GrammarConstants.tags) || "").includes(OhayoConstants.noPicker))
    + const theChoices = filteredChoices.length ? filteredChoices : allChoices
    + return theChoices.map(nodeDefinition => {
    + const nodeId = nodeDefinition.get("crux") || nodeDefinition.getNodeTypeIdFromDefinition()
    + const name = nodeId.split(".")[1] || ""
    + const category = lodash.upperFirst(nodeId.split(".")[0])
    + const description = nodeDefinition.getDescription()
    + return { name, category, description, value: nodeId, command: "changeTileTypeCommand" }
    + })
    + }
    + templatesListNode
    + extends abstractPickerTileNode
    + description Displays templates.
    + frequency .22
    + crux templates.list
    + javascript
    + getChoices() {
    + // todo: cleanup.
    + const choices = this.getWebApp()
    + .getStandardTemplates()
    + .map(node => {
    + const id = node
    + .getWord(1)
    + .replace("templates/", "")
    + .replace(this.ohayoFileExtensionKey, "")
    + return {
    + command: "createProgramFromTemplateCommand",
    + name: node.get("data doc.title"),
    + value: id,
    + category: lodash.upperFirst(node.get("data doc.categories")),
    + description: ""
    + }
    + })
    + return lodash.sortBy(choices, "category")
    + }
    + getProgramTemplate(id) {
    + const node = this.getWebApp()
    + .getStandardTemplates()
    + .filter(node => node.getContent() === \`templates/\${id}\${this.ohayoFileExtensionKey}\`)[0]
    + return {
    + template: node.getNode("data").childrenToString(),
    + name: id + this.ohayoFileExtensionKey
    + }
    + }
    + asciiChartNode
    + description Lightweight ASCII line chart from the library https://github.com/kroitor/asciichart
    + string tileScript ohayo/packages/asciichart/asciichart.js
    + extends abstractChartNode
    + crux asciichart.line
    + catchAllCellType titleCell
    + inScope yColumnNode
    + example
    + samples.waterBill
    + asciichart.line Water Bill
    + string columnPredictionHints
    + yColumn isString=false
    + string bodyStumpTemplate
    + pre
    + class TileSelectable
    + style overflow: scroll; width: 100%; height: 100%; white-space: pre;
    + bern
    + {title}
    + {chart}
    + javascript
    + getTileBodyStumpCode() {
    + // todo: autodetect column
    + const columName = this.mapSettingNamesToColumnNames(["yColumn"])[0]
    + const column = this.getParentOrDummyTable().getColumnByName(columName)
    + const values = column.getValues()
    + const chart = asciichart.plot(values, { height: 15 })
    + const title = this.getContent() || ""
    + const leftPad = Math.max(0, Math.floor((chart.split("\\n")[0].length - title.length) / 2))
    + return this.qFormat(this.bodyStumpTemplate, { title: " ".repeat(leftPad) + title, chart })
    + }
    + calendarHeatNode
    + description Shows which days have higher counts.
    + inScope countNode dayColumnNode
    + string tileSize 750 200
    + string columnPredictionHints
    + count getPrimitiveTypeName=number
    + dayColumn getPrimitiveTypeName=day
    + string dummyDataSetName waterBill
    + extends abstractChartNode
    + crux calendar.heat
    + string bodyStumpTemplate
    + div
    + class heatCal
    + bern
    + {svg}
    + string hakonTemplate
    + .heatCal
    + rect
    + fill {darkerBackground}
    + shape-rendering crispedges
    + text
    + font-size 10px
    + fill #ddd
    + javascript
    + _getLegend(quins, squareSideWithPadding, position) {
    + const theme = this.getTheme()
    + const quinSvgs = quins
    + .map((quin, index) => {
    + const left = position.left + squareSideWithPadding * index
    + const style = "fill: " + theme.getHeatColor(1 - quin.percent)
    + return \`\`
    + })
    + .join("")
    + return \`
    + Less
    + \${quinSvgs}
    + More
    + \`
    + }
    + getTileBodyStumpCode() {
    + const svg = this._getSvg()
    + return this.qFormat(this.bodyStumpTemplate, { svg })
    + }
    + _getDayMap(quins, rows, dayColumnName, countColumnName) {
    + const getQuin = val => {
    + for (let index = 0; index < quins.length; index++) {
    + if (val <= quins[index].value) return quins[index].percent
    + }
    + }
    + const dayMap = {}
    + rows.forEach(row => {
    + dayMapoment(row[dayColumnName]).format("MM/DD/YYYY")] = {
    + Quin: getQuin(row[countColumnName]),
    + count: row[countColumnName],
    + row: row
    + }
    + })
    + return dayMap
    + }
    + _getDaysArray(startDay, daysToShow) {
    + const days = []
    + const firstDay = parseInt(startDay.format("e"))
    + for (let dayIndex = 0; dayIndex <= daysToShow; dayIndex++) {
    + const day = startDay.clone().add(dayIndex, "days")
    + days.push({
    + day: day,
    + row: parseInt(day.format("e")),
    + col: Math.floor((firstDay + dayIndex) / 7)
    + })
    + }
    + return days
    + }
    + _getDayNamesG(squareSideWithPadding) {
    + const dayNames = [{ day: "Mon", row: 2 }, { day: "Wed", row: 4 }, { day: "Fri", row: 6 }]
    + .map(day => {
    + const _top = 20 + day.row * squareSideWithPadding - 3
    + return \`\${day.day}\`
    + })
    + .join("")
    + return \`\${dayNames}\`
    + }
    + _getMonthNamesG(daysArray, squareSideWithPadding) {
    + const _usedMonths = {}
    + const monthNames = daysArray
    + .map(day => {
    + const monthName = day.day.format("MMM")
    + const monthYear = day.day.format("MM/YYYY")
    + if (_usedMonthsonthYear]) return ""
    + _usedMonthsonthYear] = true
    + const left = 40 + day.col * squareSideWithPadding
    + return \`\${monthName}\`
    + })
    + .join("")
    + return \`\${monthNames}\`
    + }
    + _getDataSquaresG(daysArray, squareSideWithPadding, dayMap) {
    + const dayFormat = "MM/DD/YYYY"
    + const today = moment(Date.now()).format(dayFormat)
    + const theme = this.getTheme()
    + const dataSquares = daysArray
    + .map(day => {
    + const dayKey = day.day.format(dayFormat)
    + const _top = 20 + day.row * squareSideWithPadding
    + const left = 40 + day.col * squareSideWithPadding
    + const value = dayMap[dayKey]
    + const todayStyle = dayKey === today ? "stroke-width:2;stroke:rgb(0,0,0);" : ""
    + const style = (value ? "fill: " + theme.getHeatColor(1 - value.Quin) : "") + ";" + todayStyle
    + const title = \`\${dayKey}: \${value ? value.count : 0}\`
    + return \`\${title}\`
    + })
    + .join("")
    + return \`\${dataSquares}\`
    + }
    + _getSvg() {
    + const inputTable = this.getParentOrDummyTable()
    + const rows = inputTable.getJavascriptNativeTypedValues()
    + if (!rows.length) return ""
    + const tileStruct = this.getSettingsStruct()
    + const dayColumnName = tileStruct.dayColumn
    + const countColumnName = tileStruct.count
    + if (!dayColumnName || !countColumnName) return ""
    + const dayCol = inputTable.getTableColumnByName(dayColumnName)
    + const countCol = inputTable.getTableColumnByName(countColumnName)
    + let daysToShow = 365 * 1 // todo: make configurable
    + let endDay = moment(Date.now())
    + let startDay = endDay.clone().subtract(daysToShow, "days")
    + // todo: make configurable
    + // reductions = dayCol.getReductions()
    + // startDay = moment(reductions.min)
    + // endDay = moment(reductions.max)
    + // daysToShow = endDay.diff(startDay, "days")
    + const squareSide = 10
    + const squarePadding = 2
    + const squareSideWithPadding = squareSide + squarePadding
    + const width = squareSideWithPadding * (daysToShow / 6)
    + const height = 7 * squareSideWithPadding + 100
    + const quins = countCol.getQuins()
    + const dayMap = this._getDayMap(quins, rows, dayColumnName, countColumnName)
    + const daysArray = this._getDaysArray(startDay, daysToShow)
    + const dayNamesG = this._getDayNamesG(squareSideWithPadding)
    + const monthNamesG = this._getMonthNamesG(daysArray, squareSideWithPadding)
    + const squaresG = this._getDataSquaresG(daysArray, squareSideWithPadding, dayMap)
    + const keyG = this._getLegend(quins, squareSideWithPadding, { top: 110, left: 60 })
    + return \`\${dayNamesG + squaresG + monthNamesG + keyG}\`
    + }
    + challengePlayNode
    + cells tileKeywordCell challengeIdCell
    + description Learn ohayo by trying a challenge.
    + catchAllCellType challengeAnswerCell
    + tags aTileThatCreatesPrograms
    + example
    + challenge.list
    + challenge.play 1
    + challenge.play 2
    + string tileSize 640 240
    + extends abstractChartNode
    + crux challenge.play
    + javascript
    + getProgramTemplate(id) {
    + const challengeNode = this._getChallengeNode(parseInt(id))
    + return {
    + template: challengeNode.getNode("solution").childrenToString(),
    + name: "challenge-" + id + "-solution.ohayo"
    + }
    + }
    + _getChallengeNode(challengeId) {
    + const challenges = typeof challengesTree === "undefined" ? jtree.TreeNode.fromDisk("ohayo/packages/challenge/challenges.tree") : new jtree.TreeNode(challengesTree)
    + return challenges.nodeAt(challengeId - 1) || challenges.nodeAt(0)
    + }
    + getTileBodyStumpCode() {
    + const challengeId = parseInt(this.getWord(1))
    + const answer = this.getWord(2)
    + const challengeNode = this._getChallengeNode(challengeId)
    + const isCorrect = answer === challengeNode.get("answer")
    + const theme = this.getTheme()
    + const color = answer ? (isCorrect ? theme.successColor : theme.errorColor) : theme.warningColor
    + const answerMessage = answer !== undefined ? (isCorrect ? "CORRECT!" : "Wrong.") : ""
    + return \`h3 Challenge #\${challengeId}
    + style color:\${color}
    + br
    + div \${challengeNode.evalTemplateString(\`Question: {question}\`)}
    + class TileSelectable
    + br
    + input
    + placeholder Enter your answer here. All answers are a number.
    + value \${answer !== undefined ? answer : ""}
    + style width: 300px;
    + name 2
    + changeCommand changeWordAndRenderCommand
    + span \${answerMessage}
    + style color: \${color};
    + br
    + div
    + a See a solution
    + clickCommand createProgramFromTemplateCommand
    + value \${challengeId}\`
    + }
    + debugDumpNode
    + description Dumps data from content or dump's first column input as 1 concatenated string.
    + example Print a poem.
    + samples.poem
    + debug.dump
    + extends abstractChartNode
    + crux debug.dump
    + string bodyStumpTemplate
    + div
    + style overflow: scroll; width: 100%; height: 100%; white-space: pre;
    + bern
    + {text}
    + javascript
    + _getCharacterLimit() {
    + // Todo: great example of a scale test. I found it to be slow with:
    + /*
    + vega.sample movies.json
    + web.dump
    + So some tiles will have characterLimit, rowDisplayLimit, et cetera. And have "speedTestExamples" .
    + */
    + return 20000
    + }
    + getTileBodyStumpCode() {
    + const text = this._getTextToDump()
    + const characterLimit = this._getCharacterLimit()
    + let sub = text.substr(0, characterLimit)
    + if (text.length > characterLimit)
    + // todo: Show standardized truncation warning
    + sub = \`(Notice: Results truncated to \${characterLimit} characters)
    \` + sub
    + return this.qFormat(this.bodyStumpTemplate, { text: sub || "No data to dump" })
    + }
    + _getTextToDump() {
    + return this.getPipishInput()
    + }
    + webDumpNode
    + frequency .02
    + description Dump the raw text from the web request.
    + extends debugDumpNode
    + javascript
    + _getTextToDump() {
    + return this.getParent().getWillowHttpResponse ? this.getParent().getWillowHttpResponse().text : \`\${this.constructor.name} requires a parent web tile.\`
    + }
    + crux web.dump
    + debugCommandsNode
    + description Tools for ohayo developers.
    + tags noPicker
    + example Show debug commands
    + debug.commands
    + extends abstractChartNode
    + crux debug.commands
    + string bodyStumpTemplate
    + a Run Speed Test on all Templates
    + clickCommand _runTemplateSpeedTestCommand
    + br
    + a Open all Templates Command
    + clickCommand _openAllTemplatesCommand
    + br
    + a Run Tile Quality Check
    + clickCommand _doTileQualityCheckCommand
    + javascript
    + getTileBodyStumpCode() {
    + return this.bodyStumpTemplate
    + }
    + _runTemplateSpeedTestCommand() {
    + return this.getWebApp()._runTemplateSpeedTestCommand()
    + }
    + _openAllTemplatesCommand() {
    + return this.getWebApp()._openAllTemplatesCommand()
    + }
    + _doTileQualityCheckCommand() {
    + return this.getWebApp()._doTileQualityCheckCommand()
    + }
    + debugSleepNode
    + cells tileKeywordCell millisecondsCell dummyDataSetIdCell
    + description Sleeps for a few seconds and then loads data. Useful for testing and development.
    + example Sleep for 1 second then load data
    + debug.sleep 100 waterBill
    + tables.basic
    + string dummyDataSetName waterBill
    + extends abstractChartNode
    + crux debug.sleep
    + javascript
    + async fetchTableInputs() {
    + const ms = parseInt(this.getWord(1) || 1)
    + await this.getWebApp().sleepCommand(ms)
    + return { rows: jtree.Utils.javascriptTableWithHeaderRowToObjects(DummyDataSets[this.getWord(2) || "stockPrice"]) }
    + }
    + debugNoOpNode
    + cells tileKeywordCell
    + catchAllCellType anyCell
    + description A noop.
    + boolean visible false
    + crux debug.noop
    + extends abstractChartNode
    + debugThrowNode
    + description Throws an error during load. Used for testing.
    + cells tileKeywordCell tileEventNameCell
    + example Throw an error
    + samples.poem
    + debug.throw fetchTableInputs
    + extends abstractChartNode
    + crux debug.throw
    + javascript
    + async fetchTableInputs() {
    + this._throwIfMethodNameIs("fetchTableInputs")
    + return {
    + rows: []
    + }
    + }
    + _throwIfMethodNameIs(name) {
    + // Never throw if no word provided. That ensures it wont throw during testing.
    + const lookingFor = this.getContent()
    + if (lookingFor === name) throw new Error(\`DebugTile threw an error on purpose on event: "\${lookingFor}"\`)
    + }
    + getTileBodyStumpCode() {
    + this._throwIfMethodNameIs("getTileBodyStumpCode")
    + }
    + treeComponentDidMount() {
    + this._throwIfMethodNameIs("treeComponentDidMount")
    + }
    + treeComponentDidUpdate() {
    + this._throwIfMethodNameIs("treeComponentDidUpdate")
    + }
    + dtjsBasicNode
    + description A spreadsheet-like table.
    + string tileSize 1200 500
    + string tileCssScript ohayo/packages/dtjs/datatables.min.css
    + string tileScript ohayo/packages/dtjs/datatables.min.js
    + extends abstractChartNode
    + crux dtjs.basic
    + string bodyStumpTemplate
    + div
    + table
    + class DataTable
    + thead
    + tr
    + {headerRows}
    + tbody
    + {rows}
    + string cellStumpTemplate
    + td
    + bern
    + {box}
    + string rowStumpTemplate
    + tr
    + {cols}
    + javascript
    + getTileBodyStumpCode() {
    + const columnDefs = this.getParentOrDummyTable()
    + .getColumnsArray()
    + .slice(0, 10)
    + const headerRows = this._getHeaderRowsStumpCode(columnDefs.map(col => col.getColumnName()))
    + const rows = this._getTableRowsStumpCode(columnDefs)
    + return this.qFormat(this.bodyStumpTemplate, { headerRows, rows })
    + }
    + _getHeaderRowsStumpCode(columns) {
    + return columns.map(colName => \`th \${colName}\`).join("\\n")
    + }
    + _getTableRowsStumpCode(columns) {
    + return this.getRowsWithRowDisplayLimit()
    + .slice(0, 10)
    + .map((row, index) => {
    + const cols = columns
    + .map(column => {
    + const box = row.getRowHtmlSafeValue(column.getColumnName()) // todo: cache?
    + return this.qFormat(this.cellStumpTemplate, { box })
    + })
    + .join("\\n")
    + return this.qFormat(this.cellStumpTemplate, { cols })
    + })
    + .join("\\n")
    + }
    + treeComponentWillUnmount() {
    + // cleanup
    + }
    + treeComponentDidUpdate() {
    + super.treeComponentDidUpdate()
    + const table = this.getParentOrDummyTable()
    + const columnDefs = this.getParentOrDummyTable()
    + .getColumnsArray()
    + .slice(0, 10)
    + const container = this.getStumpNode().findStumpNodeByChild("class DataTable")
    + if (this.isNodeJs()) return undefined
    + const width = this.getTileRunTimeWidth()
    + const height = this.getTileRunTimeHeight()
    + const shadow = container.getShadow()
    + const el = shadow.getShadowElement()
    + shadow.setShadowCss({ width, height })
    + const rows = this.getRowsWithRowDisplayLimit()
    + // todo: note, this is only works with jQuery
    + jQuery.fn.dataTable.ext.errMode = "throw"
    + this._dataTables = jQuery(el).DataTable({
    + data: this.getRowsAsDataTableArrayWithHeader(rows, columnDefs.map(col => col.getColumnName())).slice(1),
    + pageLength: 10,
    + scrollY: height
    + //"scrollCollapse": true,
    + //"paging": false
    + })
    + }
    + treeComponentDidMount() {
    + this.treeComponentDidUpdate()
    + }
    + editorGalleryNode
    + description Show a thumbnail of all the Ohayo documents in the input table.
    + example
    + editor.files
    + editor.gallery
    + string tileSize 1080 600
    + string dummyDataSetName ohayoPrograms
    + extends abstractChartNode
    + crux editor.gallery
    + string hakonTemplate
    + .MiniMapTile
    + .miniMap
    + background {backgroundColor}
    + width 120px
    + height 90px
    + margin 6px
    + position relative
    + overflow hidden
    + box-sizing border-box
    + display inline-block
    + &:hover
    + border 1px solid {boxShadow}
    + &:active
    + border 2px solid {boxShadow}
    + .miniFooter
    + font-size 12px
    + position absolute
    + bottom 0
    + width 100%
    + height 15px
    + line-height 15px
    + white-space nowrap
    + text-align center
    + .miniPreview
    + position absolute
    + width 100%
    + height calc(100% - 15px)
    + top 0
    + overflow hidden
    + div
    + background {linkColor}
    + height 5px
    + margin 1px
    + string miniStumpTemplate
    + a
    + class miniMap
    + {onClick}
    + {value}
    + {href}
    + div
    + class miniPreview
    + {theTiles}
    + div {filename}
    + class miniFooter
    + string bodyStumpTemplate
    + div
    + class MiniMapTile
    + {minis}
    + string miniStyleTemplate
    + div
    + javascript
    + async openFullPathInNewTabAndFocusCommand(url) {
    + return this.getTab()
    + .getRootNode()
    + .openFullPathInNewTabAndFocusCommand(url)
    + }
    + _getMiniStumpCode(sourceCode, filename, permalink, width = 120, height = 75) {
    + const ohayoProgram = new ohayoNode(sourceCode)
    + const theTiles = ohayoProgram
    + .getTiles()
    + .filter(tile => tile.isVisible())
    + .map(tile => this.qFormat(this.miniStyleTemplate, {}))
    + .join("\\n")
    + const onClick = permalink ? "clickCommand openFullPathInNewTabAndFocusCommand" : ""
    + const value = permalink ? \`value \${permalink}\` : ""
    + const href = permalink ? \`href \${permalink}\` : ""
    + return this.qFormat(this.miniStumpTemplate, { filename, theTiles, onClick, value, href })
    + }
    + getTileBodyStumpCode() {
    + // todo: cache.
    + const minis = this.getRowsWithRowDisplayLimit()
    + .map(row => this._getMiniStumpCode(row.getRowOriginalValue("bytes"), row.getRowOriginalValue("filename"), row.getRowOriginalValue("link")))
    + .join("\\n")
    + return this.qFormat(this.bodyStumpTemplate, { minis })
    + }
    + handsontableBasicNode
    + description A spreadsheet-like table.
    + string tileSize 1200 500
    + string tileCssScript ohayo/packages/handsontable/handsontable.min.css
    + string tileScript ohayo/packages/handsontable/handsontable.full.min.js
    + string hakonTemplate
    + .hot
    + color black
    + string bodyStumpTemplate
    + div
    + class hot
    + javascript
    + getTileBodyStumpCode() {
    + return this.bodyStumpTemplate
    + }
    + // todo: allow editing
    + treeComponentWillUnmount() {
    + if (this._hot) this._hot.destroy()
    + delete this._hot
    + }
    + treeComponentDidUpdate() {
    + super.treeComponentDidUpdate()
    + const table = this.getParentOrDummyTable()
    + const columnDefs = table.getColumnsByImportance()
    + const colNames = columnDefs.map(col => col.getColumnName())
    + const rows = this.getRowsWithRowDisplayLimit()
    + const data = this.getRowsAsDataTableArrayWithHeader(rows, colNames)
    + const container = this.getStumpNode().findStumpNodeByChild("class hot")
    + const app = this.getWebApp()
    + if (this.isNodeJs()) return undefined
    + const width = this.getTileRunTimeWidth()
    + const height = this.getTileRunTimeHeight()
    + this._hot = new Handsontable(container.getShadow().getShadowElement(), {
    + data: data,
    + rowHeaders: true,
    + colHeaders: true,
    + stretchH: "all",
    + width,
    + minSpareCols: 10,
    + minSpareRows: 30,
    + afterSelection: () => app.pauseShortcutListener(),
    + afterDeselect: () => app.startShortcutListener(),
    + height
    + })
    + return this._hot
    + }
    + treeComponentDidMount() {
    + this.treeComponentDidUpdate()
    + }
    + extends abstractChartNode
    + crux handsontable.basic
    + abstractHtmlNode
    + catchAllCellType htmlCell
    + frequency 0
    + description An HTML element
    + inScope styleNode contentNode
    + extends abstractChartNode
    + string hakonTemplate
    + .abstractHtmlNode
    + code
    + user-select text
    + abstract
    + string bodyStumpTemplate
    + {tag}
    + {style}
    + {src}
    + bern
    + {content}
    + javascript
    + getTileFooterStumpCode() {
    + return this.getTileMenuButtonStumpCode()
    + }
    + async fetchTableInputs() {
    + return { rows: [{ text: this.getHtmlContent() }] }
    + }
    + getHtmlContent() {
    + return this.getWordsFrom(2).join(" ") || "No html content to show."
    + }
    + getTag() {
    + return this.getWord(1) || "div" // todo: verify this is legal tag.
    + }
    + getSrc() {
    + return this.getSettingsStruct().src
    + }
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, { tag: this.getTag(), style: this.style ? \`style \${this.style}\` : "", src: this.getSrc() ? \`src \${this.getSrc()}\` : "", content: this.getHtmlContent() || "" })
    + }
    + htmlTextNode
    + description Displays fixed text in the given HTML element.
    + cells tileKeywordCell htmlTextTagCell
    + catchAllCellType htmlCell
    + frequency .002
    + extends abstractHtmlNode
    + crux html.text
    + htmlPrintAsNode
    + description Displays input table in the given HTML element.
    + cells tileKeywordCell htmlTextTagCell
    + frequency .002
    + javascript
    + getHtmlContent() {
    + return this.getPipishInput()
    + }
    + extends abstractHtmlNode
    + crux html.printAs
    + abstractHTMLFixedTagTileNode
    + abstract
    + extends abstractHtmlNode
    + javascript
    + getHtmlContent() {
    + return this.getContent()
    + }
    + getTag() {
    + return this.htmlTagName
    + }
    + htmlH1Node
    + catchAllCellType htmlCell
    + description Displays an H1 Header with fixed text
    + example A title
    + html.h1 Hello world
    + frequency .002
    + string tileSize 600 75
    + string htmlTagName h1
    + string style text-align:center;
    + extends abstractHTMLFixedTagTileNode
    + crux html.h1
    + abstractHTMLContentIsSrcTileNode
    + abstract
    + extends abstractHTMLFixedTagTileNode
    + javascript
    + getHtmlContent() {
    + return ""
    + }
    + getSrc() {
    + return this.getContent() || super.getSrc()
    + }
    + htmlImgNode
    + description Displays an image from given url.
    + cells tileKeywordCell urlCell
    + frequency .002
    + string htmlTagName img
    + string style width:100%;
    + extends abstractHTMLContentIsSrcTileNode
    + crux html.img
    + htmlIframeNode
    + description Displays an iframe from given url.
    + cells tileKeywordCell urlCell
    + string htmlTagName iframe
    + extends abstractHTMLContentIsSrcTileNode
    + crux html.iframe
    + htmlCustomNode
    + description Display custom HTML.
    + example Hello world
    + html.custom
    + content
    +

    Hello world

    + inScope contentNode
    + extends abstractChartNode
    + crux html.custom
    + string bodyStumpTemplate
    + div
    + bern
    + {content}
    + javascript
    + getTileBodyStumpCode() {
    + // https://meta.stackexchange.com/questions/1777/what-html-tags-are-allowed-on-stack-exchange-sites
    + // todo: sanitize tags
    + const contentNode = this.getNode("content")
    + const content = contentNode ? contentNode.childrenToString() : "No HTML content to show"
    + return this.qFormat(this.bodyStumpTemplate, { content })
    + }
    + iconsIconNode
    + extends abstractChartNode
    + abstract
    + iconsHumanNode
    + description Assuming each row in your data represents a human, creates a human icon.
    + example
    + samples.patients
    + icons.human
    + inScope genderColumnNode headSizeNode
    + string columnPredictionHints
    + headSize isString=false
    + genderColumn isString=true
    + string bodyStumpTemplate
    + div
    + bern
    + {bern}
    + javascript
    + getTileBodyStumpCode() {
    + // Now, what if there is no input table?
    + const table = this.getParentOrDummyTable()
    + const rows = table.getRows()
    + // Now, what if we are using dummy input table?
    + const headSizeColumn = this.getSettingsStruct().headSize
    + const genderColumn = this.getSettingsStruct().genderColumn
    + const reducts = table.getColumnByName(headSizeColumn).getReductions()
    + const headColMax = reducts.max
    + const bern = rows
    + .map(row => {
    + const typedRow = row.rowToObjectWithOnlyNativeJavascriptTypes()
    + const value = typedRow[headSizeColumn]
    + // TODO: ADD TYPINGS
    + const genderVal = typedRow[genderColumn].toLowerCase()
    + const gender = genderVal === "male" ? "blue" : "pink"
    + let character = "O"
    + let percent = value / headColMax
    + if (isNaN(value)) {
    + character = "x"
    + percent = reducts.median / headColMax
    + }
    + const title = row.getHoverTitle()
    + percent = Math.round(18 * percent)
    + return \`\${character}\`
    + })
    + .join(" ")
    + return this.qFormat(this.bodyStumpTemplate, { bern: bern })
    + }
    + string dummyDataSetName patients
    + extends iconsIconNode
    + crux icons.human
    + iconsCircleNode
    + description Displays a simple icon for each row of your data.
    + example
    + samples.iris
    + icons.circle
    + radius Petal.Length
    + inScope radiusNode
    + string columnPredictionHints
    + radius isString=false
    + string dummyDataSetName playerGoals
    + extends iconsIconNode
    + crux icons.circle
    + string bodyStumpTemplate
    + div
    + bern
    + {bern}
    + javascript
    + getTileBodyStumpCode() {
    + const column = this.getSettingsStruct().radius
    + const bern = this.getParentOrDummyTable()
    + .getRows()
    + .map(row => \`O\`)
    + .join(" ")
    + return this.qFormat(this.bodyStumpTemplate, { bern: bern })
    + }
    + listBasicNode
    + catchAllCellType columnNameCell
    + description Show 1 column as a text list.
    + example List of world's telescopes
    + samples.telescopes
    + list.basic
    + inScope labelNode
    + string bodyStumpTemplate
    + ol
    + {items}
    + string listItemStumpTemplate
    + li
    + span {label}
    + javascript
    + _getListItem(label) {
    + return this.qFormat(this.listItemStumpTemplate, { label })
    + }
    + _getLabelColumnName() {
    + // todo: more automatic! Need to fix our columns/keywords issues
    + return this.getWord(1) || this.getSettingsStruct().label
    + }
    + getTileBodyStumpCode() {
    + const labelColumnName = this._getLabelColumnName()
    + const items = this.getRowsWithRowDisplayLimit()
    + .map(row => this._getListItem(jtree.Utils.stripHtml(row.getRowOriginalValue(labelColumnName)), row))
    + .join("\\n")
    + return this.qFormat(this.bodyStumpTemplate, { items })
    + }
    + string tileSize 400 400
    + string dummyDataSetName telescopes
    + string columnPredictionHints
    + label getTitlePotential
    + extends abstractChartNode
    + crux list.basic
    + listLinksNode
    + description Show 1 column as a list of links, using 1 column for the url.
    + catchAllCellType columnNameCell
    + example List of world's telescopes with links
    + samples.telescopes
    + list.links
    + inScope labelNode linkNode
    + string dummyDataSetName telescopes
    + string listItemHakonTemplate
    + li
    + a {label}
    + href {link}
    + javascript
    + _getUrlColumnName() {
    + // todo: more automatic! Need to fix our columns/keywords issues
    + return this.getWord(2) || this.getSettingsStruct().link
    + }
    + _getListItem(label, row) {
    + const urlColumnName = this._getUrlColumnName()
    + if (!urlColumnName) return super._getListItem(label, row)
    + return this.qFormat(this.listItemHakonTemplate, { label, link: jtree.Utils.stripHtml(row.getRowOriginalValue(urlColumnName)) })
    + }
    + string columnPredictionHints
    + label getTitlePotential
    + link isLink
    + extends listBasicNode
    + crux list.links
    + markdownToHtmlNode
    + description Displays Markdown rendered as HTML.
    + example Show a text editor and some rendered Markdown.
    + data.inline
    + parser text
    + content
    + # My header
    + ## My subheader
    +
    + Hello world
    + markdown.toHtml
    + inScope contentNode
    + string bodyStumpTemplate
    + div
    + class TileSelectable
    + bern
    + {md}
    + javascript
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, { md: marked(this.getPipishInput()) })
    + }
    + string tileSize 400 400
    + string dummyDataSetName markdown
    + extends abstractChartNode
    + crux markdown.toHtml
    + abstractRoughJsChartNode
    + description Create sketchy/hand-drawn styled charts https://github.com/jwilber/roughViz
    + string tileScript ohayo/packages/roughjs/roughviz.min.js
    + extends abstractChartNode
    + abstract
    + catchAllCellType titleCell
    + inScope roughnessNode
    + javascript
    + _getRoughId() {
    + return \`rough\${this._getUid()}\`
    + }
    + treeComponentDidUpdate() {
    + super.treeComponentDidUpdate()
    + if (this.isNodeJs()) return undefined
    + this._drawRough()
    + }
    + treeComponentDidMount() {
    + this.treeComponentDidUpdate()
    + }
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, { id: this._getRoughId() })
    + }
    + get _roughness() {
    + const value = this.get("roughness")
    + return value ? parseInt(value) : 1
    + }
    + _getOptions() {
    + return {}
    + }
    + _drawRough() {
    + const colors = this.get("colors") ? this.get("colors").split(" ") : undefined
    + const options = Object.assign(this._getOptions(), {
    + title: this.getContent() || "",
    + element: "#" + this._getRoughId(),
    + roughness: this._roughness,
    + width: this.getTileRunTimeWidth(),
    + height: this.getTileRunTimeHeight(),
    + colors,
    + data: this._getRoughData()
    + })
    + const roughEl = new roughViz[this.roughChartType](options)
    + }
    + _getValues(settingName) {
    + const columName = this.mapSettingNamesToColumnNames([settingName])[0]
    + return this.getParentOrDummyTable()
    + .getColumnByName(columName)
    + .getValues()
    + }
    + string bodyStumpTemplate
    + div
    + id {id}
    + abstractRoughJsLabelValueNode
    + extends abstractRoughJsChartNode
    + string dummyDataSetName stockPrice
    + abstract
    + string columnPredictionHints
    + value getPrimitiveTypeName=number
    + javascript
    + _getRoughData() {
    + const data = { labels: this._getValues("label"), values: this._getValues("value") }
    + console.log(data)
    + return data
    + }
    + roughJsBarNode
    + crux roughjs.bar
    + inScope labelNode valueNode
    + extends abstractRoughJsLabelValueNode
    + string roughChartType Bar
    + example
    + samples.waterBill
    + roughjs.bar Past Year's Water Bill
    + label PaidOn
    + value Amount
    + roughJsPieNode
    + inScope labelNode valueNode
    + crux roughjs.pie
    + extends abstractRoughJsLabelValueNode
    + string roughChartType Pie
    + roughJsLineNode
    + inScope colorsNode
    + crux roughjs.line
    + extends abstractRoughJsChartNode
    + string roughChartType Line
    + example
    + samples.waterBill
    + roughjs.line Water Bill
    + javascript
    + _getNumericColumns() {
    + return Object.values(this.getParentOrDummyTable().getColumnsMap()).filter(col => col.isNumeric())
    + }
    + _getRoughData() {
    + const data = {}
    + const numerics = this._getNumericColumns()
    + numerics.forEach(col => {
    + data[col.getColumnName()] = col.getValues()
    + })
    + return data
    + }
    + _getOptions() {
    + const options = {}
    + const numerics = this._getNumericColumns()
    + numerics.forEach((col, index) => {
    + options["y" + index] = col.getColumnName()
    + })
    + return options
    + }
    + abstractShowTileNode
    + cells tileKeywordCell columnNameCell
    + catchAllCellType titleCell
    + frequency .02
    + example A dashboard for a Seattle family's water bill.
    + samples.waterBill
    + hidden
    + vega.scatter
    + tables.basic
    + show.mean Amount
    + show.median Amount
    + show.sum Amount
    + show.min Amount
    + show.max Amount
    + string tileSize 140 120
    + string dummyDataSetName stockPrice
    + extends abstractChartNode
    + abstract
    + string hakonTemplate
    + .abstractShowTileNode
    + h3
    + text-align center
    + h6
    + text-align center
    + height 40px
    + overflow hidden
    + string bodyStumpTemplate
    + h6 {title}
    + h3 {number}
    + javascript
    + getTileBodyStumpCode() {
    + const columnName = this.getWord(1)
    + if (!columnName) return \`No data for \${this.getFirstWord()}\`
    + const table = this.getParentOrDummyTable()
    + const col = table.getTableColumnByName(columnName)
    + if (!col) {
    + console.log(\`No column named \${columnName}\`)
    + return ""
    + }
    + const reductionName = this.reductionName || this.getWord(0).split(".")[1]
    + const title = this.getWordsFrom(2).join(" ") || [columnName, reductionName].join(" ")
    + const number = this.toDisplayString(col.getReductions()[reductionName], columnName)
    + return this.qFormat(this.bodyStumpTemplate, { title, number })
    + }
    + showRowCountNode
    + catchAllCellType titleCell
    + description Show the total number of rows
    + frequency .02
    + string tileSize 140 120
    + string dummyDataSetName stockPrice
    + cells tileKeywordCell
    + extends abstractShowTileNode
    + string defaultTitle Total rows
    + crux show.rowCount
    + javascript
    + getTileBodyStumpCode() {
    + const title = this.getWordsFrom(1).join(" ") || this.defaultTitle
    + return this.qFormat(this.bodyStumpTemplate, { title, number: this._getNumber() })
    + }
    + _getNumber() {
    + return this.getParentOrDummyTable().getRowCount()
    + }
    + showColumnCountNode
    + extends showRowCountNode
    + string defaultTitle Total columns
    + description Show the total number of columns
    + crux show.columnCount
    + javascript
    + _getNumber() {
    + return this.getParentOrDummyTable().getColumnNames().length
    + }
    + showStaticNode
    + description Show a hard coded number
    + extends abstractShowTileNode
    + example
    + show.static 20 Sales
    + cells tileKeywordCell numberCell
    + catchAllCellType titleCell
    + crux show.static
    + javascript
    + getTileBodyStumpCode() {
    + const title = this.getWordsFrom(2).join(" ")
    + return this.qFormat(this.bodyStumpTemplate, { title, number: this.getWord(1) || "" })
    + }
    + showValueNode
    + description Show the value of a column with 1 row
    + extends abstractShowTileNode
    + crux show.value
    + string reductionName median
    + showMedianNode
    + description Show the median value of a column
    + extends abstractShowTileNode
    + crux show.median
    + showSumNode
    + description Show the sum of a column
    + extends abstractShowTileNode
    + crux show.sum
    + showMeanNode
    + description Show the mean of a column
    + extends abstractShowTileNode
    + crux show.mean
    + showMinNode
    + description Show the min value of a column
    + extends abstractShowTileNode
    + crux show.min
    + showMaxNode
    + description Show the max value of a column
    + extends abstractShowTileNode
    + crux show.max
    + tablesBasicNode
    + frequency .1
    + description Basic table with sorting.
    + example Basic table with Iris data
    + samples.iris
    + tables.basic
    + inScope columnLimitNode
    + int rowDisplayLimit 100
    + int columnLimit 20
    + string tileSize 750 300
    + todo added the below to allow custom body styling in tables
    + string customBodyStyle padding:0px;
    + string hakonTemplate
    + .tablesBasicNode
    + font-size 14px
    + box-sizing border-box
    + {enableTextSelect1}
    + table
    + width 100%
    + tr
    + white-space nowrap
    + padding 0
    + td
    + border 1px solid {lineColor}
    + tr:nth-child(even)
    + background-color {veryLightGrey}
    + td,th
    + padding 2px 3px
    + text-align left
    + overflow hidden
    + text-overflow ellipsis
    + max-width 250px
    + td:hover,th:hover
    + overflow visible
    + td:first-child,th:first-child
    + padding-left 5px
    + color {greyish}
    + width 60px
    + th
    + cursor pointer
    + background-color {lightGrey}
    + border 1px solid {lineColor}
    + border-bottom-color {greyish}
    + string cellStumpTemplate
    + td
    + bern
    + {content}
    + string cellLinkStumpTemplate
    + td
    + a
    + href {content}
    + bern
    + {content}
    + string rowStumpTemplate
    + tr
    + class tableRow
    + value {value}
    + td {number}
    + {cols}
    + javascript
    + _getTableRowsStumpCode(columns) {
    + return this.getRowsWithRowDisplayLimit()
    + .map((row, index) => {
    + const cols = columns
    + .map(column => {
    + return this.qFormat(column.isLink() ? this.cellLinkStumpTemplate : this.cellStumpTemplate, { content: row.getRowHtmlSafeValue(column.getColumnName()) })
    + })
    + .join("\\n")
    + return this.qFormat(this.rowStumpTemplate, { number: index + 1, value: row.getPuid(), cols })
    + })
    + .join("\\n")
    + }
    + _getHeaderRowsStumpCode(columns) {
    + // todo: can we get a copy column command?
    + return ["Row"]
    + .concat(columns)
    + .map(colName => this.qFormat(this.headerRowStumpTemplate, { colName }))
    + .join("\\n")
    + }
    + getTileBodyStumpCode() {
    + const tileStruct = this.getSettingsStruct()
    + const table = this.getParentOrDummyTable()
    + if (table.isBlankTable()) return \`div No data to show\`
    + let columnDefs = tileStruct.columnOrder === "importance" ? table.getColumnsByImportance() : table.getColumnsArray()
    + columnDefs = columnDefs.slice(0, tileStruct.columnLimit || this.columnLimit)
    + const columnNames = columnDefs.map(col => col.getColumnName())
    + // todo: if the types for a column are all equal, add a total row to the bottom.
    + // todo: if the types for a row are all equal, add a total column to the right.
    + const headerRows = this._getHeaderRowsStumpCode(columnNames)
    + const bodyRows = this._getTableRowsStumpCode(columnDefs)
    + return this.qFormat(this.bodyStumpTemplate, { headerRows, bodyRows })
    + }
    + string headerRowStumpTemplate
    + th
    + value {colName}
    + span {colName}
    + value {colName}
    + string bodyStumpTemplate
    + div
    + class tablesBasicNode
    + table
    + thead
    + {headerRows}
    + tbody
    + {bodyRows}
    + extends abstractChartNode
    + crux tables.basic
    + tablesInterestingNode
    + frequency .01
    + description Prints most interesting columns.
    + string columnOrder importance
    + extends tablesBasicNode
    + crux tables.interesting
    + tablesDumpNode
    + description Prints data with no formatting or column reordering.
    + frequency .01
    + string columnOrder default
    + extends tablesBasicNode
    + crux tables.dump
    + textWordcloudNode
    + description Turn text into a word cloud.
    + inScope columnNode countNode
    + example A poem analyzed
    + samples.poem
    + text.wordCount
    + text.wordcloud
    + string bodyStumpTemplate
    + div
    + class divWhereWordCloudWillGo
    + style height: 300px;
    + javascript
    + getTileBodyStumpCode() {
    + return this.bodyStumpTemplate
    + }
    + _getAllWords() {
    + return this.getRequiredTableWithHeader(["name", "count"])
    + }
    + treeComponentDidUpdate() {
    + this._draw()
    + }
    + treeComponentDidMount() {
    + this._draw()
    + }
    + _draw() {
    + if (this.isNodeJs()) return undefined
    + const tileStruct = this.getSettingsStruct()
    + const words = this._getAllWords()
    + if (!words.length) return
    + words.shift() // drop header
    + const shadow = this.getStumpNode().getShadow()
    + const width = shadow.getShadowOuterWidth()
    + const powConstant = 10 / Math.log(words.length) // breaks if too hgih.
    + const options = {
    + list: words.map(word => [word[0], word[1]]),
    + shuffle: false,
    + gridSize: Math.round((16 * width) / 1024),
    + weightFactor: size => (Math.pow(size, powConstant) * width) / 1024,
    + backgroundColor: "transparent",
    + random: jtree.Utils.makeSemiRandomFn(),
    + wait: 0
    + }
    + Object.assign(options, tileStruct)
    + const element = this.getStumpNode()
    + .findStumpNodeByChild("class divWhereWordCloudWillGo")
    + .getShadow()
    + .getShadowElement()
    + WordCloud(element, options)
    + }
    + string tileScript ohayo/packages/text/wordcloud2.min.js
    + string dummyDataSetName wordCounts
    + string columnPredictionHints
    + name isString=true
    + count isString=false
    + extends abstractChartNode
    + crux text.wordcloud
    + treenotation3dNode
    + description A 3D visualization of Ohayo source code.
    + example 3D vis of a Ohayo Program.
    + samples.treeProgram
    + treenotation.3d
    + inScope contentNode sizeNode cameraPositionNode
    + string tileSize 800 500
    + string tileScript ohayo/packages/treenotation/vis.min.js
    + string dummyDataSetName treeProgram
    + extends abstractChartNode
    + crux treenotation.3d
    + javascript
    + getTileBodyStumpCode() {
    + return \`div
    + class visjs\`
    + }
    + treeComponentDidMount() {
    + super.treeComponentDidMount()
    + this.treeComponentDidUpdate()
    + }
    + // Called when the Visualization API is loaded.
    + treeComponentDidUpdate() {
    + super.treeComponentDidUpdate()
    + if (this.isNodeJs()) return undefined
    + try {
    + this._tryVis()
    + } catch (err) {
    + // log error
    + console.error(err)
    + }
    + }
    + _tryVis() {
    + const tileStruct = this.getSettingsStruct()
    + const source = this.getPipishInput()
    + const app = this.getWebApp()
    + const program = new ohayoNode(source)
    + const rows = this._treeTo3D(program)
    + // Create and populate a data table.
    + const data = new vis.DataSet()
    + rows.forEach(row => data.add(row))
    + const dotSize = tileStruct.size
    + const showGrid = tileStruct.showGrid
    + // specify options
    + // docs: http://visjs.org/docs/graph3d/
    + const cameraPositionNode = this.getNode("cameraPosition") || new jtree.TreeNode("cameraPosition 4 .1 1.5").getNode("cameraPosition")
    + const distance = parseFloat(cameraPositionNode.getWord(1))
    + const horizontal = parseFloat(cameraPositionNode.getWord(2))
    + const vertical = parseFloat(cameraPositionNode.getWord(3))
    + const options = {
    + width: this.getTileRunTimeWidth() + "px",
    + height: this.getTileRunTimeHeight() - 80 + "px",
    + style: "dot-color", // dot?
    + showPerspective: false,
    + showLegend: false,
    + showShadow: false,
    + keepAspectRatio: true,
    + xStep: 1,
    + yStep: 1,
    + zStep: 1,
    + zMax: 5,
    + showGrid: true,
    + showZAxis: false,
    + showXAxis: false,
    + showYAxis: false,
    + dotSizeRatio: dotSize,
    + dotSizeMinFraction: 1,
    + cameraPosition: {
    + distance: distance,
    + horizontal: horizontal,
    + vertical: vertical
    + },
    + verticalRatio: 1.0,
    + // parameter point contains properties x, y, z, and data
    + // data is the original object passed to the point constructor
    + tooltip: point => point.data.line
    + }
    + // create a graph3d
    + const element = this.getStumpNode()
    + .findStumpNodeByChild("class visjs")
    + .getShadow()
    + .getShadowElement()
    + this._graph3d = new vis.Graph3d(element, data, options)
    + const throttled = lodash.throttle(evt => this._onCameraPositionChange(evt), 100)
    + this._graph3d.on("cameraPositionChange", throttled)
    + }
    + async _onCameraPositionChange(evt) {
    + // todo: throttle
    + const pos = this._graph3d.getCameraPosition()
    + const str = \`\${pos.distance} \${pos.horizontal} \${pos.vertical}\`
    + this.touchNode("cameraPosition").setContent(str)
    + await this.getTab().autosaveTab()
    + }
    + _treeTo3D(program) {
    + // getCameraPosition
    + // setCameraPosition
    + // onCameraPositionChange
    + const theme = this.getWebApp().getTheme()
    + // todo: use node type for color.
    + const tagMap = {}
    + const tagTree = new jtree.TreeNode(program.toCellTypeTree())
    + // const outlineFn = node => node.getIndex()
    + // use language to get dict, use dict to get type overlay to get tag types.
    + const randomFn = jtree.Utils.makeSemiRandomFn()
    + const makeColor = word => {
    + if (!tagMap[word]) tagMap[word] = randomFn() // todo: give word types certain colors. green for keword, red for error, etc
    + const color = tagMap[word]
    + //console.log(color)
    + return color
    + }
    + const points = []
    + const nodeToPoint = (node, index) => {
    + const nodePath = node.getPathVector(program)
    + const tagNode = tagTree.nodeAt(nodePath)
    + node.getWords().forEach((word, wordIndex) => {
    + const wordType = tagNode.getWord(wordIndex)
    + const colorNumber = makeColor(wordType)
    + const xcc = node.getIndentLevel(program) + wordIndex
    + const ycc = -node.getLineNumber()
    + const zcc = 0
    + points.push({
    + x: xcc,
    + y: ycc,
    + z: zcc,
    + line: \`cellType: \${wordType} | word: \${word}\`,
    + style: colorNumber
    + })
    + })
    + }
    + program.getTopDownArray().forEach(nodeToPoint)
    + return points
    + }
    + treenotationOutlineNode
    + description A simple pretty text-only view of a Tree Notation document.
    + example Outer space
    + samples.outerSpace
    + treenotation.outline
    + string dummyDataSetName outerSpace
    + string tileSize 800 500
    + extends abstractChartNode
    + crux treenotation.outline
    + string bodyStumpTemplate
    + pre
    + style overflow: scroll; width: 100%; height: 100%; margin: 0; box-sizing: border-box; font-family: monospace; line-height: 13px;
    + bern
    + {bern}
    + javascript
    + _getTheBern() {
    + return new jtree.TreeNode(this.getPipishInput()).toOutline()
    + }
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, { bern: this._getTheBern() })
    + }
    + treenotationDotlineNode
    + description A simple pretty icon-only visualization of the structure of a Tree Notation doc.
    + example Outer space
    + samples.outerSpace
    + treenotation.dotline
    + boolean dots true
    + string dummyDataSetName outerSpace
    + javascript
    + _getTheBern() {
    + return new jtree.TreeNode(this.getPipishInput()).toMappedOutline(
    + node =>
    + "o" +
    + node
    + .getLine()
    + .split(" ")
    + .map(word => "º")
    + .join("")
    + )
    + }
    + extends treenotationOutlineNode
    + crux treenotation.dotline
    + abstractVegaNode
    + frequency .1
    + catchAllCellType titleCell
    + string tileSize 800 300
    + string tileScript ohayo/packages/vega/vega.combined.min.js
    + string dummyDataSetName stockPrice
    + string markName bar
    + extends abstractChartNode
    + abstract
    + string bodyStumpTemplate
    + div
    + class divForExternalLibrary
    + javascript
    + // todo: I don't think vega handles . in column names.
    + getTileBodyStumpCode() {
    + return this.bodyStumpTemplate
    + }
    + _getColumnToField(columnName) {
    + if (!columnName) return undefined
    + const columnsMap = this.getParentOrDummyTable().getColumnsMap()
    + const col = columnsMap[columnName]
    + const obj = { field: columnName, type: col.getVegaType() }
    + if (col.isTemporal()) {
    + const timeUnit = col.getVegaTimeUnit()
    + if (timeUnit) obj.timeUnit = timeUnit
    + }
    + return obj
    + }
    + _getElementForVega() {
    + return this.getStumpNode()
    + .findStumpNodeByChild("class divForExternalLibrary")
    + .getShadow()
    + .getShadowElement()
    + }
    + async _drawVega() {
    + // todo: don't rerun this if we dont need to.
    + await vegaEmbed(this._getElementForVega(), this._getVegaSpec())
    + }
    + treeComponentDidUpdate() {
    + super.treeComponentDidUpdate()
    + if (this.isNodeJs()) return undefined
    + this._drawVega()
    + }
    + treeComponentDidMount() {
    + this.treeComponentDidUpdate()
    + }
    + _getVegaData() {
    + return {
    + values: this.getParentOrDummyTable()
    + .cloneNativeJavascriptTypedRows()
    + .slice(0, this._getRowDisplayLimit())
    + }
    + }
    + _getVegaTitle() {
    + return this.getContent()
    + }
    + _getVegaSpec() {
    + return {
    + description: "A simple bar chart with embedded data.",
    + data: this._getVegaData(),
    + width: this.getTileRunTimeWidth(),
    + height: this.getTileRunTimeHeight(),
    + mark: this._getVegaMarkObj(),
    + encoding: this._getEncodingMap(),
    + transform: this._getVegaTransform(),
    + title: this._getVegaTitle(),
    + config: this._getVegaConfig()
    + }
    + }
    + _getVegaTransform() {
    + return undefined
    + }
    + _getVegaConfig() {
    + return undefined
    + }
    + _getEncodingMap() {
    + return {}
    + }
    + // todo: add type
    + _getVegaMarkObj() {
    + return { type: this._getVegaMark(), tooltip: { content: "data" } }
    + }
    + _getVegaMark() {
    + return this.markName
    + }
    + vegaBarNode
    + description A bar chart
    + inScope xColumnNode yColumnNode colorColumnNode shapeColumnNode
    + javascript
    + _getEncodingMap() {
    + const columnNames = this.mapSettingNamesToColumnNames([this.xColumnKey, this.yColumnKey, this.colorColumnKey])
    + return {
    + x: this._getColumnToField(columnNames[0]),
    + y: this._getColumnToField(columnNames[1]),
    + color: this._getColumnToField(columnNames[2])
    + }
    + }
    + string columnPredictionHints
    + xColumn
    + yColumn isString=false,!xColumn
    + extends abstractVegaNode
    + crux vega.bar
    + vegaLineNode
    + description A line chart
    + string markName line
    + extends vegaBarNode
    + crux vega.line
    + vegaAreaNode
    + description An area chart
    + string markName area
    + extends vegaLineNode
    + crux vega.area
    + vegaScatterNode
    + description A scatterplot
    + string markName point
    + extends vegaBarNode
    + crux vega.scatter
    + javascript
    + _getEncodingMap() {
    + const columnNames = this.mapSettingNamesToColumnNames([this.xColumnKey, this.yColumnKey, this.colorColumnKey, this.shapeColumnKey])
    + return {
    + x: this._getColumnToField(columnNames[0]),
    + y: this._getColumnToField(columnNames[1]),
    + color: this._getColumnToField(columnNames[2]),
    + shape: this._getColumnToField(columnNames[3])
    + }
    + }
    + vegaBubbleNode
    + description A bubble plot
    + inScope sizeColumnNode colorColumnNode
    + string markName circle
    + string dummyDataSetName gapMinder
    + string columnPredictionHints
    + sizeColumn isString=false
    + xColumn isString=false
    + extends vegaScatterNode
    + crux vega.bubble
    + javascript
    + _getEncodingMap() {
    + const columnNames = this.mapSettingNamesToColumnNames([this.xColumnKey, this.yColumnKey, this.sizeColumnKey, this.colorColumnKey])
    + return {
    + y: {
    + field: columnNames[1],
    + type: "quantitative",
    + scale: { zero: false },
    + axis: { minExtent: 30 }
    + },
    + x: this._getColumnToField(columnNames[0]),
    + size: { field: columnNames[2], type: "quantitative" },
    + color: { value: "#000" }
    + }
    + }
    + vegaEmojiNode
    + description A bar chart with emojis
    + frequency .001
    + inScope yColumnNode emojiColumnNode
    + string columnPredictionHints
    + emojiColumn isString=true
    + yColumn isString=false
    + string dummyDataSetName emojis
    + javascript
    + _getVegaConfig() {
    + return { view: { stroke: "" } }
    + }
    + _getVegaMark() {
    + return { type: "text", baseline: "middle" }
    + }
    + _getEncodingMap() {
    + const columnNames = this.mapSettingNamesToColumnNames([this.yColumnKey, "emoji"])
    + return {
    + x: { field: columnNames[1], type: "nominal", axis: null },
    + y: { field: columnNames[0], type: "quantitative", axis: null, sort: null },
    + text: { field: columnNames[1], type: "nominal" },
    + size: { value: 65 }
    + }
    + }
    + extends vegaBarNode
    + crux vega.emoji
    + vegaHistogramNode
    + description A histogram
    + inScope xColumnNode
    + javascript
    + _getEncodingMap() {
    + const columnName = this.getContent() || this.mapSettingNamesToColumnNames([this.xColumnKey])[0]
    + return {
    + x: {
    + bin: true,
    + field: columnName,
    + type: "quantitative"
    + },
    + y: {
    + aggregate: "count",
    + type: "quantitative"
    + }
    + }
    + }
    + string columnPredictionHints
    + xColumn isString=false
    + string dummyDataSetName wordCounts
    + extends abstractVegaNode
    + crux vega.histogram
    + vegaExampleNode
    + description Shows a chart from the Vega Example Gallery
    + frequency .001
    + cells tileKeywordCell vegaExampleNameCell
    + example
    + vega.example trellis_anscombe
    + extends abstractVegaNode
    + crux vega.example
    + javascript
    + _getVegaSpec() {
    + return this._spec
    + }
    + async _fetchSpec() {
    + // todo: localtesting.
    + if (this.isNodeJs()) return undefined
    + const exampleName = this.getContent() || "area" // todo: pull this default from the gram?
    + const url = \`ohayo/packages/vega/ignore/vega-lite/examples/compiled/\${exampleName}.vg.json\`
    + const res = await this.getWebApp()
    + .getWillowBrowser()
    + .httpGetUrl(url)
    + const spec = JSON.parse(res.text)
    + // rewrite data urls
    + spec.data.forEach(row => {
    + if (row.url) row.url = row.url.replace("data/", "packages/vega/datasets/")
    + })
    + this._spec = spec
    + return spec
    + }
    + // todo: clean this up.
    + async fetchTableInputs() {
    + const spec = await this._fetchSpec()
    + if (this.isNodeJs()) return { rows: [] }
    + const el = jQuery("
    ")[0]
    + const embedded = await vegaEmbed(el, spec)
    + const rows = await this._getVegaPostTransformOutputRows(spec, embedded)
    + return { rows: rows }
    + }
    + async _getVegaPostTransformOutputRows(spec, embedded) {
    + const tableName = spec.data[0] && spec.data[0].name
    + if (tableName) return embedded.view.data(tableName)
    + // const values = spec.data.values
    + // if (values && values.entries) return Array.from(values.entries())
    + // if (typeof values === "function") return []
    + // else if (values) return values
    + return []
    + }
    + DidYouMeanTileNode
    + tags noPicker
    + description Provides suggestions for misspelled tiles.
    + extends abstractTileTreeComponentNode
    + crux tiles.didyoumean
    + string bodyStumpTemplate
    + div
    + span No tile '{input}' found. Line {lineNo}. Did you mean
    + a {closestTile}
    + collapse
    + tabindex -1
    + value {closestTile}
    + clickCommand changeTileTypeCommand
    + span ?
    + javascript
    + getTileBodyStumpCode() {
    + const input = this.getFirstWord()
    + const lineNo = this.getLineNumber()
    + const closestTile = jtree.Utils.didYouMean(
    + input,
    + this.getRootNode()
    + .getHandGrammarProgram()
    + .getTopNodeTypeDefinitions()
    + .map(def => def.get("crux"))
    + )
    + if (!closestTile) {
    + if (!input) return \`div Your program has a blank line on line \${lineNo}.\`
    + return \`div No tile '\${input}' found.\`
    + }
    + return this.qFormat(this.bodyStumpTemplate, { input, lineNo, closestTile })
    + }
    + getErrors() {
    + return [new jtree.UnknownNodeTypeError(this)]
    + }
    + abstractDocTileNode
    + tags noPicker
    + cells tileKeywordCell
    + extends abstractTileTreeComponentNode
    + abstract
    + string bodyStumpTemplate
    + {tagName}
    + bern
    + {content}
    + string tileStumpTemplate
    + div
    + class {classes}
    + id {id}
    + div
    + class TileBody
    + {body}
    + div
    + class TileFooter
    + {footer}
    + javascript
    + _getBody() {
    + return this.qFormat(this.bodyStumpTemplate, { content: this.getContent() || "", tagName: this.tagName })
    + }
    + toStumpCode() {
    + return this.qFormat(this.tileStumpTemplate, { classes: this.getCssClassNames().join(" "), footer: this.getTileMenuButtonStumpCode(), id: this.getTreeComponentId(), body: this._getBody() })
    + }
    + docTitleNode
    + catchAllCellType stringCell
    + description A title
    + example A doc
    + doc.title A Tale of Two Cities
    + string tileSize 600 75
    + extends abstractDocTileNode
    + cells tileKeywordCell
    + crux doc.title
    + string tagName h1
    + docSubtitleNode
    + extends docTitleNode
    + description A subheader
    + string tagName h2
    + crux doc.subtitle
    + docSectionNode
    + description A section containing subtitles, paragraphs, code blocks, etc.
    + crux doc.section
    + extends abstractDocTileNode
    + inScope abstractDocSectionComponentNode
    + javascript
    + _getBody() {
    + return this.compile()
    + }
    + _getCompiledLine() {
    + return ""
    + }
    + example
    + doc.section
    + subtitle Subtitle
    + paragraph Paragraph
    + code python
    + # some code
    + docReferenceNode
    + extends abstractDocTileNode
    + crux doc.ref
    + cells tileKeywordCell referenceIdCell
    + inScope docReferenceUrlNode
    + string tagName p
    + example
    + doc.ref someRefId
    + url https://en.wikipedia.org/wiki/Note_(typography)
    + description A reference to an external source
    + docCommentNode
    + description A comment node
    + cells commentKeywordCell
    + extends abstractTileTreeComponentNode
    + boolean visible false
    + frequency 0
    + example An example program with comments
    + doc.comment get iris data
    + samples.iris
    + doc.comment filter is
    + filter.where Species = virginica
    + doc.comment display results
    + tables.basic
    + catchAllCellType commentCell
    + catchAllNodeType commentLineNode
    + crux doc.comment
    + docToolingNode
    + extends docCommentNode
    + crux doc.tooling
    + abstractProviderNode
    + string tileSize 140 60
    + extends abstractTileTreeComponentNode
    + abstract
    + string tileStumpTemplate
    + div
    + class {classes}
    + id {id}
    + div
    + class TileBody
    + {body}
    + div
    + class TileFooter
    + {footer}
    + string tileFooterTemplate
    + span Rows Out: {outputCount} Columns Out: {columnCount} Time: {time}s Parser: {parserId} {errorMessageHtml}
    + {tileMenuButton}
    + javascript
    + getTileFooterStumpCode() {
    + const table = this.getOutputOrInputTable()
    + const time = (this.getTimeToLoad() / 1000).toFixed(1)
    + const parserId = this.getParserId() || "?"
    + return this.qFormat(this.tileFooterTemplate, {
    + parserId,
    + errorMessageHtml: this.getErrorMessageHtml() || "",
    + time,
    + outputCount: table.getRowCount(),
    + columnCount: table.getColumnCount(),
    + tileMenuButton: this.getTileMenuButtonStumpCode()
    + })
    + }
    + getRowClass() {
    + return Row
    + }
    + getTileBodyStumpCode() {
    + const description = this._getDescription()
    + return "div " + (description ? jtree.Utils.linkify(description) : "")
    + }
    + _getDescription() {
    + return this.getDefinition().get("description")
    + }
    + toStumpCode() {
    + return this.qFormat(this.tileStumpTemplate, { classes: this.getCssClassNames().join(" "), id: this.getTreeComponentId(), body: this._getBodyStumpCodeCache(), footer: this.getTileFooterStumpCode() })
    + }
    + getParserId() {
    + return this.getSettingsStruct().parser
    + }
    + async fetchTableInputs() {
    + return {
    + rows: []
    + }
    + }
    + async _execute() {
    + const timeLoadStarted = this._getProcessTimeInMilliseconds()
    + this._timeLastLoadStarted = timeLoadStarted
    + const fetchedTableInputs = await this.fetchTableInputs()
    + // If a new request happened after this one, abort this one.
    + // todo: what happens to children?
    + // todo: add testing for this.
    + if (this._timeLastLoadStarted !== timeLoadStarted) {
    + console.log("superceded")
    + return null
    + }
    + this._outputTable = new Table(fetchedTableInputs.rows, fetchedTableInputs.columnDefinitions, this.getRowClass())
    + this._timeToLoad = this._getProcessTimeInMilliseconds() - timeLoadStarted
    + this.setIsDataLoaded(true)
    + await this._executeChildNodes()
    + }
    + abstractUrlNoCellsNode
    + boolean useCache true
    + inScope parserNode useCacheNode
    + string tileSize 300 150
    + extends abstractProviderNode
    + abstract
    + javascript
    + getUrl() {
    + const struct = Object.assign(this.getSettingsStruct(), this.getDefinition().getConstantsObject())
    + if (struct.urlTemplate && this.getContent()) return new jtree.TreeNode({ content: this.getContent() }).evalTemplateString(struct.urlTemplate)
    + if (struct.urlPrefix && this.getContent()) return struct.urlPrefix + this.getContent()
    + return struct.urlCell || this.getContent() || this.url || ""
    + }
    + getParserId() {
    + if (this.parser) return this.parser
    + const url = this.getUrl()
    + if (super.getParserId()) return super.getParserId()
    + const extension = jtree.Utils.getFileExtension(url)
    + if (new TableParser().getAllTableParserIds().includes(extension)) return extension
    + }
    + getWillowHttpResponse() {
    + return this._willowHttpResponse
    + }
    + _setWillowHttpResponse(willowHttpResponse) {
    + this._willowHttpResponse = willowHttpResponse
    + return this
    + }
    + // todo: add support for Arrow.
    + // todo: remove this cache. use higher level.
    + async _getData(url) {
    + const useCache = this.getSettingsStruct().useCache !== "false" || this.useCache
    + const willowBrowser = this.getWebApp().getWillowBrowser()
    + let response
    + if (useCache) response = await willowBrowser.httpGetUrlFromCache(url)
    + else response = await willowBrowser.httpGetUrl(url)
    + if (response.fromCache)
    + this.emitLogMessage(\`div
    + bern
    + Loading from cache: \${url}\`)
    + this._setWillowHttpResponse(response)
    + return response.getParsedDataOrText()
    + }
    + async fetchTableInputs() {
    + let url = this.getUrl()
    + if (!url) return { rows: [] }
    + url = encodeURI(url)
    + const parserId = this.getParserId()
    + this.setRunTimePhaseError("fetchUrl")
    + try {
    + const data = await this._getData(url)
    + const parser = new TableParser()
    + if (typeof data === "string") return parser.parseTableInputsFromString(data, parserId)
    + if (this.jsonPath) return parser.parseTableInputsFromObject(data[this.jsonPath], parserId)
    + return parser.parseTableInputsFromObject(data, parserId)
    + } catch (err) {
    + // todo: solve the superagent not throwing response message thing.
    + const txt = (err.text || err.toString()).substr(0, 280)
    + this.emitLogMessage(\`Error getting url: \${url}
    + \${txt}\`)
    + this.setRunTimePhaseError("fetchUrl", txt)
    + return { rows: [] }
    + }
    + }
    + abstractUrlNode
    + cells tileKeywordCell urlCell
    + string tileSize 300 100
    + extends abstractUrlNoCellsNode
    + abstract
    + abstractUrlsNode
    + extends abstractUrlNode
    + javascript
    + getUrls() {
    + return this.getWordsFrom(1).map(url => (this.urlPrefix || "") + url)
    + }
    + async fetchTableInputs() {
    + // todo: allow cache breaking.
    + const app = this.getWebApp()
    + const willowBrowser = app.getWillowBrowser()
    + let allResults = []
    + const urls = this.getUrls()
    + const fetchMethod = async url => (app.isUrlGetProxyAvailable() ? willowBrowser.httpGetUrlFromProxyCache(url) : willowBrowser.httpGetUrlFromCache(url))
    + for (let url of urls) {
    + const response = await fetchMethod(url)
    + allResults.push(response)
    + }
    + return { rows: allResults.map(res => res.asJson) }
    + }
    + githubInfoNode
    + frequency .01
    + tags internetConnectionRequired
    + extends abstractUrlsNode
    + string dataDomain github.com
    + catchAllCellType githubRepoCell
    + cells tileKeywordCell
    + description Get basic information on a GitHub repo(s)
    + string urlPrefix https://api.github.com/repos/
    + crux github.info
    + diskBrowseNode
    + frequency .01
    + tags localVersion
    + catchAllCellType pathCell
    + description An interactive list of files and folders.
    + string hakonTemplate
    + .DiskTile
    + table
    + width 100%
    + td,th
    + overflow hidden
    + text-overflow ellipsis
    + tr
    + white-space nowrap
    + javascript
    + getUrl() {
    + return this.getContent() ? "/disk?path=" + this.getContent() : "/disk"
    + }
    + getTileBodyStumpCode() {
    + const labelCol = "name"
    + const path = this.getContent() || ""
    + const parentPath = path.replace(/\\/[^\\/]*$/, "")
    + const rowDisplayLimit = 1000 // todo: adjustable?
    + let rows = this.getOutputTable()
    + .getRows()
    + .slice(0, rowDisplayLimit)
    + rows = lodash.sortBy(rows, row => row.getRowOriginalValue("isDirectory") === "false")
    + return \`input
    + placeholder Filepath
    + value \${path}
    + changeCommand changeTileContentAndRenderCommand
    + class LargeTileInput
    + table
    + tr
    + td
    + a ..
    + clickCommand changeTileContentAndRenderCommand
    + value \${parentPath}
    + \${rows
    + .map(row => {
    + const label = jtree.Utils.stripHtml(row.getRowOriginalValue(labelCol))
    + const isDir = row.getRowOriginalValue("isDirectory") === "true"
    + const size = row.getRowOriginalValue("bytes")
    + const mtime = row.getRowOriginalValue("mtime")
    + if (!isDir)
    + return \` tr
    + td \${label}
    + td \${numeral(size).format("0.0 b")}
    + td \${moment(parseFloat(mtime)).fromNow()}\`
    + return \` tr
    + td
    + a \${label}
    + clickCommand changeTileContentAndRenderCommand
    + value \${path.replace(/\\/$/, "") + "/" + label}\`
    + })
    + .join("\\n")}\`
    + }
    + string tileSize 500 500
    + extends abstractUrlNode
    + crux disk.browse
    + diskReadNode
    + frequency .01
    + tags localVersion
    + description Reads a file from disk.
    + string urlPrefix /disk.read?path=
    + extends abstractUrlNode
    + crux disk.read
    + abstractHackernewsNode
    + frequency .01
    + tags internetConnectionRequired
    + extends abstractUrlNode
    + string dataDomain news.ycombinator.com
    + abstract
    + hackernewsTopNode
    + cells tileKeywordCell quantityCell
    + description Get the top stories on hackernews
    + example A dashboard of the Hacker News homepage.
    + hackernews.top 10
    + rows.sortBy by
    + tables.basic
    + vega.scatter
    + xColumn time
    + yColumn score
    + javascript
    + async fetchTableInputs() {
    + // todo: allow cache breaking.
    + const willowBrowser = this.getWebApp().getWillowBrowser()
    + const firstUrls = this._getFirstUrls()
    + if (!firstUrls.length || this.isNodeJs()) return []
    + let allResults = []
    + const fetchMethod = async url => (this.getWebApp().isUrlGetProxyAvailable() ? willowBrowser.httpGetUrlFromProxyCache(url) : willowBrowser.httpGetUrlFromCache(url))
    + for (let mainUrl of firstUrls) {
    + const response = await fetchMethod(mainUrl)
    + const nextUrls = this._parseNextUrls(response)
    + const batchResults = await Promise.all(nextUrls.slice(0, this._getLimit()).map(url => fetchMethod(url)))
    + allResults = allResults.concat(batchResults)
    + }
    + return { rows: allResults.map(res => res.asJson) }
    + }
    + _getLimit() {
    + return parseInt(this.getContent() || 10)
    + }
    + _parseNextUrls(response) {
    + return response.asJson.map(id => \`https://hacker-news.firebaseio.com/v0/item/\${id}.json?print=pretty\`)
    + }
    + _getFirstUrls() {
    + return ["https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"]
    + }
    + extends abstractHackernewsNode
    + crux hackernews.top
    + hackernewsSubmissionsNode
    + description Get a user's comments and submissions
    + cells tileKeywordCell quantityCell
    + catchAllCellType hackerNewsUserNameCell
    + example View a users comment and story submissions
    + hackernews.submissions 100 breck
    + tables.basic
    + filter.where type = story
    + vega.scatter Stories
    + xColumn time
    + yColumn score
    + filter.where type = comment
    + vega.scatter Comments
    + xColumn time
    + yColumn score
    + javascript
    + _getFirstUrls() {
    + return this.getWordsFrom(2).map(username => \`https://hacker-news.firebaseio.com/v0/user/\${username}.json?print=pretty\`)
    + }
    + _getLimit() {
    + return parseInt(this.getWord(1) || 10)
    + }
    + _parseNextUrls(response) {
    + return response.asJson.submitted.map(id => \`https://hacker-news.firebaseio.com/v0/item/\${id}.json?print=pretty\`)
    + }
    + extends hackernewsTopNode
    + crux hackernews.submissions
    + publicApisNode
    + frequency .01
    + tags internetConnectionRequired
    + extends abstractUrlNode
    + string dataDomain publicapis.org
    + cells tileKeywordCell
    + description Get all public APIs
    + string url https://api.publicapis.org/entries
    + crux publicapis.entries
    + string parser json
    + string jsonPath entries
    + webGetNode
    + description Get a URL and parse the fetched data.
    + example Fetch a TSV from the web and show results
    + web.get https://raw.githubusercontent.com/treenotation/ohayo/master/ohayo/packages/samples/iris.tsv
    + tables.basic
    + frequency .1
    + string placeholderMessage Enter a url.
    + string bodyStumpTemplate
    + span {kind}
    + class LargeLabel
    + input
    + value {content}
    + placeholder {placeholderMessage}
    + changeCommand changeTileContentAndRenderCommand
    + class LargeTileInput
    + javascript
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, { kind: this.getFirstWord(), content: this.getContent() || "", placeholderMessage: this.placeholderMessage })
    + }
    + string tileSize 400 100
    + extends abstractUrlNode
    + crux web.get
    + webPostNode
    + frequency .02
    + description Post data to a URL and parse the returned data.
    + inScope postNode
    + string webPostBodyStumpTemplate
    + textarea
    + bern
    + {post}
    + placeholder This data will be sent as the value of the 'q' param
    + name post
    + changeCommand changeTileSettingMultilineCommand
    + class TileTextArea
    + javascript
    + getTileBodyStumpCode() {
    + return super.getTileBodyStumpCode() + this.qFormat(this.webPostBodyStumpTemplate, { post: jtree.Utils.stripHtml(this.getSettingsStruct().post || "") })
    + }
    + async _getData(url) {
    + const settings = this.getSettingsStruct()
    + // todo, but make a separate tile
    + // if (settings.pushButton) {
    + // if (!settings.pushed) return ""
    + // settings.pushed = false
    + // }
    + const postData = settings.post || ""
    + const res = await this.getWebApp()
    + .getWillowBrowser()
    + .httpPostUrl(url, { q: postData.trim() })
    + this._setWillowHttpResponse(res)
    + return res.getParsedDataOrText()
    + }
    + string tileSize 400 130
    + extends abstractUrlNode
    + crux web.post
    + wikipediaContentNode
    + frequency .01
    + tags internetConnectionRequired
    + extends abstractUrlNode
    + string dataDomain wikipedia.org
    + catchAllCellType wikipediaPermalinkCell
    + cells tileKeywordCell
    + description Get content of a wikipedia page(s)
    + javascript
    + getUrl() {
    + return this.urlPrefix + this.wikipediaPermalinkCell.join("|")
    + }
    + async fetchTableInputs() {
    + const inputs = await super.fetchTableInputs()
    + // todo: cleanup
    + return { rows: Object.values(inputs.rows[0].query.pages) }
    + }
    + string urlPrefix https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro&explaintext&redirects=1&origin=*&titles=
    + crux wikipedia.page
    + abstractFixedDatasetFromUrlNode
    + description A dataset that generally is fixed and will never change.
    + extends abstractUrlNoCellsNode
    + abstract
    + javascript
    + _getDescription() {
    + const desc = super._getDescription()
    + if (this.dataUrl) return (desc ? desc + " from " : "") + this.dataUrl
    + return desc
    + }
    + abstractFixedDatasetFromOhayoCollectionNode
    + description A dataset that ships with Ohayo.
    + string tileSize 300 150
    + javascript
    + async _getData(url) {
    + if (!this.isNodeJs()) return super._getData(url)
    + const fs = require("fs")
    + const filepath = __dirname + "/../" + url
    + return fs.readFileSync(filepath, "utf8")
    + }
    + extends abstractFixedDatasetFromUrlNode
    + abstract
    + cancerCasesNode
    + description Estimated new cancer cases in the U.S. in 2019 from https://cancerstatisticscenter.cancer.org/
    + string url ohayo/packages/cancer/cases.csv
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux cancer.cases
    + abstractCdcInfantPercentileNode
    + boolean isDataPublicDomain true
    + string dataUrl https://www.cdc.gov/growthcharts/percentile_data_files.htm
    + abstract
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + weightPercentilesNode
    + description Weight percentiles for birth to 36 months in kilograms, by sex and age
    + string url ohayo/packages/cdc/wtageinf.csv
    + extends abstractCdcInfantPercentileNode
    + crux cdc.infants.weight
    + lengthPercentilesNode
    + description Length percentiles for birth to 36 months in centimeters, by sex and age
    + string url ohayo/packages/cdc/lenageinf.csv
    + extends abstractCdcInfantPercentileNode
    + crux cdc.infants.length
    + headPercentilesNode
    + description Head circumference percentiles for birth to 36 months in centimeters, by sex and age
    + string url ohayo/packages/cdc/hcageinf.csv
    + extends abstractCdcInfantPercentileNode
    + crux cdc.infants.headCircumference
    + kaggleDatasetsHeartNode
    + tags internetConnectionRequired
    + description Heart Disease dataset from https://www.kaggle.com/ronitf/heart-disease-uci
    + string url ohayo/packages/kaggle/heart.csv
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux kaggle.datasets.heart
    + mozTop500Node
    + description Moz's list of the most popular 500 websites on the internet.
    + string dataUrl https://moz.com/top500
    + boolean isDataPublicDomain true
    + string url ohayo/packages/moz/top500Domains.csv
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux moz.top500
    + lifeExpectancyNode
    + description Life expectancy data.
    + string url ohayo/packages/owid/life-expectancy.csv
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux owid.lifeExpectancy
    + owidListNode
    + string parser treeRows
    + description Gets all datasets on Our World in Data.
    + string url ohayo/packages/owid/owid.tree
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux owid.list
    + samplesTelescopesNode
    + description A partial list of humankind's largest telescopes.
    + string dataDescription
    + ## Provenance
    + This list was put together by a group of remote workers in a Google spreadsheet in 2017 and hasn't been updated in a while.
    + boolean isDataPublicDomain true
    + string dataUrl https://github.com/treenotation/ohayo/blob/master/ohayo/packages/samples/telescopes.tsv
    + tags astronomy
    + frequency .03
    + example Display list of links to telescope websites.
    + samples.telescopes
    + list.links Name Url
    + string url ohayo/packages/samples/telescopes.tsv
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux samples.telescopes
    + samplesMtcarsNode
    + description Dataset from 1974 Motor Trend US magazine.
    + boolean isDataPublicDomain true
    + string dataUrl https://stat.ethz.ch/R-manual/R-devel/library/datasets/html/mtcars.html
    + frequency .03
    + string url ohayo/packages/samples/mtcars.tsv
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux samples.mtcars
    + samplesIrisNode
    + description The famous Iris flower data set.
    + string dataUrl https://archive.ics.uci.edu/ml/datasets/iris
    + boolean isDataPublicDomain true
    + frequency .15
    + string url ohayo/packages/samples/iris.tsv
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux samples.iris
    + samplesFlights14Node
    + description On-Time flights data from the Bureau of Transportation Statistics for all the flights that departed from New York City airports in 2014. The data is available only for Jan-Oct'14.
    + string dataUrl https://github.com/Rdatatable/data.table/blob/master/vignettes/flights14.csv
    + boolean isDataPublicDomain true
    + string url ohayo/packages/samples/flights14-sample.csv
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux samples.flights14
    + samplesSiNode
    + description A description of The International System of Units (SI) aka the metric system.
    + boolean isDataPublicDomain true
    + string dataUrl https://github.com/treenotation/ohayo/blob/master/ohayo/packages/samples/si.tree
    + example View outline of SI system.
    + samples.si
    + treenotation.outline
    + frequency .03
    + string url ohayo/packages/samples/si.tree
    + string parser text
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux samples.si
    + samplesPortalNode
    + description A list of online data portals.
    + boolean isDataPublicDomain true
    + string dataUrl https://github.com/treenotation/ohayo/blob/master/ohayo/packages/samples/portals.ssv
    + frequency .03
    + string url ohayo/packages/samples/portals.ssv
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux samples.portals
    + samplesStarWarsNode
    + description All Star Wars characters. Data comes from https://swapi.co/
    + frequency .03
    + boolean isDataPublicDomain false
    + string dataLicense BSD
    + string url ohayo/packages/samples/starwars.json
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux samples.starWars
    + samplesPopulationsNode
    + description Countries of the world and their populations.
    + frequency .15
    + string url ohayo/packages/samples/populations.tsv
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux samples.populations
    + samplesBabyNamesNode
    + description 30 rows of a much larger dataset of baby name popularity over time in the U.S.
    + frequency .03
    + string url ohayo/packages/samples/baby-names-sample.csv
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux samples.babyNames
    + samplesDeclarationNode
    + description The 1776 Declaration of Independence
    + boolean isDataPublicDomain true
    + frequency .02
    + string url ohayo/packages/samples/declaration-of-independence.text
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux samples.declaration
    + samplesPeriodicTableNode
    + description Periodic table from https://gist.github.com/GoodmanSciences
    + string dataUrl https://gist.github.com/GoodmanSciences/c2dd862cd38f21b0ad36b8f96b4bf1ee
    + frequency .15
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + string url ohayo/packages/samples/periodic-table.csv
    + crux samples.periodicTable
    + samplesLettersNode
    + description Letter usage frequency in English from mobostock.
    + frequency .03
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + string url ohayo/packages/samples/letters.tsv
    + crux samples.letters
    + samplesPresidentsNode
    + boolean isDataPublicDomain true
    + description CSV of president's of United States.
    + frequency .03
    + string url ohayo/packages/samples/presidents.csv
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux samples.presidents
    + ucimlrDatasetsNode
    + description A list of datasets from the UC Irvine Machine Learning Repository at http://archive.ics.uci.edu/ml/index.php.
    + frequency .001
    + example Display list of datasets from UCIMLR
    + ucimlr.datasets
    + tables.basic
    + string url ohayo/packages/ucimlr/datasets.tsv
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux ucimlr.datasets
    + vegaDataNode
    + cells tileKeywordCell vegaDataSetCell
    + frequency .001
    + description Fetchs a Vega sample dataset
    + string urlPrefix ohayo/packages/vega/datasets/
    + extends abstractFixedDatasetFromOhayoCollectionNode
    + crux vega.data
    + redditAllNode
    + tags internetConnectionRequired
    + string dataDomain reddit.com
    + description Fetches top stories from r/all.
    + example A simple reddit dashboard
    + reddit.all
    + hidden
    + columns.keep title created_utc score subreddit url
    + hidden
    + rows.sortBy score
    + rows.reverse
    + tables.basic
    + vega.scatter
    + yColumn score
    + xColumn created_utc
    + frequency .05
    + javascript
    + async fetchTableInputs() {
    + const inputs = await super.fetchTableInputs()
    + // Todo: add tests/external dependency, as reddit API changes.
    + // Here it looks like we have the equivalent of a custom parser just for a Reddit Data source.
    + // todo: explore/define/typescriptAPI this custom parser pattern more. probably will be common.
    + return inputs.rows.length ? { rows: inputs.rows[0].data.children.map(obj => obj.data) } : inputs
    + }
    + getParserId() {
    + return "json"
    + }
    + string url https://www.reddit.com/r/all/top/.json?sort=top
    + string offlineDataSet ohayo/packages/reddit/all.json
    + extends abstractUrlNoCellsNode
    + crux reddit.all
    + redditSubsNode
    + description Fetches top subreddits.
    + frequency .005
    + string url https://www.reddit.com/reddits.json
    + extends redditAllNode
    + crux reddit.subs
    + redditSubNode
    + cells tileKeywordCell subredditNameCell
    + frequency .006
    + description Fetches top stories in a subreddit.
    + javascript
    + getUrl() {
    + const subreddit = this.getContent() || "all"
    + return \`https://www.reddit.com/r/\${subreddit}/top/.json?sort=top\`
    + }
    + extends redditAllNode
    + crux reddit.sub
    + abstractDummyNode
    + javascript
    + async _execute() {
    + this.setIsDataLoaded(true)
    + await this._executeChildNodes()
    + }
    + string tileSize 300 150
    + extends abstractProviderNode
    + abstract
    + samplesPatientsNode
    + description A row for each patient in a sample clinical dataset.
    + string dummyDataSetName patients
    + boolean isDataPublicDomain true
    + extends abstractDummyNode
    + crux samples.patients
    + samplesPoemNode
    + description The Road Not Taken by Robert Frost
    + string dummyDataSetName poem
    + boolean isDataPublicDomain true
    + extends abstractDummyNode
    + crux samples.poem
    + samplesOuterSpaceNode
    + description A simple text document of major structures in the universe.
    + string dummyDataSetName outerSpace
    + extends abstractDummyNode
    + crux samples.outerSpace
    + samplesTreeProgramNode
    + description A simple program in a Tree Language.
    + string dummyDataSetName treeProgram
    + boolean isDataPublicDomain true
    + extends abstractDummyNode
    + crux samples.treeProgram
    + samplesWaterBillNode
    + description A family's water bill.
    + frequency .15
    + string dummyDataSetName waterBill
    + boolean isDataPublicDomain true
    + extends abstractDummyNode
    + crux samples.waterBill
    + samplesGapMinderNode
    + description Health and income data from gapMinder
    + frequency .15
    + string dummyDataSetName gapMinder
    + extends abstractDummyNode
    + crux samples.gapMinder
    + abstractTransformerNode
    + string tileSize 160 100
    + extends abstractProviderNode
    + string placeholderMessage
    + abstract
    + string bodyStumpTemplate
    + span {kind}
    + class LargeLabel
    + input
    + value {content}
    + placeholder {placeholderMessage}
    + changeCommand changeTileContentAndRenderCommand
    + class LargeTileInput
    + string tileFooterTemplate
    + span Rows In: {inputCount} Rows Out: {outputCount} Columns Out: {columnCount}
    + {tileMenuButton}
    + javascript
    + getTileFooterStumpCode() {
    + const table = this.getParentOrDummyTable()
    + const inputCount = table.getRowCount()
    + const outputTable = this.getOutputOrInputTable()
    + return this.qFormat(this.tileFooterTemplate, { inputCount, outputCount: table.getRowCount(), columnCount: outputTable.getColumnCount(), tileMenuButton: this.getTileMenuButtonStumpCode() })
    + }
    + async _execute() {
    + this._outputTable = this._createOutputTable()
    + this.setIsDataLoaded(true)
    + await this._executeChildNodes()
    + }
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, { kind: this.getFirstWord(), content: this.getContent() || "", placeholderMessage: this.placeholderMessage })
    + }
    + abstractColumnAdderTileNode
    + abstract
    + extends abstractTransformerNode
    + javascript
    + _createOutputTable() {
    + return this.getParentOrDummyTable().addColumns(this.getNewColumns())
    + }
    + dateAddColumnsNode
    + description Takes an input table with a time column and adds a day, month and year column.
    + catchAllCellType dateColumnTypeCell
    + inScope sourceColumnNode
    + string columnPredictionHints
    + sourceColumn isTemporal=true
    + extends abstractColumnAdderTileNode
    + crux date.addColumns
    + string placeholderMessage Enter the source column and new date columns you want, or leave blank to get 'day month year'.
    + javascript
    + getNewColumns() {
    + const inputColumnName = this.getSettingsStruct().sourceColumn // todo: this is probably broken. need to fix settings timing issues.
    + if (!inputColumnName) return []
    + const addColumns = this.getContent() ? this.getWordsFrom(1) : ["day", "week", "month"]
    + // what happened to dayName? timeOfDay?
    + return addColumns.map(outputCol => {
    + return {
    + source: inputColumnName,
    + name: outputCol,
    + type: outputCol
    + }
    + })
    + }
    + genConstantNode
    + crux gen.constant
    + example
    + gen.range year -1000 2020 1
    + gen.constant birthRate number 0.035
    + cells tileKeywordCell columnNameCell primitiveTypeCell anyCell
    + description Add a column that contains a constant for each row.
    + extends abstractColumnAdderTileNode
    + javascript
    + getNewColumns() {
    + return [
    + {
    + name: this.columnNameCell,
    + type: this.primitiveTypeCell,
    + accessorFn: row => this.anyCell
    + }
    + ]
    + }
    + genGrowthNode
    + crux gen.growth
    + example
    + gen.range year -1000 2020 1
    + gen.constant birthRate number 0.035
    + gen.growth population 4 0.01
    + cells tileKeywordCell columnNameCell minCell growthRateCell
    + description Add a column that contains a constant for each row.
    + extends abstractColumnAdderTileNode
    + javascript
    + getNewColumns() {
    + let total = this.minCell
    + return [
    + {
    + name: this.columnNameCell,
    + accessorFn: (row, rowIndex) => {
    + total = total * (1 + this.growthRateCell)
    + return total
    + }
    + }
    + ]
    + }
    + mathLogNode
    + description Add a column that is the natural log (base e) of another column.
    + cells tileKeywordCell columnNameCell
    + extends abstractColumnAdderTileNode
    + crux math.log
    + javascript
    + getNewColumns() {
    + const inputColumnName = this.getWord(1)
    + if (!inputColumnName) return []
    + const inputCol = this.getParentOrDummyTable().getColumnByName(inputColumnName)
    + return [
    + {
    + source: inputColumnName,
    + name: inputColumnName + "Log",
    + type: inputCol.getPrimitiveTypeName(),
    + mathFn: Math.log
    + }
    + ]
    + }
    + rowsAddIndexColumnNode
    + description Add an index column to the data.
    + extends abstractColumnAdderTileNode
    + crux rows.addIndexColumn
    + javascript
    + getNewColumns() {
    + let index = 0
    + return [
    + {
    + name: "index",
    + accessorFn: row => index++
    + }
    + ]
    + }
    + rowsRunningTotalNode
    + cells tileKeywordCell columnNameCell
    + description Add a column that accumulates the running total of a column.
    + extends abstractColumnAdderTileNode
    + crux rows.runningTotal
    + javascript
    + getNewColumns() {
    + const sourceColumnName = this.getWord(1)
    + let total = 0
    + return [
    + {
    + source: sourceColumnName,
    + name: "total",
    + accessorFn: row => {
    + total += row[sourceColumnName]
    + return total
    + }
    + }
    + ]
    + }
    + textLengthNode
    + cells tileKeywordCell columnNameCell
    + description Add a column which contains the string length of the given column.
    + example Show the largest words in declaration of independence
    + samples.declaration
    + text.wordCount
    + text.length word
    + filter.where wordLength > 5
    + rows.sortByReverse wordLength
    + tables.basic
    + javascript
    + getNewColumns() {
    + const sourceColumnName = this.getWord(1)
    + const destinationColumnName = sourceColumnName + "Length"
    + return [
    + {
    + source: sourceColumnName,
    + name: destinationColumnName,
    + accessorFn: row => row[sourceColumnName].length
    + }
    + ]
    + }
    + extends abstractColumnAdderTileNode
    + crux text.length
    + textSplitNode
    + description Split one column into multiple by a string
    + cells tileKeywordCell columnNameCell delimiterCell
    + catchAllCellType newColumnNamesCell
    + example Split a filename into name and extension
    + vega.data descriptions.json
    + text.split filename . name extension
    + tables.basic
    + string dummyDataSetName poem
    + javascript
    + // note: delimiter can probably be ""
    + // todo: how would we split on a space???
    + // perhaps its better to use getContent() as delimiter, and if you want to name the columns, you can do that later?
    + getNewColumns() {
    + const sourceColumnName = this.getWord(1)
    + const delimiter = this.getWord(2)
    + const destinationColumns = this.getWordsFrom(3)
    + return destinationColumns.map((destinationColumnName, index) => {
    + return {
    + source: sourceColumnName,
    + name: destinationColumnName,
    + accessorFn: row => {
    + const words = row[sourceColumnName].split(delimiter)
    + return this.reverseSplit ? words.reverse()[index] : words[index]
    + }
    + }
    + })
    + return [
    + {
    + source: sourceColumnName,
    + name: destinationColumnName,
    + accessorFn: row => row[sourceColumnName].length
    + }
    + ]
    + }
    + extends abstractColumnAdderTileNode
    + crux text.split
    + reverseTextSplitNode
    + extends textSplitNode
    + crux text.reverseSplit
    + description Split one column into multiple by a string reversing the order.
    + boolean reverseSplit true
    + textToLowerCaseNode
    + description Convert all cells in a column to LowerCase text
    + cells tileKeywordCell columnNameCell
    + example Select the first character of someone's name
    + samples.declaration
    + text.wordCount
    + tables.basic
    + text.toLowerCase text
    + tables.basic
    + string dummyDataSetName poem
    + javascript
    + getNewColumns() {
    + const sourceColumnName = this.getWord(1) || "text"
    + return [
    + {
    + source: sourceColumnName,
    + name: sourceColumnName,
    + accessorFn: row => row[sourceColumnName].toLowerCase()
    + }
    + ]
    + }
    + extends abstractColumnAdderTileNode
    + crux text.toLowerCase
    + textTemplateNode
    + inScope contentNode
    + description Evaluates a common programming template string and generates a new cell for each row.
    + cells tileKeywordCell
    + catchAllCellType newColumnNameCell
    + string bodyStumpTemplate
    + textarea
    + name content
    + changeCommand changeTileSettingMultilineCommand
    + placeholder Enter template here.
    + class TileTextArea savable
    + bern
    + {text}
    + example
    + samples.presidents
    + text.template
    + content
    + Hello {name}!
    + How did you like being born in {HomeState}?
    + tables.basic
    + javascript
    + getNewColumns() {
    + const contentNode = this.getNode("content")
    + const templateString = contentNode ? contentNode.childrenToString() : ""
    + const destColumnName = this.getWord(1) || "Output"
    + return [
    + {
    + name: destColumnName,
    + accessorFn: row => new jtree.TreeNode(templateString).templateToString(row)
    + }
    + ]
    + }
    + getDataContent() {
    + const node = this.getNode("content")
    + return node ? node.childrenToString() : ""
    + }
    + getTileBodyStumpCode() {
    + const text = lodash.escape(this.getDataContent())
    + return this.qFormat(this.bodyStumpTemplate, { text })
    + }
    + extends abstractColumnAdderTileNode
    + crux text.template
    + textPermalinkNode
    + description Convert all cells in a column to a url friendly permalink.
    + cells tileKeywordCell columnNameCell newColumnNameCell
    + example
    + samples.presidents
    + text.permalink name Permalink
    + tables.basic
    + javascript
    + getNewColumns() {
    + const sourceColumnName = this.getWord(1) || "text"
    + const destinationColumnName = this.getWord(2) || "Permalink"
    + return [
    + {
    + source: sourceColumnName,
    + name: destinationColumnName,
    + accessorFn: row => jtree.Utils.stringToPermalink(row[sourceColumnName])
    + }
    + ]
    + }
    + extends abstractColumnAdderTileNode
    + crux text.permalink
    + textReplaceNode
    + description Does a global search/replace across all cells in a column.
    + cells tileKeywordCell columnNameCell
    + catchAllCellType anyCell
    + example
    + samples.presidents
    + text.replace name George Georgette
    + tables.basic
    + javascript
    + getNewColumns() {
    + const sourceColumnName = this.getWord(1) || "text"
    + const simpleSearch = this.getWord(2)
    + const simpleReplace = this.getWord(3)
    + const destinationColumnName = sourceColumnName
    + return [
    + {
    + source: sourceColumnName,
    + name: destinationColumnName,
    + accessorFn: row => row[sourceColumnName].replace(new RegExp(simpleSearch, "g"), simpleReplace)
    + }
    + ]
    + }
    + extends abstractColumnAdderTileNode
    + crux text.replace
    + textTrimNode
    + description Trims whitespace or a provided sequence from both sides of a string in all cells in a column.
    + cells tileKeywordCell columnNameCell
    + catchAllCellType anyCell
    + example
    + samples.presidents
    + text.trim HomeState New
    + tables.basic
    + javascript
    + getNewColumns() {
    + const sourceColumnName = this.getWord(1) || "text"
    + const trimChar = this.getWord(2)
    + const destinationColumnName = sourceColumnName
    + return [
    + {
    + source: sourceColumnName,
    + name: destinationColumnName,
    + accessorFn: row => (trimChar ? row[sourceColumnName].replace(new RegExp(\`(^\${trimChar}|\${trimChar}$)\`, "g"), "") : row[sourceColumnName].trim())
    + }
    + ]
    + }
    + extends abstractColumnAdderTileNode
    + crux text.trim
    + textSubstringNode
    + description Extract parts of one column into another column called "substring".
    + cells tileKeywordCell columnNameCell startIndexCell lengthCell
    + example Select the first character of someone's name
    + samples.presidents
    + text.substring name 0 1
    + tables.basic
    + string dummyDataSetName poem
    + extends abstractColumnAdderTileNode
    + crux text.substring
    + string destinationColumnName substring
    + javascript
    + getNewColumns() {
    + const sourceColumnName = this.getWord(1)
    + const startPosition = typeof this.startIndex !== undefined ? this.startIndex : parseInt(this.getWord(2))
    + const endPosition = typeof this.endIndex !== undefined ? this.endIndex : this.getWord(3) === undefined ? undefined : parseInt(this.getWord(3))
    + return [
    + {
    + source: sourceColumnName,
    + name: this.destinationColumnName,
    + accessorFn: row => (row[sourceColumnName] ? row[sourceColumnName].toString().substr(startPosition, endPosition) : "")
    + }
    + ]
    + }
    + testFirstLetterNode
    + extends textSubstringNode
    + crux text.firstLetter
    + description Extracts the first letter of a column into a new column called "firstLetter"
    + cells tileKeywordCell columnNameCell
    + string destinationColumnName firstLetter
    + int startIndex 0
    + int endIndex 1
    + abstractNewRowsTransformerTileNode
    + abstract
    + extends abstractTransformerNode
    + javascript
    + _createOutputTable() {
    + // todo: remove this
    + return new Table(this.makeNewRows())
    + }
    + columnsDescribeNode
    + description Computes statistics for each input column.
    + example List column information
    + samples.iris
    + columns.describe
    + extends abstractNewRowsTransformerTileNode
    + crux columns.describe
    + javascript
    + makeNewRows() {
    + return this.getParentOrDummyTable().getColumnNamesAndTypesAndReductions()
    + }
    + columnsListNode
    + description Provides a list of table columns and their types.
    + example List columns
    + samples.iris
    + columns.list
    + extends columnsDescribeNode
    + crux columns.list
    + javascript
    + makeNewRows() {
    + return this.getParentOrDummyTable().getColumnNamesAndTypes()
    + }
    + dataEvalNode
    + description Passes input rows, if any, to a Javascript function and returns transformed or new rows.
    + example Generate some data.
    + data.eval
    + content
    + inputRows => [{name: "Swift", year: 2015}, {name: "Kotlin", year: 2011}]
    + tables.basic
    + inScope contentNode
    + extends abstractNewRowsTransformerTileNode
    + crux data.eval
    + javascript
    + makeNewRows() {
    + const node = this.getNode(this.contentKey)
    + const code = node && node.childrenToString() // "rows => { return []}"
    + let fn
    + try {
    + fn = code && eval(code)
    + } catch (err) {
    + // todo: warn user
    + console.error(err)
    + }
    + const inputRows = this.getParentOrDummyTable().cloneNativeJavascriptTypedRows()
    + return fn ? fn(inputRows) : inputRows
    + }
    + joinByNode
    + catchAllCellType columnNameCell
    + description Combines multiple tables into one, linking the rows by the provided key column.
    + extends abstractNewRowsTransformerTileNode
    + crux join.by
    + javascript
    + makeNewRows() {
    + // Todo: move to table project
    + const parentTile = this.getParent()
    + if (parentTile.isRoot()) return []
    + const grandParentTile = parentTile.getParent()
    + if (grandParentTile.isRoot()) return parentTile.getOutputOrInputTable().cloneNativeJavascriptTypedRows()
    + const tiles = [parentTile, grandParentTile]
    + const arrays = tiles.map(tile => tile.getOutputOrInputTable().cloneNativeJavascriptTypedRows())
    + const joinOn = this.getContent()
    + if (!joinOn) return jtree.Utils.flatten(arrays)
    + const cols = tiles.map(tile => tile.getOutputOrInputTable().getColumnNames())
    + return jtree.Utils.joinArraysOn(joinOn, arrays, cols)
    + }
    + matchColumnsFuzzyNode
    + description Attempts to fuzzy match words in one column of parent table against words in a column in grandparent table.
    + cells tileKeywordCell needleColumnNameCell haystackColumnNameCell
    + example Try to match different spellings of country names.
    + samples.gapMinder
    + samples.populations
    + match.columnsFuzzy Country country
    + rows.sortBy confidence
    + rows.reverse
    + tables.basic
    + string tileScript ohayo/packages/match/fuse.min.js
    + extends abstractNewRowsTransformerTileNode
    + crux match.columnsFuzzy
    + javascript
    + makeNewRows() {
    + // Todo: move some of this logic to table project?
    + const parentTile = this.getParent()
    + if (parentTile.isRoot()) return []
    + const grandParentTile = parentTile.getParent()
    + if (grandParentTile.isRoot()) return parentTile.getOutputOrInputTable().cloneNativeJavascriptTypedRows()
    + const tiles = [parentTile, grandParentTile]
    + const arrays = tiles.map(tile => tile.getOutputOrInputTable().cloneNativeJavascriptTypedRows())
    + return this._addFuzz(arrays[0], arrays[1])
    + }
    + get fuse() {
    + return this.isNodeJs() ? require("fuse.js") : Fuse
    + }
    + _addFuzz(needles, haystacks) {
    + const needleColumnName = this.getWord(1) || "name"
    + const haystackColumnName = this.getWord(2) || "name"
    + const options = {
    + shouldSort: true,
    + includeScore: true,
    + threshold: 0.6,
    + location: 0,
    + distance: 100,
    + maxPatternLength: 32,
    + minMatchCharLength: 1,
    + keys: [haystackColumnName]
    + }
    + const fuse = new this.fuse(haystacks, options) // "list" is the item array
    + return needles.map(needle => {
    + const searchValue = needle[needleColumnName]
    + const result = fuse.search(searchValue)
    + if (!result.length)
    + return {
    + search: searchValue,
    + match: ""
    + }
    + const match = result[0]
    + return {
    + search: searchValue,
    + match: match.item[haystackColumnName],
    + confidence: parseFloat((1 - match.score).toFixed(3))
    + }
    + })
    + }
    + schemaTypeScriptNode
    + description Generates a TypeScript interface for the parent table.
    + extends abstractNewRowsTransformerTileNode
    + crux schema.toTypescript
    + example
    + samples.presidents
    + schema.toTypescript
    + html.printAs code
    + javascript
    + makeNewRows() {
    + return [{ text: this.getParentOrDummyTable().toTypeScriptInterface() }]
    + }
    + schemaSimpleNode
    + description Generate a simple schema of the parent table.
    + extends abstractNewRowsTransformerTileNode
    + crux schema.toSimple
    + example
    + samples.presidents
    + schema.toSimple
    + html.printAs code
    + javascript
    + makeNewRows() {
    + const schema = this.getParentOrDummyTable().toSimpleSchema()
    + const oneLiner = schema.replace(/ /g, ":").replace(/\\n/g, " ")
    + return [{ text: oneLiner + "\\n\\n" + schema }]
    + }
    + textWordCountNode
    + description Splits a string into words and counts the number of uses of each word.
    + string dummyDataSetName poem
    + extends abstractNewRowsTransformerTileNode
    + crux text.wordCount
    + javascript
    + makeNewRows() {
    + return this._getAllWords(this.getPipishInput())
    - }
    -
    - .cm-tab-wrap-hack:after {
    - content: ''
    - }
    -
    - span.CodeMirror-selectedtext {
    - background: none
    - }
    -
    - .CodeMirror-hints {
    - position: absolute;
    - z-index: 10;
    - overflow: hidden;
    - list-style: none;
    - margin: 0;
    - padding: 2px;
    - -webkit-box-shadow: 2px 3px 5px rgba(0, 0, 0, .2);
    - -moz-box-shadow: 2px 3px 5px rgba(0, 0, 0, .2);
    - box-shadow: 2px 3px 5px rgba(0, 0, 0, .2);
    - border-radius: 3px;
    - border: 1px solid silver;
    - background: #fff;
    - font-size: 90%;
    - font-family: monospace;
    - max-height: 20em;
    - overflow-y: auto
    - }
    -
    - .CodeMirror-hint {
    - margin: 0;
    - padding: 0 4px;
    - border-radius: 2px;
    - white-space: pre;
    - color: #000;
    - cursor: pointer
    - }
    -
    - li.CodeMirror-hint-active {
    - background: #08f;
    - color: #fff
    - }
    -
    - .CodeMirror { background: transparent;}
    -
    - .cm-s-oceanic-next.CodeMirror { background: #304148; color: #f8f8f2; }
    -
    - .cm-s-oceanic-next div.CodeMirror-selected { background: rgba(101, 115, 126, 0.33); }
    - .cm-s-oceanic-next .CodeMirror-line::selection, .cm-s-oceanic-next .CodeMirror-line > span::selection, .cm-s-oceanic-next .CodeMirror-line > span > span::selection { background: rgba(101, 115, 126, 0.33); }
    - .cm-s-oceanic-next .CodeMirror-line::-moz-selection, .cm-s-oceanic-next .CodeMirror-line > span::-moz-selection, .cm-s-oceanic-next .CodeMirror-line > span > span::-moz-selection { background: rgba(101, 115, 126, 0.33); }
    - .cm-s-oceanic-next .CodeMirror-gutters { background: #304148; border-right: 10px; }
    - .cm-s-oceanic-next .CodeMirror-guttermarker { color: white; }
    - .cm-s-oceanic-next .CodeMirror-guttermarker-subtle { color: #d0d0d0; }
    - .cm-s-oceanic-next .CodeMirror-linenumber { color: #d0d0d0; }
    - .cm-s-oceanic-next .CodeMirror-cursor { border-left: 1px solid #f8f8f0; }
    -
    - .cm-s-oceanic-next span.cm-comment { color: #65737E; }
    - .cm-s-oceanic-next span.cm-atom { color: #C594C5; }
    - .cm-s-oceanic-next span.cm-number { color: #F99157; }
    -
    - .cm-s-oceanic-next span.cm-property { color: #99C794; }
    - .cm-s-oceanic-next span.cm-attribute,
    - .cm-s-oceanic-next span.cm-keyword { color: #C594C5; }
    - .cm-s-oceanic-next span.cm-builtin { color: #66d9ef; }
    - .cm-s-oceanic-next span.cm-string { color: #99C794; }
    -
    - .cm-s-oceanic-next span.cm-variable,
    - .cm-s-oceanic-next span.cm-variable-2,
    - .cm-s-oceanic-next span.cm-variable-3 { color: #f8f8f2; }
    - .cm-s-oceanic-next span.cm-def { color: #6699CC; }
    - .cm-s-oceanic-next span.cm-bracket { color: #5FB3B3; }
    - .cm-s-oceanic-next span.cm-tag { color: #C594C5; }
    - .cm-s-oceanic-next span.cm-header { color: #C594C5; }
    - .cm-s-oceanic-next span.cm-link { color: #C594C5; }
    - .cm-s-oceanic-next span.cm-error { background: #C594C5; color: #f8f8f0; }
    -
    - .cm-s-oceanic-next .CodeMirror-activeline-background { background: rgba(101, 115, 126, 0.33); }
    - .cm-s-oceanic-next .CodeMirror-matchingbracket {
    - text-decoration: underline;
    - color: white !important;
    - }
    -
    - .cm-s-oceanic-next.CodeMirror {background: transparent;}
    - `.replace(/\n/g, "")
    -
    - window.CodeMirrorCss
    - = CodeMirrorCss
    - ;
    -
    - const SVGS = {}
    -
    - SVGS["nw"] = ` `
    - SVGS["lt-eq"] = ` `
    - SVGS["lt"] = ` `
    - SVGS["pencil"] = ``
    - SVGS["fork"] = ` `
    - SVGS["call"] = ` `
    - SVGS["hashtag"] = ` `
    - SVGS["minus"] = ``
    - SVGS["font-1"] = ` `
    - SVGS["check"] = ` `
    - SVGS["copy"] = ` `
    - SVGS["coding"] = ` `
    - SVGS["inspector"] = ` `
    - SVGS["trash"] = ` `
    - SVGS["multiply"] = ``
    - SVGS["divide"] = ` `
    - SVGS["add"] = ``
    - SVGS["printer"] = ` `
    - SVGS["function"] = ` `
    - SVGS["export"] = ` `
    - SVGS["import"] = ` `
    - SVGS["folder"] = ``
    - SVGS["score"] = ` `
    - SVGS["tree"] = ` `
    - SVGS["www"] = ` `
    - SVGS["font"] = ` `
    - SVGS["text"] = ` `
    - SVGS["table"] = ` `
    - SVGS["filter"] = ``
    - SVGS["reddit"] = ` `
    - SVGS["whitehouse"] = ` `
    -
    - window.SVGS
    - = SVGS
    - ;
    -
    -
    -
    - function Icons(name, size) {
    - const rawSvg = SVGS[name]
    - const svg = rawSvg.substr(4)
    - const prefix = `
    - return prefix + svg
    - }
    -
    - window.Icons
    - = Icons
    - ;
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - const ThemeConstants = {}
    - ThemeConstants.dark = "dark"
    - ThemeConstants.workshop = "workshop"
    - ThemeConstants.white = "white"
    - ThemeConstants.glass = "glass"
    - ThemeConstants.clearGlass = "clearGlass"
    -
    - class Theme {
    - constructor(options = {}) {
    - const { backgroundColor = "rgb(255,255,255)", foregroundColor = "black", fn = "lighten", selectionColor = "rgb(42, 89, 178)" } = options
    -
    - let grayStartColor = options.grayStartColor || foregroundColor
    - this.backgroundColor = backgroundColor
    - this.solidBackgroundColorOrTransparent = options.hasSolidBackground ? backgroundColor : "transparent"
    - this.menuBackground = backgroundColor
    - this.tabBackground = "transparent"
    - this.programsBackground = backgroundColor
    - this.bodyBackground = backgroundColor
    - this.wallBackground = backgroundColor
    - this.contextMenuBackground = backgroundColor
    - this.tileBackgroundColor = backgroundColor
    - this.tileShadow = "none"
    - this.tileOpacity = 1
    -
    - this.menuTreeComponentColor = foregroundColor
    - this.foregroundColor = foregroundColor
    -
    - this.lineColor = tinycolor(foregroundColor)
    - .setAlpha(0.075)
    - .toString()
    - this.boxShadow = tinycolor(foregroundColor)
    - .setAlpha(0.1)
    - .toString()
    - this.slightlyDarkerBackground = tinycolor(backgroundColor)
    - .darken(5)
    - .toString()
    - this.darkerBackground = tinycolor(backgroundColor)
    - .darken(10)
    - .toString()
    -
    - this.activeTabColor = this.darkerBackground
    -
    - const alterGrayShades = amount =>
    - tinycolor(grayStartColor)
    - [fn](amount)
    - .toString()
    -
    - this.darkBlack = alterGrayShades(20)
    - this.mediumBlack = alterGrayShades(40)
    - this.midGray = alterGrayShades(60)
    - this.greyish = options.greyish || alterGrayShades(82)
    - this.lightGrey = alterGrayShades(93)
    - this.lightGrey = options.lightGrey || alterGrayShades(93)
    - this.veryLightGrey = options.veryLightGrey || alterGrayShades(97)
    -
    - this.borderColor = this.greyish
    -
    - this.hoverBackground = selectionColor
    - this.linkColor = selectionColor
    - this.selectedOutline = tinycolor(selectionColor)
    - .setAlpha(0.8)
    - .toString()
    - this.selectionBackground = tinycolor(selectionColor)
    - .setAlpha(0.1)
    - .toString()
    -
    - this.errorColor = "rgb(226, 120, 121)"
    - this.successColor = "#4CAF50"
    - this.warningColor = "orange"
    - this.white = "#fff"
    -
    - this.fonts = `'San Francisco', 'Myriad Set Pro', 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, Verdana, sans-serif`
    -
    - this.modalDimmerBackground = tinycolor("#000")
    - .setAlpha(0.4)
    - .toString()
    -
    - // Pass values overwrite all
    - Object.assign(this, options)
    -
    - // todo: cleanup
    - this.enableTextSelect1 = this._enableTextSelect(1)
    - this.enableTextSelect2 = this._enableTextSelect(2)
    - }
    -
    - _enableTextSelect(indent) {
    - return new jtree.TreeNode(`-moz-user-select text
    - -webkit-user-select text
    - -ms-user-select text
    - user-select text`).toString(indent)
    + _getAllWords(text) {
    + const rows = []
    + if (!text) return rows
    + const words = text
    + .split(/\\s/g)
    + .map(word => word.replace(/[^a-z0-9\\-]/gi, ""))
    + .filter(word => word)
    + const index = {}
    + words.forEach(word => {
    + if (!index[word]) index[word] = 1
    + else index[word]++
    + })
    + Object.keys(index).forEach(word => {
    + const trimmedWord = word.trim()
    + if (trimmedWord)
    + rows.push({
    + word: trimmedWord,
    + count: index[trimmedWord]
    + })
    + })
    + return rows
    -
    - getHeatColor(percent) {
    - return `hsl(200, ${25 + percent * 75}%, ${20 + percent * 25}%)`
    + textLineCountNode
    + description Counts the number of lines in the input data.
    + string dummyDataSetName poem
    + javascript
    + makeNewRows() {
    + return [{ lines: this.getPipishInput().split(/\\n/g).length }]
    -
    - disableTextSelect(indent) {
    - return new jtree.TreeNode(
    - `-webkit-touch-callout none
    - -webkit-user-select none
    - -khtml-user-select none
    - -moz-user-select none
    - -ms-user-select none
    - user-select none`
    - ).toString(indent)
    + extends abstractNewRowsTransformerTileNode
    + crux text.lineCount
    + example
    + text.lineCount
    + tables.basic
    + treenotationWordTypesNode
    + description Generates the word types for a Ohayo Language program.
    + example See counts of word types in a Ohayo Language program.
    + treenotation.wordTypes
    + treenotation.outline
    + text.wordCount
    + tables.basic
    + string dummyDataSetName treeProgram
    + extends abstractNewRowsTransformerTileNode
    + crux treenotation.wordTypes
    + javascript
    + makeNewRows() {
    + return [{ text: new ohayoNode(this.getPipishInput()).toCellTypeTree() }]
    -
    - hakonToCss(str) {
    - const hakonProgram = new hakonNode(str)
    - // console.log(hakonProgram.getAllErrors())
    - return hakonProgram.compile()
    + abstractColumnFilterTileNode
    + abstract
    + extends abstractTransformerNode
    + javascript
    + _createOutputTable() {
    + return this.getParentOrDummyTable().dropAllColumnsExcept(this.getColumnNamesToKeep())
    - }
    -
    - const Themes = {}
    -
    - Themes[ThemeConstants.dark] = new Theme({
    - hasSolidBackground: true,
    - backgroundColor: "rgb(16, 16, 16)",
    - foregroundColor: "#fff",
    - fn: "darken"
    - })
    -
    - Themes[ThemeConstants.workshop] = new Theme({
    - hasSolidBackground: true,
    - wallBackgroundImage: "url('images/transparenttextures.com/wine-cork.png')",
    - wallBackground: "rgba(244,216,105,.4)",
    - menuBackground: "#3B539A",
    - tileOpacity: 0.95,
    - tileShadow: "0 2px 4px rgba(33,33,33,.2)",
    - menuTreeComponentColor: "white"
    - })
    -
    - const glassColors = {
    - hasSolidBackground: false,
    - selectionColor: "rgba(46, 195, 212, .9)",
    - bodyBackground: "linear-gradient(130deg, rgb(56, 114, 127), rgb(28, 98, 151) 45%, rgb(62, 73, 135))",
    - backgroundColor: "rgba(0,0,0,.12)",
    - contextMenuBackground: "rgba(0,0,0,.90)",
    - tileBackgroundColor: "rgba(0,0,0,.12)",
    - programsBackground: "transparent",
    - boxShadow: "transparent",
    - wallBackground: "transparent",
    - activeTabColor: "transparent",
    - lightGrey: "rgba(0,0,0,.16)",
    - greyish: "rgba(0,0,0,.20)",
    - veryLightGrey: "rgba(0,0,0,.12)",
    - borderColor: "transparent",
    - foregroundColor: "#eee"
    - }
    -
    - const whiteColors = Object.assign({}, glassColors)
    - whiteColors.bodyBackground = "white"
    - whiteColors.foregroundColor = "black"
    - whiteColors.tileBackgroundColor = "transparent"
    -
    - Themes[ThemeConstants.white] = new Theme(whiteColors)
    -
    - Themes[ThemeConstants.glass] = new Theme(glassColors)
    -
    - glassColors.tileBackgroundColor = "transparent"
    - Themes[ThemeConstants.clearGlass] = new Theme(glassColors)
    -
    - class ThemeTreeComponent extends AbstractTreeComponent {
    - toStumpCode() {
    - const theme = this.getTheme()
    - return `styleTag ${CodeMirrorCss} .CodeMirror{color: ${theme.mediumBlack};} .CodeMirror .CodeMirror-gutters,.cm-s-oceanic-next .CodeMirror-gutters {background: ${theme.solidBackgroundColorOrTransparent}}`
    + columnsFirstNode
    + cells tileKeywordCell intCell
    + description Keeps only the first N columns.
    + example Drop all but first column
    + samples.iris
    + columns.first 1
    + tables.basic
    + extends abstractColumnFilterTileNode
    + crux columns.first
    + string placeholderMessage Enter the number of columns you want to keep
    + javascript
    + getColumnNamesToKeep() {
    + return this.getParentOrDummyTable()
    + .getColumnsArrayOfObjects()
    + .slice(0, parseInt(this.getContent()))
    + .map(col => col.name)
    + }
    + columnsLastNode
    + cells tileKeywordCell intCell
    + description Keeps only the last N columns.
    + example Drop all but 1 column
    + samples.iris
    + columns.last 1
    + tables.basic
    + extends abstractColumnFilterTileNode
    + crux columns.last
    + string placeholderMessage Enter the number of columns you want to keep
    + javascript
    + getColumnNamesToKeep() {
    + const cols = this.getParentOrDummyTable().getColumnsArrayOfObjects()
    + return cols.slice(cols.length - parseInt(this.getContent())).map(col => col.name)
    + }
    + columnsDropNode
    + description Drop certain columns. Inverse of columns.keep.
    + extends abstractColumnFilterTileNode
    + example
    + samples.iris
    + show.columnCount
    + columns.drop Petal.Length
    + show.columnCount
    + crux columns.drop
    + catchAllCellType columnNameCell
    + javascript
    + getColumnNamesToKeep() {
    + const colsToDrop = this.getWordsFrom(1)
    + return this.getParentOrDummyTable()
    + .getColumnsArrayOfObjects()
    + .filter(col => !colsToDrop.includes(col.name))
    + .map(col => col.name)
    + }
    + columnsDropConstantsNode
    + description Drop any columns that contain only a single value.
    + extends abstractColumnFilterTileNode
    + example
    + data.inline
    + content
    + state,country
    + hawaii,usa
    + maine,usa
    + show.columnCount
    + columns.dropConstants
    + show.columnCount
    + crux columns.dropConstants
    + javascript
    + getColumnNamesToKeep() {
    + return this.getParentOrDummyTable()
    + .getColumnsArray()
    + .filter(col => col.getReductions().uniqueValues > 1)
    + .map(col => col.getColumnName())
    - toHakonCode() {
    - const theme = this.getTheme()
    - return `html,body,h1,h2,h3,h4,h5,h6,table,tr,td
    - margin 0
    - padding 0
    -
    - html,body
    - width 100%
    - height 100%
    - font-family ${theme.fonts}
    - color ${theme.mediumBlack}
    -
    - body
    - overscroll-behavior-x none
    -
    - code
    - white-space pre
    -
    - html
    - background ${theme.bodyBackground}
    -
    - table
    - border-collapse collapse
    - border-spacing 0
    - table-layout fixed
    -
    - .ThemeTreeComponent
    - display none
    -
    - a
    - cursor pointer
    - text-decoration none
    - color ${theme.linkColor}
    -
    - ::-webkit-scrollbar
    - display none
    -
    - .leftButton,.rightButton
    - background transparent
    - border 0
    -
    - .LintError,.LintErrorWithSuggestion,.LintCellTypeHints
    - white-space pre
    - color red
    - background #e5e5e5
    -
    - .LintCellTypeHints
    - color black
    -
    - .LintErrorWithSuggestion
    - cursor pointer
    -
    - .TileTextArea
    - padding 5px
    - width 100%
    - height 100%
    - min-height 200px
    - box-sizing border-box
    - outline 0
    - border 0
    - font-size 14px
    - font-family ${theme.fonts}
    - resize none
    -
    - .rightButton
    - float right
    -
    - .LargeLabel
    - font-size 12px
    - color ${theme.midGray}
    - position absolute
    - left 26px
    - top 2px
    -
    - .LargeTileInput
    - display block
    - width 100%
    - height 34px
    - margin-top 4px
    - padding 2px 20px
    - font-size 14px
    - line-height 1.428571429
    - vertical-align middle
    - box-sizing border-box
    - color ${theme.darkBlack}
    - background ${theme.backgroundColor}
    - border 0
    -
    - .dragOver
    - opacity 0.5
    -
    - #dragOverHelp
    - position absolute
    - font-size 36px
    - width 100%
    - height 100%
    - z-index 300
    - display flex
    - align-items center
    - justify-content center
    - top 0
    - left 0
    -
    - .SVGIcon
    - fill ${theme.foregroundColor}
    - cursor pointer
    -
    - .buttonPrimary
    - border-radius 2px
    - cursor pointer
    - border none
    - padding 15px 32px
    - text-align center
    - text-decoration none
    - font-size 16px
    - color white
    - background ${theme.successColor}
    -
    - .divider
    - background ${theme.lineColor}
    - height 1px
    - margin 10px 0
    - width 100%
    -
    - input,textarea
    - background transparent
    - color ${theme.foregroundColor}
    -
    - .abstractTileTreeComponentNode
    - position relative
    - opacity ${theme.tileOpacity}
    - background ${theme.tileBackgroundColor}
    - margin 10px 15px
    - box-shadow ${theme.tileShadow}
    - ol
    - height 100%
    - width 100%
    - overflow scroll
    - box-sizing border-box
    - margin 0
    - z-index 1
    - ${theme.disableTextSelect(1)}
    - &.TileMaximized
    - z-index 2
    - .TileDropDownButton,.TileInsertBetweenButton
    - opacity .4
    - cursor pointer
    - font-size 10px
    - line-height 12px
    - .TileDropDownButton
    - &:hover
    - opacity 1
    - .TileInsertBetweenButton
    - font-weight bold
    - &:hover
    - opacity 1
    - &:hover
    - z-index 2
    - .TileSelectable
    - ${theme.enableTextSelect2}
    - .TileBody
    - padding 15px 5px
    - width 100%
    - max-height 400px
    - box-sizing border-box
    - overflow scroll
    - .TileFooter
    - font-size 12px
    - height 20px
    - line-height 20px
    - padding-left 5px
    - padding-right 3px
    - white-space nowrap
    - color ${theme.midGray}
    - background ${theme.tileBackgroundColor}
    - overflow hidden
    - position absolute
    - max-width 100%
    - box-sizing border-box
    - bottom 0
    - right 0
    - iframe
    - width 100%
    - height 100%
    - border 0`
    + columnsKeepNode
    + catchAllCellType columnNameCell
    + description Keep only the named columns
    + example Show 2 columns
    + samples.iris
    + columns.keep Species Petal.Length
    + tables.basic
    + extends abstractColumnFilterTileNode
    + crux columns.keep
    + string placeholderMessage Enter the column names to keep.
    + javascript
    + getColumnNamesToKeep() {
    + const colsToKeep = this.getWordsFrom(1)
    + return this.getParentOrDummyTable()
    + .getColumnsArrayOfObjects()
    + .filter(col => colsToKeep.includes(col.name))
    + .map(col => col.name)
    - }
    -
    - ThemeTreeComponent.defaultTheme = ThemeConstants.workshop
    - ThemeTreeComponent.Themes = Themes
    - ThemeTreeComponent.ThemeConstants = ThemeConstants
    -
    - window.ThemeTreeComponent
    - = ThemeTreeComponent
    - ;
    -
    -
    -
    -
    -
    - class AbstractContextMenuTreeComponent extends AbstractTreeComponent {
    - toHakonCode() {
    - const theme = this.getTheme()
    - return `.AbstractContextMenuTreeComponent
    - position fixed
    - overflow scroll
    - max-height 100%
    - z-index 221
    - background ${theme.contextMenuBackground}
    - border 1px solid ${theme.borderColor}
    - box-shadow 0 1px 3px 0 ${theme.boxShadow}
    - font-size 14px
    - a
    - display block
    - padding 3px
    - font-size 14px
    - text-decoration none
    - color ${theme.darkBlack}
    - &:hover
    - color ${theme.white}
    - background ${theme.hoverBackground}`
    + columnsKeepNumericsNode
    + description Keep only numeric columns
    + crux columns.keepNumerics
    + extends abstractColumnFilterTileNode
    + example Show 2 columns
    + samples.presidents
    + columns.keepNumerics
    + tables.basic
    + javascript
    + getColumnNamesToKeep() {
    + return Object.values(this.getParentOrDummyTable().getColumnsMap())
    + .filter(col => col.isNumeric())
    + .map(col => col.getColumnName())
    -
    - toStumpCode() {
    - return new jtree.TreeNode(`div
    - class AbstractContextMenuTreeComponent {constructorName}
    - {body}`).templateToString({ constructorName: this.constructor.name, body: this.getContextMenuBodyStumpCode() })
    + abstractTransformerNoParamsTileNode
    + abstract
    + extends abstractTransformerNode
    + javascript
    + getTileBodyStumpCode() {
    + return \`span \${this.getFirstWord()}
    + class LargeLabel\`
    -
    - treeComponentDidMount() {
    - const container = this.getStumpNode()
    - const app = this.getRootNode()
    - const willowBrowser = app.getWillowBrowser()
    - const bodyShadow = willowBrowser.getBodyStumpNode().getShadow()
    - const unmountOnClick = function() {
    - bodyShadow.offShadowEvent("click", unmountOnClick) // todo: should we move this to before unmount?
    - app.closeAllContextMenus()
    + rowsShuffleNode
    + description Shuffle the rows into a random order.
    + extends abstractTransformerNoParamsTileNode
    + crux rows.shuffle
    + javascript
    + _createOutputTable() {
    + return this.getParentOrDummyTable().shuffleRows()
    + }
    + rowsReverseNode
    + description Reverse the order of the rows
    + extends abstractTransformerNoParamsTileNode
    + crux rows.reverse
    + javascript
    + _createOutputTable() {
    + return this.getParentOrDummyTable().reverseRows()
    + }
    + abstractRowFilterTileNode
    + abstract
    + extends abstractTransformerNode
    + string placeholderMessage Enter a string to filter by.
    + javascript
    + // todo: pass thru.
    + // todo: remove this?
    + _createOutputTable() {
    + const fn = this.getRowFilterFn()
    + if (!fn) return this.getParentOrDummyTable().clone()
    + return this.getParentOrDummyTable().filterRowsByFn(fn)
    + }
    + filterWhereNode
    + description Each row must meet a certain condition
    + cells tileKeywordCell columnNameCell comparisonCell scalarValueCell
    + example Select rows by a certain text column
    + samples.iris
    + show.rowCount
    + filter.where Species = setosa
    + show.rowCount
    + frequency .01
    + string tileSize 250 100
    + extends abstractRowFilterTileNode
    + crux filter.where
    + javascript
    + _createOutputTable() {
    + // todo: use cells here.
    + const columnName = this.getWord(1)
    + const comparison = this.getWord(2)
    + let untypedScalarValue = this.getWord(3)
    + const table = this.getParentOrDummyTable()
    + if (!columnName || !comparison || untypedScalarValue === undefined) return table.clone()
    + const column = table.getColumnByName(columnName)
    + if (!column) return table
    + return table.filterClonedRowsByScalar(columnName, comparison, untypedScalarValue)
    + }
    + filterWithNode
    + description Each row must contain all of these words
    + frequency .01
    + catchAllCellType stringCell
    + string tileSize 250 100
    + extends abstractRowFilterTileNode
    + crux filter.with
    + boolean expectedBooleanValue true
    + javascript
    + getRowFilterFn() {
    + const words = this.getWordsFrom(1)
    + // todo: problem here is, getRows has too many columns if after a transformed column.
    + if (!words.length) return undefined
    + const len = words.length
    + const expectedValue = this.expectedBooleanValue
    + return row => {
    + const str = JSON.stringify(row)
    + for (let index = 0; index < len; index++) {
    + if (str.includes(words[index]) !== expectedValue) return false
    - setTimeout(() => bodyShadow.onShadowEvent("click", unmountOnClick), 100) // todo: fix this.
    - const event = app.getMouseEvent()
    - const windowSize = willowBrowser.getWindowSize()
    - const css = this._getContextMenuPosition(windowSize.width, windowSize.height, event.clientX, event.clientY, container.getShadow())
    - container.setStumpNodeCss(css)
    + return true
    + }
    -
    - _getContextMenuPosition(windowWidth, windowHeight, x, y, shadow) {
    - let boxTop = y
    - let boxLeft = x
    - const boxWidth = shadow.getShadowOuterWidth()
    - const boxHeight = shadow.getShadowOuterHeight()
    - const boxHeightOverflow = boxHeight + boxTop - windowHeight
    - const boxRightOverflow = boxWidth + boxLeft - windowWidth
    -
    - // todo: instead of this change orientation
    - if (boxHeightOverflow > 0) boxTop -= boxHeightOverflow
    -
    - if (boxRightOverflow > 0) boxLeft = x - boxWidth - 5
    -
    - if (boxTop < 0) boxTop = 0
    -
    - return {
    - left: boxLeft,
    - top: boxTop
    + filterWithoutNode
    + description Each row CANNOT contain any of these words
    + extends filterWithNode
    + crux filter.without
    + boolean expectedBooleanValue false
    + filterAnyNode
    + description Each row much contain any of these words
    + extends filterWithNode
    + crux filter.withAny
    + javascript
    + getRowFilterFn() {
    + const words = this.getWordsFrom(1)
    + if (!words.length) return undefined
    + const len = words.length
    + // todo: problem here is, getRows has too many columns if after a transformed column.
    + return row => {
    + const str = JSON.stringify(row)
    + for (let index = 0; index < len; index++) {
    + if (str.includes(words[index])) return true
    + return false
    + }
    - }
    -
    - window.AbstractContextMenuTreeComponent
    - = AbstractContextMenuTreeComponent
    - ;
    -
    -
    -
    -
    -
    - class AbstractDropDownMenuTreeComponent extends AbstractTreeComponent {
    - toHakonCode() {
    - const theme = this.getTheme()
    - return `
    - .subdued
    - color ${theme.midGray}
    -
    - .dropdownMenu
    - min-width 200px
    - position absolute
    - top 0
    - left 0
    - z-index 100
    - padding 7px 0
    - background ${theme.contextMenuBackground}
    - border 1px solid ${theme.borderColor}
    - box-shadow 0 1px 3px 0 ${theme.boxShadow}
    - .message
    - line-height 30px
    - padding 0 10px
    - a
    - color ${theme.foregroundColor}
    - display block
    - line-height 30px
    - padding 0 10px
    - &:hover
    - background ${theme.hoverBackground}
    - color ${theme.white}`
    + rowsFirstNode
    + cells tileKeywordCell intCell
    + description Return the first N rows.
    + extends abstractRowFilterTileNode
    + crux rows.first
    + javascript
    + getRowFilterFn() {
    + const limit = parseInt(this.getContent())
    + if (isNaN(limit)) return undefined
    + return (row, rowIndex) => rowIndex < limit
    -
    - treeComponentDidMount() {
    - const app = this.getRootNode()
    - const willowBrowser = app.getWillowBrowser()
    - const bodyStumpNode = willowBrowser.getBodyStumpNode()
    - const bodyShadow = bodyStumpNode.getShadow()
    - const unmountOnClick = function() {
    - bodyShadow.offShadowEvent("click", unmountOnClick)
    - app.closeAllDropDownMenusCommand()
    - }
    - setTimeout(() => bodyShadow.onShadowEvent("click", unmountOnClick), 100) // todo: fix this.
    + rowsSampleNode
    + description Return N rows sampling uniformly in order.
    + extends abstractRowFilterTileNode
    + crux rows.sample
    + cells tileKeywordCell intCell
    + javascript
    + getRowFilterFn() {
    + // todo: move to jtable?
    + const sampleCount = parseInt(this.getContent())
    + if (isNaN(sampleCount)) return undefined
    + const totalCount = this.getParentOrDummyTable().getRowCount()
    + if (totalCount <= sampleCount) return undefined
    + const every = Math.floor(totalCount / sampleCount)
    + let total = 0
    + return (row, rowIndex) => {
    + if (total === totalCount) return false
    + if (rowIndex % every !== 0) return false
    + total++
    + return true
    + }
    -
    - toStumpCode() {
    - const anchorId = this.getAnchorId()
    - const buttonStumpNode = this.getParent()
    - .getStumpNode()
    - .findStumpNodeByChild("id " + anchorId)
    - const buttonStumpNodeShadow = buttonStumpNode.getShadow()
    - const left = buttonStumpNodeShadow.getShadowPosition().left
    -
    - return new jtree.TreeNode(`div
    - style top: 30px; left: ${left}px;
    - class dropdownMenu
    - {dropDownStump}`).templateToString({ dropDownStump: this.getDropDownStumpCode() })
    + rowsDropIfMissingNode
    + cells tileKeywordCell
    + string placeholderMessage Leave blank to filter a row if it is missing any column, or specifiy column name(s).
    + description Drop a row if it is missing any values in any column, or missing a value in one of the specified columns.
    + extends abstractRowFilterTileNode
    + catchAllCellType columnNameCell
    + crux rows.dropIfMissing
    + example
    + data.inline
    + content
    + name,age
    + bob,
    + mike,55
    + assert.rowCount 2
    + rows.dropIfMissing
    + show.rowCount
    + assert.rowCount 1
    + javascript
    + getRowFilterFn() {
    + const column = this.getContent()
    + if (column) return row => !jtree.Utils.isValueEmpty(row[column])
    + return row => !Object.values(row).some(jtree.Utils.isValueEmpty)
    - }
    -
    - window.AbstractDropDownMenuTreeComponent
    - = AbstractDropDownMenuTreeComponent
    - ;
    -
    -
    -
    -
    -
    - class AbstractModalTreeComponent extends AbstractTreeComponent {
    - toHakonCode() {
    - const theme = this.getTheme()
    - return `${super.toHakonCode()}
    - .modalBackground
    - position fixed
    - top 0
    - left 0
    - width 100%
    - height 100%
    - z-index 1000
    - display flex
    - padding-top 50px
    - align-items baseline
    - justify-content center
    - box-sizing border-box
    - background ${theme.modalDimmerBackground}
    -
    - .modalContent
    - background ${theme.contextMenuBackground}
    - color ${theme.foregroundColor}
    - box-shadow 0px 0px 2px ${theme.boxShadow}
    - padding 20px
    - position relative
    - min-width 600px
    - max-width 800px
    - max-height 90%
    - white-space nowrap
    - text-overflow ellipsis
    - overflow-x hidden
    - overflow-y scroll
    - textarea
    - margin-bottom 10px
    - white-space pre
    - pre
    - ${theme.enableTextSelect2}
    -
    - .modalClose
    - position absolute
    - top 10px
    - right 10px
    - cursor pointer`
    + rowsLastNode
    + cells tileKeywordCell intCell
    + description Return the last N rows.
    + extends abstractRowFilterTileNode
    + crux rows.last
    + javascript
    + getRowFilterFn() {
    + const limit = parseInt(this.getContent())
    + if (isNaN(limit)) return undefined
    + const start = this.getParentOrDummyTable().getRowCount() - limit
    + return (row, rowIndex) => rowIndex >= start
    -
    - toStumpCode() {
    - return new jtree.TreeNode(`section
    - clickCommand unmountAndDestroyCommand
    - class modalBackground
    - section
    - clickCommand stopPropagationCommand
    - class modalContent
    - a X
    - id closeModalX
    - clickCommand unmountAndDestroyCommand
    - class modalClose
    - {modelStumpCode}`).templateToString({ modelStumpCode: this.getModalStumpCode() })
    + pcaNode
    + description Add Principal Component Columns to input table.
    + string github https://github.com/bitanath/pca
    + example
    + samples.iris
    + bitanath.pca
    + tables.basic
    + string tileScript ohayo/packages/bitanath/pca.js
    + string tileScript ohayo/packages/mathjs/math.min.js
    + extends abstractTransformerNode
    + crux bitanath.pca
    + javascript
    + get pcaLib() {
    + return this.isNodeJs() ? require(__dirname + "/packages/bitanath/pca.js") : PCA
    - }
    -
    - window.AbstractModalTreeComponent
    - = AbstractModalTreeComponent
    - ;
    -
    -
    -
    -
    -
    - class BasicTerminalTreeComponent extends AbstractTreeComponent {
    - toHakonCode() {
    - return `.sourceTextarea
    - height ${this._getHeight()}px
    - font-size 110%
    - border 0
    - white-space nowrap
    - width 100%`
    + get mathLib() {
    + return this.isNodeJs() ? require(__dirname + "/packages/mathjs/math.min.js") : math
    -
    - async saveChangesCommand() {
    - // tood: this is broken. needs to unmount first.
    - // todo: add a patch method to tree.
    - if (this.hasChanges()) await this._getTab().autosaveAndReloadWith(this.getCode())
    + _createOutputTable() {
    + const table = this.getParentOrDummyTable()
    + const matrix = table.toNumericMatrix()
    + const vectors = this.pcaLib.getEigenVectors(matrix)
    + const pcaRows = vectors.map(vec => vec.vector)
    + const rows = table.getRows().map((row, index) => {
    + const obj = row.rowToObjectWithOnlyNativeJavascriptTypes()
    + const vec = matrix[index]
    + obj.pc1 = this.mathLib.dot(vec, pcaRows[0])
    + obj.pc2 = this.mathLib.dot(vec, pcaRows[1])
    + obj.pc3 = this.mathLib.dot(vec, pcaRows[2])
    + return obj
    + })
    + return new Table(rows)
    -
    - _getHeight() {
    - return Math.floor((this.getRootNode().getBodyShadowDimensions().height - 60) * 0.7)
    + columnsRenameNode
    + crux columns.rename
    + cells tileKeywordCell columnNameCell newColumnNameCell
    + description Rename a column
    + extends abstractTransformerNode
    + javascript
    + _createOutputTable() {
    + const renameMap = {}
    + renameMap[this.getWord(1)] = this.getWord(2)
    + return this.getParentOrDummyTable().renameColumns(renameMap)
    -
    - _getProgramSource() {
    - const tab = this._getTab()
    - return tab ? tab.getTabProgram().childrenToString() : ""
    + example
    + samples.iris
    + columns.rename Species Classification
    + columnsCleanNamesNode
    + crux columns.cleanNames
    + cells tileKeywordCell
    + description Simplifies column names by removing punctuation.
    + example
    + samples.iris
    + columns.describe
    + columns.cleanNames
    + columns.describe
    + extends abstractTransformerNode
    + javascript
    + _createOutputTable() {
    + return this.getParentOrDummyTable().cloneWithCleanColumnNames()
    -
    - _getProgram() {
    - const mountedTab = this._getTab()
    - return mountedTab && mountedTab.getTabProgram()
    + columnsSetTypeNode
    + cells tileKeywordCell columnNameCell primitiveTypeCell
    + description Ohayo attempts to choose the correct primitive type, but you can override the default with this tile.
    + example List column information
    + samples.waterBill
    + columns.keep Amount Gallons
    + columns.setType Gallons year
    + columns.describe
    + tables.basic
    + extends abstractTransformerNode
    + crux columns.setType
    + javascript
    + _createOutputTable() {
    + const colToChange = this.getWord(1)
    + const newType = this.getWord(2)
    + return this.getParentOrDummyTable().changeColumnType(colToChange, newType)
    -
    - _getTab() {
    - return this.getRootNode().getMountedTab()
    + dataSynthNode
    + description Synthesizes new datasets based upon the parent tiles schema.
    + crux data.synth
    + catchAllCellType schemaSimpleCell
    + extends abstractTransformerNode
    + inScope schemaNode
    + javascript
    + _createOutputTable() {
    + const schema = this._getSchema()
    + const table = !schema ? this.getParentOrDummyTable() : new Table([], schema)
    + return table.synthesizeTable(this.intCell || 30, Date.now())
    -
    - toStumpCode() {
    - return new jtree.TreeNode(`div
    - style font-size: 16px;
    - class TerminalDiv
    - textarea
    - class sourceTextarea
    - blurCommand saveChangesCommand
    - bern
    - {lines}`).templateToString({ lines: this._getProgramSource() })
    + _getSchema() {
    + const schema = this.getNode("schema")
    + if (schema) return schema.toJTableColumnDefinitionMap()
    + const words = this.getWordsFrom(2)
    + if (words.length)
    + return words.map(word => {
    + const parts = word.split(":")
    + return {
    + name: parts[0],
    + type: parts[1]
    + }
    + })
    -
    - _getTextareaShadow() {
    - return this.getStumpNode()
    - .getNode("textarea")
    - .getShadow()
    + cells tileKeywordCell intCell
    + example
    + samples.iris
    + data.synth 100
    + show.rowCount
    + example
    + data.synth 100
    + schema
    + name string
    + score int
    + finished boolean
    + show.columnCount
    + example
    + data.synth 100 name:string score:int finished:boolean
    + dataAboutNode
    + extends abstractTransformerNode
    + description Gets metadata about a dataset.
    + crux data.about
    + javascript
    + _getDataSetInfo() {
    + const parentTile = this.getParent()
    + const def = parentTile.getDefinition()
    + return {
    + licenseSpecified: parentTile.isDataPublicDomain,
    + tags: def.get("tags"),
    + overviewDescription: parentTile.dataDescription || def.get("description"),
    + dataUrl: parentTile.dataUrl
    + }
    -
    - _updateTA() {
    - if (this._getTextareaShadow()) this._getTextareaShadow().setInputOrTextAreaValue(this._getProgramSource())
    + _createOutputTable() {
    + return new Table([this._getDataSetInfo()])
    -
    - setFile(fileName) {
    - this.setWord(1, fileName)
    + dataUsabilityScoreNode
    + extends dataAboutNode
    + description Generates a Data Usability Score for the input table.
    + crux data.usabilityScore
    + example
    + samples.iris
    + data.usabilityScore
    + tables.basic
    + show.max score
    + javascript
    + _createOutputTable() {
    + const row = this._getDataSetInfo()
    + // todo: a very simplistic approximation of Kaggle's data usability score
    + row.score = Object.values(row).filter(item => !!item).length * 2.5
    + return new Table([row])
    -
    - treeComponentDidUpdate() {
    - this._updateTA()
    - super.treeComponentDidUpdate()
    + fillMissingNode
    + cells tileKeywordCell columnNameCell anyCell
    + description Fill any missing cell in the provided column name with the provided value.
    + extends abstractTransformerNode
    + crux fill.missing
    + example
    + data.inline
    + content
    + name,score
    + bob,
    + mike,55
    + fill.missing score 0
    + javascript
    + _createOutputTable() {
    + return this.getParentOrDummyTable().fillMissing(this.getWord(1), this.getWord(2))
    -
    - getDependencies() {
    - const gutter = this.getParent()
    - const deps = gutter.getDependencies()
    - const panel = gutter.getParent()
    - const tab = this._getTab()
    - const tabProgram = tab && tab.getTabProgram()
    - if (tabProgram && this._getProgramSource() !== this.getCode()) deps.push({ getLineModifiedTime: () => tabProgram.getLineOrChildrenModifiedTime() })
    - deps.push(panel)
    - return deps
    + genRangeNode
    + crux gen.range
    + example
    + gen.range year -1000 2020 1
    + tables.basic
    + description Generate a table with a column from a range
    + extends abstractTransformerNode
    + cells tileKeywordCell newColumnNameCell minCell maxCell stepCell
    + javascript
    + _createOutputTable() {
    + const rows = []
    + // todo: protect against infinite loops
    + let currentValue = this.minCell
    + if (!this.stepCell) throw new Error("Step cannot be zero.")
    + while (currentValue <= this.maxCell) {
    + const row = []
    + row[this.newColumnNameCell] = currentValue
    + rows.push(row)
    + currentValue += this.stepCell
    + }
    + return new Table(rows)
    -
    - _updateHtml() {
    - // noop. todo: is this a good pattern? we noop it because of codemirror.
    + groupByNode
    + frequency .01
    + catchAllCellType columnNameCell
    + inScope reduceNode
    + description Group rows with the same value for a column into one row and provide summary columns.
    + example Group rows and display counts for each group.
    + samples.iris
    + group.by Species
    + tables.basic
    + extends abstractTransformerNode
    + crux group.by
    + string placeholderMessage Enter the column to groupby.
    + javascript
    + _createOutputTable() {
    + const groupByColNames = this.getWordsFrom(1)
    + if (!groupByColNames.length) return this.getParentOrDummyTable().clone()
    + const newCols = this.findNodes("reduce").map(reduceNode => {
    + return {
    + source: reduceNode.getWord(1),
    + reduction: reduceNode.getWord(2),
    + name: reduceNode.getWord(3) || reduceNode.getWordsFrom(1).join("_")
    + }
    + })
    + return this.getParentOrDummyTable().makePivotTable(groupByColNames, newCols)
    -
    - getCode() {
    - const ta = this._getTextareaShadow()
    - return ta ? ta.getShadowValue() : ""
    + rowsSortByNode
    + catchAllCellType columnNameCell
    + description Sort the rows by a column(s) from smallest to largest.
    + example See cheaptest and most expensive months in a family's water bills
    + samples.waterBill
    + rows.sortBy Amount
    + rows.first 1
    + doc.subtitle Cheapest month
    + tables.basic
    + rows.reverse
    + rows.first 1
    + doc.subtitle Most expensive
    + tables.basic
    + extends abstractTransformerNode
    + crux rows.sortBy
    + string placeholderMessage Columns you want to sort by
    + javascript
    + _createOutputTable() {
    + const table = this.getParentOrDummyTable().sortBy(this.getWordsFrom(1))
    + if (this.getFirstWord().includes("Reverse")) return table.reverseRows()
    + return table
    -
    - hasChanges() {
    - const program = this._getProgram()
    - return program && this.getCode() !== program.childrenToString()
    + rowsSortByReverseNode
    + description Sort the rows by a column(s) from largest to smallest.
    + extends rowsSortByNode
    + crux rows.sortByReverse
    + rowsAddOneNode
    + description Add a single row to the parent table, in space-separated value format
    + catchAllCellType anyCell
    + extends abstractTransformerNode
    + crux rows.addOne
    + javascript
    + _createOutputTable() {
    + return this.getParentOrDummyTable().addRow(this.getWordsFrom(1))
    -
    - getWhetherToUpdateAndReason() {
    - if (this.hasFocus())
    - return {
    - shouldUpdate: false,
    - reason: "should NOT Update because currently has focus"
    - }
    - // NEVER UPDATE IF THIS HAS CHANGES.
    - // todo: add tests!
    - return super.getWhetherToUpdateAndReason()
    + textMatchesNode
    + description Scans the input text for a pattern and returns number of hits.
    + crux text.matches
    + cells tileKeywordCell
    + catchAllCellType anyCell
    + extends abstractTransformerNode
    + javascript
    + _createOutputTable() {
    + return new Table([{ count: this.getPipishInput().match(new RegExp(this.getContent(), "g")).length }])
    -
    - hasFocus() {
    - return false
    + textCombineNode
    + description Combine all cells in a column into 1 text block
    + extends abstractTransformerNode
    + crux text.combine
    + cells tileKeywordCell columnNameCell
    + javascript
    + _createOutputTable() {
    + // todo: cleanup
    + const text = this.getParentOrDummyTable()
    + .getRows()
    + .map(row => row.getRowOriginalValue(this.columnNameCell))
    + .join("\\n")
    + return new Table([{ text }])
    - }
    -
    - window.BasicTerminalTreeComponent
    - = BasicTerminalTreeComponent
    - ;
    -
    -
    -
    -
    -
    -
    -
    - // TODO!!!! UNDO/REDO HISTORY IS SAVED ACROSS TAB SWITCHES.
    -
    - const CodeMirrorConstants = {}
    -
    - CodeMirrorConstants.options = {}
    - CodeMirrorConstants.options.theme = "theme"
    - CodeMirrorConstants.themes = {}
    - CodeMirrorConstants.themes.oceanicNext = "oceanic-next"
    - CodeMirrorConstants.themes.default = "default"
    - CodeMirrorConstants.events = {}
    - CodeMirrorConstants.events.blur = "blur"
    - CodeMirrorConstants.events.gutterClick = "gutterClick"
    - CodeMirrorConstants.keyMap = {}
    - CodeMirrorConstants.keyMap.cmdEnter = "Cmd-Enter"
    - CodeMirrorConstants.keyMap.shiftCmdEnter = "Shift-Cmd-Enter"
    - CodeMirrorConstants.keyMap.cmdBackSlash = "Cmd-\\"
    - CodeMirrorConstants.keyMap.cmdS = "Cmd-S"
    - CodeMirrorConstants.keyMap.ctrlS = "Ctrl-S"
    - CodeMirrorConstants.keyMap.escape = "Esc"
    -
    - class CodeMirrorTerminalTreeComponent extends BasicTerminalTreeComponent {
    - getCode() {
    - // todo: this is buggy! figure it out. when toggling pane, it comes back w/o highlighting.
    - // probably shouldn't need this if check
    - const cm = this._getCMEditorInstance()
    - return cm ? cm.getValue() : ""
    + dataInlineNode
    + inScope contentNode parserNode treeLanguageNode
    + frequency .2
    + description Store data in your doc, in CSV, TSV, JSON, and other formats.
    + example
    + data.inline
    + parser csv
    + content
    + petal_length,petal_width,species
    + 4.9,1.8,virginica
    + 4.9,2,virginica
    + 1.5,0.2,setosa
    + string bodyStumpTemplate
    + textarea
    + name content
    + changeCommand changeTileSettingMultilineCommand
    + placeholder Enter data in any format here. It will be saved directly in your document.
    + class TileTextArea savable
    + bern
    + {text}
    + javascript
    + getDataContent() {
    + const node = this.getNode("content")
    + return node ? node.childrenToString() : ""
    -
    - _getCMEditorInstance() {
    - return this._CMEditorInstance
    + getTileBodyStumpCode() {
    + const text = lodash.escape(this.getDataContent())
    + return this.qFormat(this.bodyStumpTemplate, { text })
    -
    - hasFocus() {
    - const cm = this._getCMEditorInstance()
    - return cm && cm.hasFocus()
    + getRowClass() {
    + class InlineDataTileRow extends Row {}
    + return InlineDataTileRow
    -
    - treeComponentDidMount() {
    - this._loadCodeMirror()
    - super.treeComponentDidMount()
    + getParserId() {
    + return super.getParserId() || new TableParser().guessTableParserId(this.getDataContent())
    -
    - _updateTheme() {
    - const cm = this._getCMEditorInstance()
    - if (cm.getOption(CodeMirrorConstants.options.theme) !== this._getCMThemeToUse()) cm.setOption(CodeMirrorConstants.options.theme, this._getCMThemeToUse())
    + async fetchTableInputs() {
    + return new TableParser().parseTableInputsFromString(this.getDataContent(), this.getParserId())
    -
    - _updateTA() {}
    -
    - treeComponentDidUpdate() {
    - const cm = this._getCMEditorInstance()
    - // todo: perf problems here.
    - if (cm) {
    - this._updateTheme()
    - cm.setValue(this._getProgramSource())
    - }
    - super.treeComponentDidUpdate()
    + extends abstractProviderNode
    + crux data.inline
    + dataLocalStorageNode
    + cells tileKeywordCell localStorageKeyCell
    + description Use your browser's localStorage for storing data.
    + string bodyStumpTemplate
    + textarea
    + changeCommand triggerTileMethodCommand
    + placeholder Enter data in any format here. It will be saved in your browser's localStorage.
    + name storeValueCommand
    + class TileTextArea savable
    + bern
    + {text}
    + example
    + data.localStorage a-dropped-file.csv
    + javascript
    + // Note: for now, only way to clear a key is to do it manually through UI (select all delete) or console. That might be good enough.
    + _getStoreKey() {
    + return this.getContent()
    -
    - _getKeyMap() {
    - const cm = this._getCMEditorInstance()
    - const keyMap = {}
    -
    - keyMap[CodeMirrorConstants.keyMap.cmdBackSlash] = () => {
    - this.getRootNode().clearTabMessagesCommand()
    - }
    -
    - keyMap[CodeMirrorConstants.keyMap.escape] = () => {
    - cm.getInputField().blur()
    - }
    -
    - keyMap[CodeMirrorConstants.keyMap.cmdS] = async () => {
    - await this.saveChangesCommand()
    - const app = this.getRootNode()
    - await app.cellCheckProgramCommand()
    - // todo: scroll to proper tile
    - const tile = this._getClosestTileAtCurrentLine()
    - if (tile) tile.scrollIntoView()
    - }
    -
    - keyMap[CodeMirrorConstants.keyMap.ctrlS] = keyMap[CodeMirrorConstants.keyMap.cmdS]
    -
    - return keyMap
    + getDataContent() {
    + const key = this._getStoreKey()
    + return key ? this.getWebApp().getFromStore(key) || "" : ""
    -
    - _getClosestTileAtCurrentLine() {
    - const cm = this._getCMEditorInstance()
    - const range = cm.listSelections()[0]
    - const line = range && range.head.line
    - const app = this.getRootNode()
    - const tab = app.getMountedTab()
    - const tabProgram = tab.getTabProgram()
    - return tabProgram && line !== false ? tabProgram.getTileClosestToLine(line) : undefined
    + storeValueCommand(value) {
    + let key = this._getStoreKey()
    + if (key) this.getWebApp().storeValue(key, value)
    + else this.setContent(this.getWebApp().initLocalDataStorage(this.constructor.name + ".data", value))
    -
    - _getCMThemeToUse() {
    - return this.getRootNode().isGlassTheme() ? CodeMirrorConstants.themes.oceanicNext : CodeMirrorConstants.themes.default
    + getTileBodyStumpCode() {
    + const text = lodash.escape(this.getDataContent())
    + return this.qFormat(this.bodyStumpTemplate, { text })
    -
    - _loadCodeMirror() {
    - if (!CodeMirrorTerminalTreeComponent._cMMode) {
    - const app = this.getRootNode()
    -
    - CodeMirrorTerminalTreeComponent._cMMode = new jtree.TreeNotationCodeMirrorMode(
    - "tree",
    - () => ohayoNode,
    - () => (app.getMountedTab() ? this.getCode() : undefined),
    - CodeMirror
    - ).register()
    + extends dataInlineNode
    + crux data.localStorage
    + debugParserTestNode
    + description Dumps data on why a certain file parser was chosen.
    + example See why a certain file parser was chosen.
    + vega.data descriptions.json
    + debug.parserTest
    + tables.basic
    + extends abstractProviderNode
    + crux debug.parserTest
    + javascript
    + async fetchTableInputs() {
    + const parentTile = this.getParent()
    + if (parentTile.getWillowHttpResponse) {
    + const probs = new TableParser().guessProbabilitiesForAllTableParsers(parentTile.getWillowHttpResponse().text)
    + return {
    + rows: Object.keys(probs).map(key => {
    + return {
    + parser: key,
    + probability: probs[key]
    + }
    + })
    -
    - const cmInstance = CodeMirrorTerminalTreeComponent._cMMode.fromTextAreaWithAutocomplete(this._getTextareaShadow().getShadowElement(), {
    - theme: this._getCMThemeToUse()
    - })
    -
    - this._CMEditorInstance = cmInstance
    -
    - cmInstance.setSize(undefined, this._getHeight())
    -
    - cmInstance.on(CodeMirrorConstants.events.blur, () => {
    - // note: if you have changes in terminal/gutter, they will be saved. no cancel yet.
    - this.saveChangesCommand()
    - })
    - cmInstance.addKeyMap(this._getKeyMap())
    -
    - let waiting
    - const codeWidgets = []
    - cmInstance.on("keyup", () => {
    - clearTimeout(waiting)
    - waiting = setTimeout(() => this._updateHints(cmInstance, codeWidgets), 100)
    - })
    - }
    -
    - _updateHints(codeInstance, codeWidgets) {
    - const app = this.getRootNode()
    - const tab = app.getMountedTab()
    - const program = new ohayoNode(this.getCode())
    - const errs = program.getAllErrors()
    - const cursor = codeInstance.getCursor()
    -
    - // todo: what if 2 errors?
    - codeInstance.operation(function() {
    - codeWidgets.forEach(widget => codeInstance.removeLineWidget(widget))
    - codeWidgets.length = 0
    -
    - errs
    - .filter(err => !err.isCursorOnWord(cursor.line, cursor.ch))
    - .slice(0, 1) // Only show 1 error at a time. Otherwise UX is not fun.
    - .forEach(err => {
    - const el = err.getCodeMirrorLineWidgetElement(() => {
    - codeInstance.setValue(program.toString())
    - // todo: do we need to trigger update?
    - })
    - codeWidgets.push(codeInstance.addLineWidget(err.getLineNumber() - 1, el, { coverGutter: false, noHScroll: false }))
    - })
    - const info = codeInstance.getScrollInfo()
    - const after = codeInstance.charCoords({ line: cursor.line + 1, ch: 0 }, "local").top
    - if (info.top + info.clientHeight < after) codeInstance.scrollTo(null, after - info.clientHeight + 3)
    - })
    - }
    - }
    -
    - window.CodeMirrorTerminalTreeComponent
    - = CodeMirrorTerminalTreeComponent
    - ;
    -
    -
    -
    -
    -
    - class ConsoleTreeComponent extends AbstractTreeComponent {
    - _getConsoleOutput() {
    - const logLines = this._getMessageBuffer().map(message => message.childrenToString())
    - logLines.reverse()
    - return logLines.join("\n")
    - }
    -
    - _getHeight() {
    - return Math.floor((this.getRootNode().getBodyShadowDimensions().height - 60) * 0.3)
    - }
    -
    - setFile(fileName) {
    - this.setWord(1, fileName)
    - }
    -
    - toHakonCode() {
    - return `.consoleOutput
    - height ${this._getHeight()}px
    - overflow scroll
    - font-family monospace
    - white-space nowrap
    - div
    - margin-top 2px`
    + }
    + return [{ rows: [] }]
    -
    - _getMessageBuffer() {
    - // todo: cleanup
    - const app = this.getRootNode()
    - const tab = app.getMountedTab()
    - return tab ? tab.getMessageBuffer() : app.getMessageBuffer()
    + debugGrammarNode
    + description Get the ohayo grammar
    + tags noPicker
    + cells tileKeywordCell
    + crux debug.ohayoGrammar
    + extends abstractProviderNode
    + example Print the ohayo grammar
    + debug.ohayoGrammar
    + treenotation.outline
    + javascript
    + async fetchTableInputs() {
    + return { rows: [{ text: new ohayoNode("").getHandGrammarProgram().toString() }] }
    -
    - getDependencies() {
    - // todo: cleanup
    - // 2 dependencies. the program and the programs message buffer.
    - // let's call the latter the panel buffer for now.
    - const deps = this.getParent().getDependencies()
    - const messages = this._getMessageBuffer()
    - if (messages.length) deps.push(messages.nodeAt(-1))
    - else deps.push(new jtree.TreeNode())
    -
    - deps.push(this.getParent().getParent())
    - return deps
    + debugGrammarTreeNode
    + description Show the family tree for ohayo grammar.
    + tags noPicker
    + cells tileKeywordCell
    + example Show the family tree for ohayo grammar
    + debug.ohayoGrammarTree
    + treenotation.outline
    + extends abstractProviderNode
    + crux debug.ohayoGrammarTree
    + javascript
    + async fetchTableInputs() {
    + return {
    + rows: [
    + {
    + text: new ohayoNode("")
    + .getHandGrammarProgram()
    + .getNodeTypeFamilyTree()
    + .toString()
    + }
    + ]
    + }
    -
    - toStumpCode() {
    - return new jtree.TreeNode(`div
    - class consoleOutput
    - {messageBuffer}`).templateToString({ messageBuffer: this._getConsoleOutput() })
    + editorFilesNode
    + description Fetch your files in the current working folder.
    + example
    + editor.files
    + editor.gallery
    + string tileSize 140 120
    + javascript
    + getRowClass() {
    + // todo: remove?
    + class FileRow extends Row {
    + destroyRow(app) {
    + return app.deleteFileCommand(this.getRowOriginalValue("link"))
    + }
    + }
    + return FileRow
    - }
    -
    - window.ConsoleTreeComponent
    - = ConsoleTreeComponent
    - ;
    -
    - const OhayoConstants = {}
    - OhayoConstants.tileCssScript = "tileCssScript"
    - OhayoConstants.tileScript = "tileScript"
    - OhayoConstants.tileSize = "tileSize"
    - OhayoConstants.abstractTileSetting = "abstractTileSetting"
    -
    - OhayoConstants.noPicker = "noPicker"
    -
    - OhayoConstants.selectedClass = "selected"
    -
    - OhayoConstants.maximized = "maximized"
    - OhayoConstants.pickerTile = "doc.picker"
    -
    - OhayoConstants.abstractTileTreeComponentNode = "abstractTileTreeComponentNode"
    -
    - window.OhayoConstants
    - = OhayoConstants
    - ;
    -
    - // rename lodash
    - if (!window.lodash) window.lodash = _
    -
    - // Shim window.console for IE.
    - if (!window.console) window.console = { log: () => {}, time: () => {}, error: () => {}, debug: () => {} }
    -
    - // Safari polyfill:
    - if (!Object.values) Object.values = obj => Object.keys(obj).map(key => obj[key])
    -
    - const d3format = {}
    - d3format.format = d3.format
    - ;
    -
    - const StudioConstants = {}
    -
    - StudioConstants.gutter = "gutter"
    - StudioConstants.terminal = "terminal"
    - StudioConstants.console = "console"
    - StudioConstants.theme = "theme"
    - StudioConstants.menu = "menu"
    - StudioConstants.wall = "wall"
    - StudioConstants.panel = "panel"
    - StudioConstants.tabs = "tabs"
    - StudioConstants.helpModal = "helpModal"
    - StudioConstants.tabMenu = "tabMenu"
    - StudioConstants.tileMenu = "tileMenu"
    - StudioConstants.DropDownMenuSubstring = "DropDownMenu"
    -
    - StudioConstants.productName = "ohayo"
    - StudioConstants.githubLink = "https://github.com/treenotation/ohayo"
    - StudioConstants.subredditLink = "https://www.reddit.com/r/ohayocomputer"
    - StudioConstants.slogan = "a fast and free data science studio"
    -
    - StudioConstants.ohayoExtension = ".ohayo"
    -
    - StudioConstants.deepLinks = {}
    - StudioConstants.deepLinks.filename = "filename"
    - StudioConstants.deepLinks.data = "data"
    - StudioConstants.deepLinks.edgeSymbol = "edgeSymbol"
    - StudioConstants.deepLinks.nodeBreakSymbol = "nodeBreakSymbol"
    -
    - window.StudioConstants
    - = StudioConstants
    - ;
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - class GutterTreeComponent extends AbstractTreeComponent {
    - createParser() {
    - return new jtree.TreeNode.Parser(undefined, {
    - console: ConsoleTreeComponent,
    - terminal: this.isNodeJs() ? BasicTerminalTreeComponent : CodeMirrorTerminalTreeComponent
    - })
    + async fetchTableInputs() {
    + const files = await this.getWebApp()
    + .getDefaultDisk()
    + .readFiles()
    + return { rows: files.map(file => file.toFileObject()) }
    -
    - get _gutterWidth() {
    - return this.getWord(1)
    + extends abstractProviderNode
    + crux editor.files
    + editorCommandHistoryNode
    + description Outputs row for each command executed in this Ohayo Studio session.
    + example Show what you've done in this tab session.
    + editor.commandHistory
    + tables.basic
    + javascript
    + async fetchTableInputs() {
    + return { rows: this.getWebApp()[this.methodName]() }
    -
    - setGutterWidth(newWidth) {
    - this.setWord(1, newWidth)
    - return this
    + string methodName getCommandsBuffer
    + extends abstractProviderNode
    + crux editor.commandHistory
    + mathGenNode
    + description Generate a stream of numbers from common mathematical functions
    + cells tileKeywordCell mathFunctionNameCell fromCell toCell incrementCell
    + extends abstractProviderNode
    + example
    + math.gen sin 0 10 .1
    + vega.scatter
    + xColumn input
    + yColumn output
    + crux math.gen
    + javascript
    + async fetchTableInputs() {
    + const rows = []
    + const fn = Math[this.getWord(1)]
    + for (let input = parseFloat(this.fromCell); input < parseFloat(this.toCell); input += parseFloat(this.incrementCell)) {
    + rows.push({ input, output: fn(input) })
    + }
    + return {
    + rows
    + }
    -
    - toHakonCode() {
    - const theme = this.getTheme()
    - return `${super.toHakonCode()}
    - .Gutter
    - width ${this._gutterWidth}px
    - left 0
    - background ${theme.backgroundColor}
    - border-color ${theme.borderColor}
    - position absolute
    - border-right-width 1px
    - border-right-style solid
    - box-sizing border-box
    - top 0
    - bottom 0
    - padding 20px
    - .closeGutter
    - cursor pointer
    - position absolute
    - top 10px
    - right 5px
    - display block
    - font-size 12px
    - line-height 10px
    - text-align center
    - opacity .25
    - &:hover
    - opacity 1`
    + abstractRandomTileNode
    + abstract
    + extends abstractProviderNode
    + javascript
    + async fetchTableInputs() {
    + let howMany = this.quantityCell || 30
    + const rows = []
    + for (let index = 1; index <= howMany; index++) {
    + rows.push(this._genRow(index))
    + }
    + return { rows }
    -
    - toStumpCode() {
    - return `div
    - class Gutter
    - span <>
    - class closeGutter
    - clickCommand toggleGutterWidthCommand`
    + randomFloatNode
    + description Generates uniform random floats between min and max.
    + cells tileKeywordCell quantityCell minCell maxCell
    + example Get 10 random probabilities above .5
    + random.float 10 .5 1
    + float min 0
    + float max 1
    + javascript
    + _genRow(index) {
    + return { index, number: jtree.Utils.randomUniformFloat(this.minCell, this.maxCell, Math.random()) }
    - }
    -
    - window.GutterTreeComponent
    - = GutterTreeComponent
    - ;
    -
    -
    -
    -
    -
    -
    - class HelpModal extends AbstractModalTreeComponent {
    - getMomentHelp() {
    - return `Char;Example;Description
    - YYYY;2014;4 or 2 digit year
    - YY;14;2 digit year
    - Y;-25;Year with any number of digits and sign
    - Q;1..4;Quarter of year. Sets month to first month in quarter.
    - M MM;1..12;Month number
    - MMM MMMM;Jan..December;Month name in locale set by moment.locale()
    - D DD;1..31;Day of month
    - Do;1st..31st;Day of month with ordinal
    - DDD DDDD;1..365;Day of year
    - X;1410715640.579;Unix timestamp
    - x;1410715640579;Unix ms timestamp
    - H HH;0..23;24 hour time
    - h hh;1..12;12 hour time used with a A.
    - a/p A/P;am pm;Post or ante meridiem
    - m mm;0..59;Minutes
    - s ss;0..59;Seconds
    - S SS SSS;0..999;Fractional seconds
    - Z ZZ;+12:00;Offset from UTC as +-HH:mm, +-HHmm, or Z
    - w ww;1..53;Locale week of year
    - e;0..6;Locale day of week
    - ddd dddd;Mon...Sunday;Day name in locale set by moment.locale()
    - E;1..7;ISO day of week`
    - .split("\n")
    - .map(line => {
    - const parts = line.split(";")
    - return `${parts[0]}${parts[1]}${parts[2]}`
    - })
    - .join("")
    + extends abstractRandomTileNode
    + crux random.float
    + randomIntNode
    + description Generates uniform random ints between min and max.
    + cells tileKeywordCell quantityCell minCell maxCell
    + example Get 30 random numbers between 0 and 100
    + random.int 30 0 100
    + int min 0
    + int max 100
    + javascript
    + _genRow(index) {
    + return { index, number: jtree.Utils.randomUniformInt(this.minCell, this.maxCell, Math.random()) }
    -
    - toHakonCode() {
    - return `${super.toHakonCode()}
    - p
    - width 100%
    - white-space normal
    - .helpToggle
    - display block
    - .helpSection
    - .helpCategory
    - font-weight bold
    - #shortcutsHelp td
    - padding-right 10px`
    + crux random.int
    + extends abstractRandomTileNode
    + samplesTinyIrisNode
    + description A snippet of the Iris dataset.
    + boolean isDataPublicDomain true
    + string data
    + petal_length,petal_width,species
    + 4.9,1.8,virginica
    + 4.2,1.3,versicolor
    + 4.9,2,virginica
    + 1.5,0.2,setosa
    + extends abstractProviderNode
    + crux samples.tinyIris
    + string bodyStumpTemplate
    + pre
    + class TileSelectable
    + style overflow: scroll; max-height: 100%;
    + bern
    + {text}
    + javascript
    + getDataContent() {
    + return this.data
    -
    - _getShortcutsHelpStumpCode() {
    - let lastCat = ""
    - const app = this.getRootNode()
    - const shortcutRows = app
    - .getKeyboardShortcuts()
    - .map(shortcut => {
    - const category = shortcut.getCategory()
    - let cat = ""
    - if (category !== lastCat) {
    - cat = ` tr
    - td
    ${category}
    - class helpCategory
    - td
    - `
    - lastCat = category
    - }
    - const description = shortcut.getDescription()
    - return `${cat} tr
    - style ${description ? "" : "display: none;"}
    - td ${shortcut.getKeyCombo() || "-"}
    - td   
    - ${shortcut.isEnabled(app) ? "a" : "span"} ${description}
    - clickCommand ${shortcut.getFn()}`
    - })
    - .join("\n")
    - return `table
    - id shortcutsHelp
    - class helpSection
    - ${shortcutRows}`
    + getTileBodyStumpCode() {
    + return this.qFormat(this.bodyStumpTemplate, { text: this.getDataContent() })
    -
    - getModalStumpCode() {
    - const app = this.getRootNode()
    - return `h4 About ${StudioConstants.productName}
    - p ${StudioConstants.productName} is ${StudioConstants.slogan}.
    - p
    - span ${StudioConstants.productName} is on
    - a GitHub
    - href ${StudioConstants.githubLink}
    - span and
    - a Reddit
    - href ${StudioConstants.subredditLink}
    - p Current working folder: ${app.getDefaultDisk().getPathBase()}
    - p Version ${app.getVersion()} ${app.constructor.name}
    - p
    - a Open Demo Page
    - id welcomePageButton
    - clickCommand openOhayoProgramCommand
    - value ohayo.ohayo
    - div Keyboard Shortcuts:
    - ${this._getShortcutsHelpStumpCode()}`
    + getParserId() {
    + return super.getParserId() || new TableParser().guessTableParserId(this.getDataContent())
    - }
    -
    - window.HelpModal
    - = HelpModal
    - ;
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - class TabMenuTreeComponent extends AbstractContextMenuTreeComponent {
    - getContextMenuBodyStumpCode() {
    - const tabId = this.getWord(1)
    - return `a Save File
    - clickCommand saveTabAndNotifyCommand
    - value ${tabId}
    - a Close File
    - clickCommand closeTabCommand
    - value ${tabId}
    - a Rename File
    - clickCommand showTabRenameFilePromptCommand
    - value ${tabId}
    - a Move File
    - clickCommand showTabMoveFilePromptCommand
    - value ${tabId}
    - a Clone File
    - clickCommand cloneTabCommand
    - value ${tabId}
    - a Delete File
    - clickCommand showDeleteFileConfirmDialogCommand
    - value ${tabId}
    - a Copy program as link
    - clickCommand copyTabDeepLinkCommand
    - value ${tabId}
    - a Log program stats
    - clickCommand printProgramStatsCommand
    - value ${tabId}
    - a Close all other files
    - clickCommand closeAllTabsExceptThisOneCommand
    - value ${tabId}`
    + async fetchTableInputs() {
    + return new TableParser().parseTableInputsFromString(this.getDataContent(), this.getParserId())
    - }
    -
    - class TabsTreeComponent extends AbstractTreeComponent {
    - createParser() {
    - return new jtree.TreeNode.Parser(undefined, {
    - tab: TabTreeComponent
    - })
    + assertRowCountNode
    + description Throw an error if row count not correct.
    + tags noPicker
    + example Basics
    + data.inline
    + content
    + country
    + usa
    + assert.rowCount 1
    + extends abstractTileTreeComponentNode
    + cells tileKeywordCell intCell
    + crux assert.rowCount
    + boolean visible false
    + javascript
    + async execute() {
    + const num = this.getWord(1)
    + if (!num) return super.execute()
    + const expected = parseInt(num)
    + const actual = this.getParentOrDummyTable().getRowCount()
    + if (actual !== expected) throw new Error(\`Expected \${expected} but got \${actual}\`)
    + return super.execute()
    -
    - getOpenTabs() {
    - return this.getChildrenByNodeConstructor(TabTreeComponent)
    + printNode
    + description Print input table to console as text.
    + extends abstractTileTreeComponentNode
    + crux print.text
    + example
    + data.inline
    + parser text
    + content
    + Hello world
    + print.text
    + javascript
    + execute() {
    + console.log(this._getMessage())
    -
    - insertTab(url, tabIndex) {
    - return this.insertLine(`tab unmounted ${new FullDiskPath(url).toString()}`, tabIndex)
    + _getMessage() {
    + return this.getPipishInput()
    -
    - toHakonCode() {
    - const theme = this.getTheme()
    - // todo: add comments to Hakon? So we can annotate why we have valignTop
    - const valignTop = "vertical-align top" // https://stackoverflow.com/questions/23529369/why-does-x-overflowhidden-cause-extra-space-below
    - // todo: make tab cell width dynamic? smaller as more tabs open?s
    -
    - return `.TabsTreeComponent
    - display inline-block
    - .TabStub
    - height 30px
    - display inline-block
    - max-width 150px
    - text-overflow ellipsis
    - white-space nowrap
    - ${valignTop}
    - overflow-x hidden
    - box-sizing border-box
    - position relative
    - font-size 13px
    - padding 0 15px
    - color ${theme.menuTreeComponentColor}
    - line-height 30px
    - border-right 1px solid rgba(0,0,0,.2)
    - &:hover
    - background rgba(0,0,0,.1)
    - &:active
    - background rgba(0,0,0,.2)
    - span
    - position absolute
    - top 10px
    - right 5px
    - display block
    - font-size 12px
    - line-height 10px
    - text-align center
    - opacity .25
    - &:hover
    - opacity 1
    - &.mountedTab
    - background rgba(0,0,0,.2)
    - border-bottom 0`
    + printCsvNode
    + description Print input table to console as csv.
    + extends printNode
    + crux print.csv
    + example
    + samples.presidents
    + filter.where HomeState = Illinois
    + print.csv
    + javascript
    + _getMessage() {
    + return this.getParentOrDummyTable().toDelimited(",")
    - }
    -
    - class TabTreeComponent extends AbstractTreeComponent {
    - toStumpCode() {
    - const app = this.getRootNode()
    - const index = this.getIndex()
    - const fullPath = this.getFullTabFilePath()
    - const filename = this.getFileName()
    - const tabId = this._getUid()
    - const filenameWithoutExtension = jtree.Utils.removeFileExtension(filename)
    - return `a ${filenameWithoutExtension}
    - clickCommand mountTabCommand
    - collapse
    - value ${tabId}
    - title ${fullPath}
    - id tab${index}
    - class TabStub ${this.isMountedTab() ? "mountedTab" : ""}
    - span ▾
    - collapse
    - clickCommand openTabMenuCommand
    - value ${tabId}
    - class tabDropDownButton`
    + abstractTileSettingNode
    + cells tileSettingKeywordCell
    + abstract
    + abstractTileSettingTerminalNode
    + javascript
    + getSettingValue() {
    + return this.getContent()
    -
    - toHakonCode() {
    - return `.TabStub
    - .tabDropDownButton
    - opacity 0
    - &:hover
    - .tabDropDownButton
    - cursor pointer
    - opacity 1
    - .TabStub.mountedTab
    - .tabDropDownButton
    - opacity 1`
    + extends abstractTileSettingNode
    + abstract
    + abstractColumnNode
    + cells tileSettingKeywordCell columnNameCell
    + extends abstractTileSettingTerminalNode
    + abstract
    + javascript
    + getRunTimeEnumOptions(cell) {
    + // todo: only works if codemirror === tab
    + try {
    + // todo: handle at static time.
    + const mirrorNode = typeof app === "undefined" ? this : app.mountedProgram.nodeAtLine(this.getLineNumber() - 1)
    + const mirrorParent = mirrorNode && mirrorNode.getParent()
    + if (cell.getCellTypeId() === "columnNameCell" && mirrorParent && mirrorParent.isLoaded()) {
    + const options = mirrorParent.getParentOrDummyTable().getColumnNames()
    + return options
    + }
    + } catch (err) {
    + console.log(err)
    + }
    -
    - async openTabMenuCommand(tabId) {
    - this.getRootNode().toggleAndRender(`${StudioConstants.tabMenu} ${tabId}`)
    + columnNode
    + extends abstractColumnNode
    + crux column
    + sourceColumnNode
    + extends abstractColumnNode
    + crux sourceColumn
    + labelNode
    + extends abstractColumnNode
    + crux label
    + linkNode
    + extends abstractColumnNode
    + crux link
    + sizeColumnNode
    + extends abstractColumnNode
    + crux sizeColumn
    + colorColumnNode
    + extends abstractColumnNode
    + crux colorColumn
    + shapeColumnNode
    + extends abstractColumnNode
    + crux shapeColumn
    + valueNode
    + extends abstractColumnNode
    + crux value
    + countNode
    + extends abstractColumnNode
    + crux count
    + dayColumnNode
    + extends abstractColumnNode
    + crux dayColumn
    + xColumnNode
    + extends abstractColumnNode
    + crux xColumn
    + yColumnNode
    + extends abstractColumnNode
    + crux yColumn
    + genderColumnNode
    + extends abstractColumnNode
    + crux genderColumn
    + headSizeNode
    + extends abstractColumnNode
    + crux headSize
    + radiusNode
    + extends abstractColumnNode
    + crux radius
    + emojiColumnNode
    + extends abstractColumnNode
    + crux emojiColumn
    + parserNode
    + cells tileSettingKeywordCell parserIdsCell
    + description Ohayo tries to pick the best parser for your data, but you can also specify it, like "csv" or "tsv".
    + extends abstractTileSettingTerminalNode
    + crux parser
    + useCacheNode
    + cells tileSettingKeywordCell booleanCell
    + extends abstractTileSettingTerminalNode
    + crux useCache
    + reductionNode
    + cells tileSettingKeywordCell reductionTypeCell
    + extends abstractTileSettingTerminalNode
    + crux reduction
    + abstractCoreTileSettingTerminalNode
    + abstract
    + extends abstractTileSettingTerminalNode
    + hiddenNode
    + extends abstractCoreTileSettingTerminalNode
    + crux hidden
    + visibleNode
    + extends abstractCoreTileSettingTerminalNode
    + crux visible
    + maximizedNode
    + extends abstractCoreTileSettingTerminalNode
    + crux maximized
    + abstractPagePositionNode
    + frequency .2
    + cells tileSettingKeywordCell intCell
    + extends abstractCoreTileSettingTerminalNode
    + abstract
    + leftNode
    + extends abstractPagePositionNode
    + crux left
    + topNode
    + extends abstractPagePositionNode
    + crux top
    + widthNode
    + extends abstractPagePositionNode
    + crux width
    + heightNode
    + extends abstractPagePositionNode
    + crux height
    + reduceNode
    + description Provide information to correctly parse a column.
    + example 4 years of seattle weather
    + vega.data seattle-weather.csv
    + date.addColumns
    + group.by year
    + reduce temp_max mean average_max
    + reduce temp_max max max_max
    + reduce temp_min min min_min
    + tables.basic
    + cells tileSettingKeywordCell columnNameCell reductionTypeCell newColumnNameCell
    + extends abstractTileSettingTerminalNode
    + crux reduce
    + styleNode
    + extends abstractTileSettingTerminalNode
    + crux style
    + columnLimitNode
    + description How many columns to show
    + cells tileSettingKeywordCell intCell
    + extends abstractTileSettingTerminalNode
    + crux columnLimit
    + howManyNode
    + cells tileSettingKeywordCell quantityCell
    + extends abstractTileSettingTerminalNode
    + crux howMany
    + sizeNode
    + cells tileSettingKeywordCell numberCell
    + description Size of mark.
    + extends abstractTileSettingTerminalNode
    + crux size
    + rowDisplayLimitNode
    + cells tileSettingKeywordCell intCell
    + frequency .5
    + description Sets the maximum number of rows to show in a tile.
    + extends abstractTileSettingTerminalNode
    + crux rowDisplayLimit
    + srcNode
    + cells tileSettingKeywordCell urlCell
    + extends abstractTileSettingTerminalNode
    + crux src
    + roughnessNode
    + cells tileSettingKeywordCell roughnessCell
    + description Roughness level of chart. Default is 1.
    + extends abstractTileSettingTerminalNode
    + crux roughness
    + colorsNode
    + cells tileSettingKeywordCell
    + catchAllCellType anyCell
    + description Colors to use for the lines.
    + extends abstractTileSettingTerminalNode
    + crux colors
    + cameraPositionNode
    + cells tileSettingKeywordCell cameraDistanceNumberCell horizontalNumberCell verticalNumberCell
    + extends abstractTileSettingTerminalNode
    + crux cameraPosition
    + treeLanguageNode
    + cells tileSettingKeywordCell supportedTreeLanguageCell
    + extends abstractTileSettingTerminalNode
    + crux treeLanguage
    + abstractTileSettingNonTerminalNode
    + javascript
    + getSettingValue() {
    + return this.childrenToString()
    -
    - getDeepLink() {
    - const obj = {}
    - obj[StudioConstants.deepLinks.filename] = this.getFileName()
    - return this.getRootNode()
    - .getWillowBrowser()
    - .toPrettyDeepLink(this.getTabProgram().childrenToString(), obj)
    + extends abstractTileSettingNode
    + catchAllNodeType tileSettingNonTerminalContentNode
    + abstract
    + contentNode
    + catchAllNodeType lineOfContentNode
    + extends abstractTileSettingNonTerminalNode
    + crux content
    + catchAllNodesPostContentNode
    + catchAllCellType anyCell
    + extends abstractTileSettingNonTerminalNode
    + crux catchAllNodesPostContent
    + postNode
    + catchAllNodeType catchAllNodesPostContentNode
    + extends abstractTileSettingNonTerminalNode
    + crux post
    + abstractDocSettingNode
    + cells tileKeywordCell
    + abstract
    + boolean visible false
    + docCategoriesNode
    + extends abstractDocSettingNode
    + crux doc.categories
    + description Add some categories to the document for organization.
    + catchAllCellType documentCategoryCell
    + docAuthorNode
    + extends abstractDocSettingNode
    + catchAllCellType stringCell
    + crux doc.author
    + description Add one author per line.
    + docDateNode
    + description Date published.
    + extends abstractDocSettingNode
    + crux doc.date
    + catchAllCellType dateCell
    + abstractDocSectionComponentNode
    + abstract
    + docSectionSubtitleNode
    + extends abstractDocSectionComponentNode
    + crux subtitle
    + cells tileKeywordCell
    + catchAllCellType stringCell
    + javascript
    + compile() {
    + return \`h2 \${this.getContent()}\`
    -
    - autosaveAndRender() {
    - const savingPromise = this.autosaveTab()
    - this.getRootNode().renderApp()
    - return savingPromise
    + docSectionParagraphNode
    + extends abstractDocSectionComponentNode
    + crux paragraph
    + cells tileKeywordCell
    + catchAllCellType stringCell
    + catchAllNodeType docParagraphLineNode
    + string stumpTemplate
    + p
    + bern
    + {content}
    + javascript
    + compile() {
    + return new jtree.TreeNode(this.stumpTemplate).templateToString({ content: this.getContentWithChildren() })
    -
    - async autosaveAndReloadWith(str) {
    - this.getTabProgram().setChildren(str)
    - await this.autosaveTab()
    - this.getTabWall().unmount() //ugly!
    - await this._initProgramRenderAndRun(str)
    - this.getRootNode().renderApp()
    + docSectionLinkNode
    + extends abstractDocSectionComponentNode
    + crux link
    + cells tileKeywordCell urlCell
    + catchAllCellType stringCell
    + string stumpTemplate
    + a {content}
    + href {url}
    + javascript
    + compile() {
    + return new jtree.TreeNode(this.stumpTemplate).templateToString({ content: this.getWordsFrom(2).join(" "), url: this.getWord(1) })
    -
    - async _initProgramRenderAndRun(source, shouldMount) {
    - this._program = new ohayoNode(source)
    - this._program.saveVersion()
    - this._program.setTab(this)
    - const app = this.getRootNode()
    -
    - if (shouldMount) app.setMountedTab(this)
    -
    - app.renderApp()
    - await this._program.loadAndIncrementalRender()
    - return this
    + example
    + doc.section
    + link http://ohayo.breckyunits.com Ohayo
    + docSectionCodeNode
    + extends abstractDocSectionComponentNode
    + crux code
    + cells tileKeywordCell programmingLanguageNameCell
    + catchAllNodeType docLineOfCodeNode
    + string stumpTemplate
    + code
    + bern
    + {content}
    + javascript
    + compile() {
    + return new jtree.TreeNode(this.stumpTemplate).templateToString({ content: this.childrenToString().replace(/
    -
    - async reloadFromDisk() {
    - const source = await this.getRootNode().readFile(this.getFullTabFilePath())
    - return this.autosaveAndReloadWith(source)
    + example
    + doc.section
    + subtitle Some Code
    + code latex
    + E_0 &= mc^2
    + E &= \\frac{mc^2}{\\sqrt{1-\\frac{v^2}{c^2}}}
    + docLineOfCodeNode
    + catchAllCellType codeCell
    + catchAllNodeType docLineOfCodeNode
    + docParagraphLineNode
    + catchAllCellType stringCell
    + catchAllNodeType docParagraphLineNode
    + commentLineNode
    + catchAllCellType commentCell
    + catchAllNodeType commentLineNode
    + docReferenceUrlNode
    + crux url
    + cells tileSettingKeywordCell urlCell
    + description URL for the reference
    + catchAllErrorNode
    + catchAllCellType errorCell
    + baseNodeType errorNode
    + hashBangNode
    + crux #!
    + tags noPicker
    + description Standard bash hashBang line.
    + catchAllCellType hashBangWordCell
    + ohayoNode
    + root
    + _extendsJsClass AbstractTreeComponent
    + _rootNodeJsHeader
    + const projectRootDir = jtree.Utils.findProjectRoot(__dirname, "ohayo")
    + const { AbstractTreeComponent } = require(projectRootDir + "node_modules/jtree/products/TreeComponentFramework.node.js")
    + const OhayoConstants = require(projectRootDir + "studio/treeComponents/OhayoConstants.js")
    + const StudioConstants = require(projectRootDir + "studio/treeComponents/StudioConstants.js")
    + const Icons = require(projectRootDir + "studio/themes/Icons.js")
    + const lodash = require(projectRootDir + "node_modules/lodash")
    + const { Table, DummyDataSets, Row, TableParser } = require("jtree/products/jtable.node.js")
    + const marked = require("marked")
    + const moment = require("moment")
    + // https://github.com/gentooboontoo/js-quantities
    + // https://github.com/moment/moment/issues/2469
    + // todo: ugly. how do we ditch this or test?
    + moment.createFromInputFallback = function(momentConfig) {
    + momentConfig._d = new Date(momentConfig._i)
    -
    - async _fetchTabInitProgramRenderAndRun(shouldMount) {
    - const source = await this.getRootNode().readFile(this.getFullTabFilePath())
    - const res = await this._initProgramRenderAndRun(source, shouldMount)
    - return res
    + const numeral = require("numeral")
    + catchAllNodeType DidYouMeanTileNode
    + description Ohayo is a programming language for doing data science.
    + inScope abstractTileTreeComponentNode tileBlankLineNode abstractDocSettingNode hashBangNode
    + javascript
    + getTileClosestToLine(lineIndex) {
    + let current = this.nodeAtLine(lineIndex)
    + while (current) {
    + if (current.doesExtend("abstractTileTreeComponentNode")) return current
    + current = current.getParent()
    + }
    -
    - async autosaveTab() {
    - this.getTabProgram().saveVersion()
    - const app = this.getRootNode()
    - if (!app.isAutoSaveEnabled()) return undefined
    -
    - await this.forceSaveToFile()
    - this.addStumpCodeMessageToLog(`div Saved ${this.getFileName()}
    - title Saved ${this.getFullTabFilePath()}`)
    + setTab(tab) {
    + this._tab = tab
    -
    - forceSaveToFile() {
    - const newVersion = this.getTabProgram().toString()
    - return this.getRootNode().writeFile(this.getFullTabFilePath(), newVersion)
    + getTheme() {
    + const tab = this.getTab()
    + return tab ? tab.getTheme() : super.getTheme()
    -
    - getFullTabFilePath() {
    - return this.getWordsFrom(2).join(" ")
    + getTab() {
    + return this._tab
    -
    - getFileName() {
    - return jtree.Utils.getFileName(this.getFullTabFilePath())
    + async loadAndIncrementalRender() {
    + const app = this.getTab().getRootNode()
    + await Promise.all(this.getTiles().map(tile => tile.loadBrowserRequirements()))
    + await Promise.all(
    + this.getRootLevelTiles().map(async tile => {
    + await tile.execute()
    + app.renderApp()
    + })
    + )
    + app.renderApp() // this one might be superfluous
    + return this
    -
    - getTabWall() {
    - return this.getRootNode().getAppWall()
    + getTiles() {
    + return this.getTopDownArray().filter(node => node.doesExtend("abstractTileTreeComponentNode"))
    -
    - isMountedTab() {
    - return this.getWord(1) === "mounted"
    + getRootLevelTiles() {
    + return this.filter(node => node.doesExtend("abstractTileTreeComponentNode"))
    -
    - markAsUnmounted() {
    - this.setWord(1, "unmounted")
    - return this
    + _getProjectRootDir() {
    + return this.isNodeJs() ? jtree.Utils.findProjectRoot(__dirname, "ohayo") : ""
    -
    - markAsMounted() {
    - this.setWord(1, "mounted")
    - return this
    + toRunTimeStats() {
    + const tiles = this.getTiles()
    + const stats = {
    + tiles: tiles.length,
    + treeLanguage: this.getHandGrammarProgram().getExtensionName(),
    + url: this.getTab().getFileName()
    + }
    + stats.timeToLoad = this.getTiles()
    + .map(tile => tile.getTimeToLoad())
    + .sort()
    + .reverse()[0]
    + stats.timeToRender = this.getTiles()
    + .map(tile => tile.getNewestTimeToRender())
    + .sort()
    + .reverse()[0]
    + return stats
    -
    - async appendFromPaste(pastedText) {
    - const tabProgram = this.getTabProgram()
    - const newNodes = tabProgram.concat(pastedText)
    - const newTiles = newNodes.filter(tile => tile.doesExtend && tile.doesExtend(OhayoConstants.abstractTileTreeComponentNode))
    - this.addStumpCodeMessageToLog(`div Pasted ${newTiles.length} nodes`)
    - await this.autosaveTab()
    - tabProgram.clearSelection()
    - this.getTabWall().unmount()
    -
    - // todo: catch if a tile throws so that we still render the terminal.
    - await tabProgram.loadAndIncrementalRender()
    - newTiles.forEach(tile => tile.selectTile())
    + async execute() {
    + await Promise.all(this.map(node => node.execute()))
    + // Use shell tiles to do any outputs
    -
    - getTabProgram() {
    - return this._program
    + _getProgramRowCount() {
    + return this.getAllRowsFromAllOutputTables().reduce((acc, curr) => acc + curr.length, 0)
    -
    - async unlinkTab() {
    - return this.getRootNode().unlinkFile(this.getFullTabFilePath())
    + getOutputOrInputTable() {
    + // todo: remove this?
    + if (!this._outputTable) this._outputTable = new Table()
    + return this._outputTable
    - }
    -
    - window.TabsTreeComponent = TabsTreeComponent
    -
    - window.TabMenuTreeComponent = TabMenuTreeComponent
    - ;
    -
    -
    -
    -
    -
    -
    -
    - class LogoTreeComponent extends AbstractTreeComponent {
    - toStumpCode() {
    - return `a help
    - clickCommand toggleHelpCommand
    - class LogoTreeComponent`
    + getRowsFromLastTable() {
    + const tiles = this.getTopDownArray()
    + return tiles[tiles.length - 1].getOutputOrInputTable().getRows()
    - }
    -
    - class NewButtonTreeComponent extends AbstractTreeComponent {
    - toStumpCode() {
    - return `a  +
    - id newButton
    - class NewButtonTreeComponent
    - clickCommand createNewBlankProgramCommand
    - value untitled.ohayo`
    + getAllRowsFromAllOutputTables() {
    + return jtree.Utils.flatten(
    + this.getTiles()
    + .map(tile => tile.getOutputTable())
    + .filter(table => table)
    + .map(table => table.getRows())
    + )
    + tileSettingNonTerminalContentNode
    + baseNodeType blobNode
    + lineOfContentNode
    + catchAllNodeType lineOfContentNode
    + catchAllCellType stringCell
    + columnDefinitionNode
    + cells columnNameCell primitiveTypeCell
    + schemaNode
    + crux schema
    + description A basic schema language consisting of one column name followed by a primitive column type per line.
    + cells tileSettingKeywordCell
    + catchAllNodeType columnDefinitionNode
    + javascript
    + toJTableColumnDefinitionMap() {
    + return this.map(row => {
    + return {
    + name: row.getWord(0),
    + type: row.getWord(1)
    + }
    + })
    + }`)
    + return this._cachedHandGrammarProgramRoot
    + }
    + static getNodeTypeMap() {
    + return {
    + tileBlankLineNode: tileBlankLineNode,
    + abstractTileTreeComponentNode: abstractTileTreeComponentNode,
    + abstractChartNode: abstractChartNode,
    + abstractTextNode: abstractTextNode,
    + abstractInstructionsNode: abstractInstructionsNode,
    + amazonHistoryNode: amazonHistoryNode,
    + fitbitAllNode: fitbitAllNode,
    + abstractComingSoonNode: abstractComingSoonNode,
    + datawrapperComingSoonNode: datawrapperComingSoonNode,
    + dcjsComingSoonNode: dcjsComingSoonNode,
    + finosPerspectiveComingSoonNode: finosPerspectiveComingSoonNode,
    + fivethirtyeightComingSoonNode: fivethirtyeightComingSoonNode,
    + GovNode: GovNode,
    + highchartsComingSoonNode: highchartsComingSoonNode,
    + re3dataComingSoonNode: re3dataComingSoonNode,
    + zingComingSoonNode: zingComingSoonNode,
    + editorHelloWorldNode: editorHelloWorldNode,
    + abstractSnippetGalleryNode: abstractSnippetGalleryNode,
    + abstractTemplateGalleryNode: abstractTemplateGalleryNode,
    + challengeListNode: challengeListNode,
    + samplesListNode: samplesListNode,
    + vegaDataListNode: vegaDataListNode,
    + vegaExampleListNode: vegaExampleListNode,
    + abstractPickerTileNode: abstractPickerTileNode,
    + PickerTileNode: PickerTileNode,
    + templatesListNode: templatesListNode,
    + asciiChartNode: asciiChartNode,
    + calendarHeatNode: calendarHeatNode,
    + challengePlayNode: challengePlayNode,
    + debugDumpNode: debugDumpNode,
    + webDumpNode: webDumpNode,
    + debugCommandsNode: debugCommandsNode,
    + debugSleepNode: debugSleepNode,
    + debugNoOpNode: debugNoOpNode,
    + debugThrowNode: debugThrowNode,
    + dtjsBasicNode: dtjsBasicNode,
    + editorGalleryNode: editorGalleryNode,
    + handsontableBasicNode: handsontableBasicNode,
    + abstractHtmlNode: abstractHtmlNode,
    + htmlTextNode: htmlTextNode,
    + htmlPrintAsNode: htmlPrintAsNode,
    + abstractHTMLFixedTagTileNode: abstractHTMLFixedTagTileNode,
    + htmlH1Node: htmlH1Node,
    + abstractHTMLContentIsSrcTileNode: abstractHTMLContentIsSrcTileNode,
    + htmlImgNode: htmlImgNode,
    + htmlIframeNode: htmlIframeNode,
    + htmlCustomNode: htmlCustomNode,
    + iconsIconNode: iconsIconNode,
    + iconsHumanNode: iconsHumanNode,
    + iconsCircleNode: iconsCircleNode,
    + listBasicNode: listBasicNode,
    + listLinksNode: listLinksNode,
    + markdownToHtmlNode: markdownToHtmlNode,
    + abstractRoughJsChartNode: abstractRoughJsChartNode,
    + abstractRoughJsLabelValueNode: abstractRoughJsLabelValueNode,
    + roughJsBarNode: roughJsBarNode,
    + roughJsPieNode: roughJsPieNode,
    + roughJsLineNode: roughJsLineNode,
    + abstractShowTileNode: abstractShowTileNode,
    + showRowCountNode: showRowCountNode,
    + showColumnCountNode: showColumnCountNode,
    + showStaticNode: showStaticNode,
    + showValueNode: showValueNode,
    + showMedianNode: showMedianNode,
    + showSumNode: showSumNode,
    + showMeanNode: showMeanNode,
    + showMinNode: showMinNode,
    + showMaxNode: showMaxNode,
    + tablesBasicNode: tablesBasicNode,
    + tablesInterestingNode: tablesInterestingNode,
    + tablesDumpNode: tablesDumpNode,
    + textWordcloudNode: textWordcloudNode,
    + treenotation3dNode: treenotation3dNode,
    + treenotationOutlineNode: treenotationOutlineNode,
    + treenotationDotlineNode: treenotationDotlineNode,
    + abstractVegaNode: abstractVegaNode,
    + vegaBarNode: vegaBarNode,
    + vegaLineNode: vegaLineNode,
    + vegaAreaNode: vegaAreaNode,
    + vegaScatterNode: vegaScatterNode,
    + vegaBubbleNode: vegaBubbleNode,
    + vegaEmojiNode: vegaEmojiNode,
    + vegaHistogramNode: vegaHistogramNode,
    + vegaExampleNode: vegaExampleNode,
    + DidYouMeanTileNode: DidYouMeanTileNode,
    + abstractDocTileNode: abstractDocTileNode,
    + docTitleNode: docTitleNode,
    + docSubtitleNode: docSubtitleNode,
    + docSectionNode: docSectionNode,
    + docReferenceNode: docReferenceNode,
    + docCommentNode: docCommentNode,
    + docToolingNode: docToolingNode,
    + abstractProviderNode: abstractProviderNode,
    + abstractUrlNoCellsNode: abstractUrlNoCellsNode,
    + abstractUrlNode: abstractUrlNode,
    + abstractUrlsNode: abstractUrlsNode,
    + githubInfoNode: githubInfoNode,
    + diskBrowseNode: diskBrowseNode,
    + diskReadNode: diskReadNode,
    + abstractHackernewsNode: abstractHackernewsNode,
    + hackernewsTopNode: hackernewsTopNode,
    + hackernewsSubmissionsNode: hackernewsSubmissionsNode,
    + publicApisNode: publicApisNode,
    + webGetNode: webGetNode,
    + webPostNode: webPostNode,
    + wikipediaContentNode: wikipediaContentNode,
    + abstractFixedDatasetFromUrlNode: abstractFixedDatasetFromUrlNode,
    + abstractFixedDatasetFromOhayoCollectionNode: abstractFixedDatasetFromOhayoCollectionNode,
    + cancerCasesNode: cancerCasesNode,
    + abstractCdcInfantPercentileNode: abstractCdcInfantPercentileNode,
    + weightPercentilesNode: weightPercentilesNode,
    + lengthPercentilesNode: lengthPercentilesNode,
    + headPercentilesNode: headPercentilesNode,
    + kaggleDatasetsHeartNode: kaggleDatasetsHeartNode,
    + mozTop500Node: mozTop500Node,
    + lifeExpectancyNode: lifeExpectancyNode,
    + owidListNode: owidListNode,
    + samplesTelescopesNode: samplesTelescopesNode,
    + samplesMtcarsNode: samplesMtcarsNode,
    + samplesIrisNode: samplesIrisNode,
    + samplesFlights14Node: samplesFlights14Node,
    + samplesSiNode: samplesSiNode,
    + samplesPortalNode: samplesPortalNode,
    + samplesStarWarsNode: samplesStarWarsNode,
    + samplesPopulationsNode: samplesPopulationsNode,
    + samplesBabyNamesNode: samplesBabyNamesNode,
    + samplesDeclarationNode: samplesDeclarationNode,
    + samplesPeriodicTableNode: samplesPeriodicTableNode,
    + samplesLettersNode: samplesLettersNode,
    + samplesPresidentsNode: samplesPresidentsNode,
    + ucimlrDatasetsNode: ucimlrDatasetsNode,
    + vegaDataNode: vegaDataNode,
    + redditAllNode: redditAllNode,
    + redditSubsNode: redditSubsNode,
    + redditSubNode: redditSubNode,
    + abstractDummyNode: abstractDummyNode,
    + samplesPatientsNode: samplesPatientsNode,
    + samplesPoemNode: samplesPoemNode,
    + samplesOuterSpaceNode: samplesOuterSpaceNode,
    + samplesTreeProgramNode: samplesTreeProgramNode,
    + samplesWaterBillNode: samplesWaterBillNode,
    + samplesGapMinderNode: samplesGapMinderNode,
    + abstractTransformerNode: abstractTransformerNode,
    + abstractColumnAdderTileNode: abstractColumnAdderTileNode,
    + dateAddColumnsNode: dateAddColumnsNode,
    + genConstantNode: genConstantNode,
    + genGrowthNode: genGrowthNode,
    + mathLogNode: mathLogNode,
    + rowsAddIndexColumnNode: rowsAddIndexColumnNode,
    + rowsRunningTotalNode: rowsRunningTotalNode,
    + textLengthNode: textLengthNode,
    + textSplitNode: textSplitNode,
    + reverseTextSplitNode: reverseTextSplitNode,
    + textToLowerCaseNode: textToLowerCaseNode,
    + textTemplateNode: textTemplateNode,
    + textPermalinkNode: textPermalinkNode,
    + textReplaceNode: textReplaceNode,
    + textTrimNode: textTrimNode,
    + textSubstringNode: textSubstringNode,
    + testFirstLetterNode: testFirstLetterNode,
    + abstractNewRowsTransformerTileNode: abstractNewRowsTransformerTileNode,
    + columnsDescribeNode: columnsDescribeNode,
    + columnsListNode: columnsListNode,
    + dataEvalNode: dataEvalNode,
    + joinByNode: joinByNode,
    + matchColumnsFuzzyNode: matchColumnsFuzzyNode,
    + schemaTypeScriptNode: schemaTypeScriptNode,
    + schemaSimpleNode: schemaSimpleNode,
    + textWordCountNode: textWordCountNode,
    + textLineCountNode: textLineCountNode,
    + treenotationWordTypesNode: treenotationWordTypesNode,
    + abstractColumnFilterTileNode: abstractColumnFilterTileNode,
    + columnsFirstNode: columnsFirstNode,
    + columnsLastNode: columnsLastNode,
    + columnsDropNode: columnsDropNode,
    + columnsDropConstantsNode: columnsDropConstantsNode,
    + columnsKeepNode: columnsKeepNode,
    + columnsKeepNumericsNode: columnsKeepNumericsNode,
    + abstractTransformerNoParamsTileNode: abstractTransformerNoParamsTileNode,
    + rowsShuffleNode: rowsShuffleNode,
    + rowsReverseNode: rowsReverseNode,
    + abstractRowFilterTileNode: abstractRowFilterTileNode,
    + filterWhereNode: filterWhereNode,
    + filterWithNode: filterWithNode,
    + filterWithoutNode: filterWithoutNode,
    + filterAnyNode: filterAnyNode,
    + rowsFirstNode: rowsFirstNode,
    + rowsSampleNode: rowsSampleNode,
    + rowsDropIfMissingNode: rowsDropIfMissingNode,
    + rowsLastNode: rowsLastNode,
    + pcaNode: pcaNode,
    + columnsRenameNode: columnsRenameNode,
    + columnsCleanNamesNode: columnsCleanNamesNode,
    + columnsSetTypeNode: columnsSetTypeNode,
    + dataSynthNode: dataSynthNode,
    + dataAboutNode: dataAboutNode,
    + dataUsabilityScoreNode: dataUsabilityScoreNode,
    + fillMissingNode: fillMissingNode,
    + genRangeNode: genRangeNode,
    + groupByNode: groupByNode,
    + rowsSortByNode: rowsSortByNode,
    + rowsSortByReverseNode: rowsSortByReverseNode,
    + rowsAddOneNode: rowsAddOneNode,
    + textMatchesNode: textMatchesNode,
    + textCombineNode: textCombineNode,
    + dataInlineNode: dataInlineNode,
    + dataLocalStorageNode: dataLocalStorageNode,
    + debugParserTestNode: debugParserTestNode,
    + debugGrammarNode: debugGrammarNode,
    + debugGrammarTreeNode: debugGrammarTreeNode,
    + editorFilesNode: editorFilesNode,
    + editorCommandHistoryNode: editorCommandHistoryNode,
    + mathGenNode: mathGenNode,
    + abstractRandomTileNode: abstractRandomTileNode,
    + randomFloatNode: randomFloatNode,
    + randomIntNode: randomIntNode,
    + samplesTinyIrisNode: samplesTinyIrisNode,
    + assertRowCountNode: assertRowCountNode,
    + printNode: printNode,
    + printCsvNode: printCsvNode,
    + abstractTileSettingNode: abstractTileSettingNode,
    + abstractTileSettingTerminalNode: abstractTileSettingTerminalNode,
    + abstractColumnNode: abstractColumnNode,
    + columnNode: columnNode,
    + sourceColumnNode: sourceColumnNode,
    + labelNode: labelNode,
    + linkNode: linkNode,
    + sizeColumnNode: sizeColumnNode,
    + colorColumnNode: colorColumnNode,
    + shapeColumnNode: shapeColumnNode,
    + valueNode: valueNode,
    + countNode: countNode,
    + dayColumnNode: dayColumnNode,
    + xColumnNode: xColumnNode,
    + yColumnNode: yColumnNode,
    + genderColumnNode: genderColumnNode,
    + headSizeNode: headSizeNode,
    + radiusNode: radiusNode,
    + emojiColumnNode: emojiColumnNode,
    + parserNode: parserNode,
    + useCacheNode: useCacheNode,
    + reductionNode: reductionNode,
    + abstractCoreTileSettingTerminalNode: abstractCoreTileSettingTerminalNode,
    + hiddenNode: hiddenNode,
    + visibleNode: visibleNode,
    + maximizedNode: maximizedNode,
    + abstractPagePositionNode: abstractPagePositionNode,
    + leftNode: leftNode,
    + topNode: topNode,
    + widthNode: widthNode,
    + heightNode: heightNode,
    + reduceNode: reduceNode,
    + styleNode: styleNode,
    + columnLimitNode: columnLimitNode,
    + howManyNode: howManyNode,
    + sizeNode: sizeNode,
    + rowDisplayLimitNode: rowDisplayLimitNode,
    + srcNode: srcNode,
    + roughnessNode: roughnessNode,
    + colorsNode: colorsNode,
    + cameraPositionNode: cameraPositionNode,
    + treeLanguageNode: treeLanguageNode,
    + abstractTileSettingNonTerminalNode: abstractTileSettingNonTerminalNode,
    + contentNode: contentNode,
    + catchAllNodesPostContentNode: catchAllNodesPostContentNode,
    + postNode: postNode,
    + abstractDocSettingNode: abstractDocSettingNode,
    + docCategoriesNode: docCategoriesNode,
    + docAuthorNode: docAuthorNode,
    + docDateNode: docDateNode,
    + abstractDocSectionComponentNode: abstractDocSectionComponentNode,
    + docSectionSubtitleNode: docSectionSubtitleNode,
    + docSectionParagraphNode: docSectionParagraphNode,
    + docSectionLinkNode: docSectionLinkNode,
    + docSectionCodeNode: docSectionCodeNode,
    + docLineOfCodeNode: docLineOfCodeNode,
    + docParagraphLineNode: docParagraphLineNode,
    + commentLineNode: commentLineNode,
    + docReferenceUrlNode: docReferenceUrlNode,
    + catchAllErrorNode: catchAllErrorNode,
    + hashBangNode: hashBangNode,
    + ohayoNode: ohayoNode,
    + tileSettingNonTerminalContentNode: tileSettingNonTerminalContentNode,
    + lineOfContentNode: lineOfContentNode,
    + columnDefinitionNode: columnDefinitionNode,
    + schemaNode: schemaNode,
    + }
    + }
    + }
    +
    + class tileSettingNonTerminalContentNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(this._getBlobNodeCatchAllNodeType())
    + }
    + getErrors() {
    + return []
    + }
    + }
    +
    + class lineOfContentNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(lineOfContentNode, undefined, undefined)
    + }
    + get stringCell() {
    + return this.getWordsFrom(0)
    + }
    + }
    +
    + class columnDefinitionNode extends jtree.GrammarBackedNode {
    + get columnNameCell() {
    + return this.getWord(0)
    + }
    + get primitiveTypeCell() {
    + return this.getWord(1)
    + }
    + }
    +
    + class schemaNode extends jtree.GrammarBackedNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(columnDefinitionNode, undefined, undefined)
    + }
    + get tileSettingKeywordCell() {
    + return this.getWord(0)
    + }
    + toJTableColumnDefinitionMap() {
    + return this.map((row) => {
    + return {
    + name: row.getWord(0),
    + type: row.getWord(1),
    + }
    + })
    + }
    + }
    +
    + window.ohayoNode = ohayoNode
    + }
    +
    + ;("use strict")
    + window.challengesTree = `challenge
    + id 1
    + question How many U.S. Presidents were born in California?
    + answer 2
    + difficulty easy
    + solution
    + samples.presidents
    + filter.with California
    + tables.basic
    + challenge
    + id 2
    + question What is the score of the highest rated movie on IMDB?
    + answer 9.2
    + difficulty easy
    + solution
    + vega.data movies.json
    + columns.keep Title IMDB_Rating
    + filter.where IMDB_Rating > 0
    + rows.sortBy IMDB_Rating
    + rows.reverse
    + tables.basic
    + challenge
    + id 3
    + question How many movies are rated 8+ on IMDB?
    + answer 157
    + difficulty easy
    + solution
    + vega.data movies.json
    + filter.where IMDB_Rating > 8
    + columns.keep Title IMDB_Rating
    + tables.basic
    + challenge
    + id 4
    + question In the sample dataset "waterBill", what is the median monthly water bill?
    + answer 65.03
    + difficulty easy
    + solution
    + samples.waterBill
    + columns.describe
    + columns.keep Column median
    + tables.basic
    + challenge
    + id 5
    + question In the Declaration of Independence, how many times does the word "people" appear, including when capitalized?
    + answer 10
    + difficulty medium
    + solution
    + samples.declaration
    + text.toLowerCase text
    + text.wordCount
    + filter.where word = people
    + show.max count Count`
    + ;("use strict")
    + window.TemplatesStamp = `file templates/amazon-purchase-history.ohayo
    + data
    + doc.title Amazon Purchase History
    + doc.comment Delete the below line and replace with your data
    + amazon.history
    + columns.keep Category ItemTotal OrderDate Title
    + tables.basic
    + group.by Category
    + reduce ItemTotal sum sum
    + vega.bar Amount Spent by Category
    + xColumn Category
    + yColumn sum
    + date.addColumns year
    + group.by year
    + reduce ItemTotal sum totalSpent
    + vega.bar Amount Spent by Year
    + yColumn totalSpent
    + xColumn year
    + vega.bar Items Purchases by Year
    + yColumn count
    + xColumn year
    + doc.categories shopping
    + file templates/boiling-points.ohayo
    + data
    + doc.title Boiling Points
    + samples.periodicTable
    + vega.scatter Boiling Point by Atomic Number
    + xColumn AtomicNumber
    + yColumn BoilingPoint
    + colorColumn Phase
    + doc.categories chemistry
    + file templates/cancer-rates-in-the-us.ohayo
    + data
    + doc.title Cancer Rates in the U.S.
    + cancer.cases
    + tables.basic
    + show.sum Female Total female cases
    + vega.bar
    + xColumn CancerType
    + yColumn Female
    + show.sum Male Total male cases
    + columns.setType Male number
    + vega.bar
    + xColumn CancerType
    + yColumn Male
    + doc.categories medicine
    + file templates/country-names.ohayo
    + data
    + doc.title Exploring Country Names
    + samples.populations
    + hidden
    + doc.subtitle How many countrys are there in this dataset?
    + show.rowCount Countries
    + text.firstLetter Country
    + hidden
    + group.by firstLetter
    + hidden
    + vega.bar How many country names begin with each letter (in English)?
    + show.rowCount Letters used
    + doc.subtitle No countries have a name starting with X.
    + doc.categories geography
    + file templates/country-populations.ohayo
    + data
    + doc.title Largest Countries by Population
    + samples.populations
    + rows.sortBy Population2016
    + vega.bar Population by Country
    + yColumn Population2016
    + colorColumn Continent
    + group.by Continent
    + reduce Population2016 sum Population2016
    + vega.bar Population by Region
    + yColumn Population2016
    + doc.categories geography
    + file templates/declaration-of-independence.ohayo
    + data
    + doc.title Declaration of Independence
    + doc.categories history
    + samples.declaration
    + hidden
    + html.printAs pre
    + text.wordCount
    + hidden
    + show.sum count Words
    + text.wordcloud
    + file templates/discovery-of-elements.ohayo
    + data
    + doc.title Discovery of the Elements
    + doc.subtitle What is the growth in known elements over time?
    + samples.periodicTable
    + fill.missing Year 1000
    + columns.keep Element Year
    + rows.sortBy Year
    + tables.basic
    + rowDisplayLimit 200
    + group.by Year
    + rows.sortBy Year
    + rows.runningTotal count
    + vega.bar Number of Elements Found Each Year
    + xColumn Year
    + yColumn count
    + vega.line Cumulative Number of Elements
    + xColumn Year
    + yColumn total
    + vega.scatter Year of Discovery by Atomic Number
    + xColumn Year
    + yColumn AtomicNumber
    + doc.categories chemistry
    + file templates/elements-by-phase.ohayo
    + data
    + doc.title Elements by Phase
    + samples.periodicTable
    + hidden
    + group.by Phase
    + hidden
    + roughjs.pie At Room Temperature Most Elements are Solids
    + label Phase
    + value count
    + columns.keep Element Phase
    + filter.where Phase = solid
    + tables.basic
    + doc.categories chemistry
    + file templates/git-repo-dashboard.ohayo
    + data
    + doc.title Desktop Only: Statistics for Local Git Repo
    + web.get http://localhost:2222/shell?command=gitlog
    + date.addColumns
    + group.by day
    + calendar.heat
    + count count
    + show.median count Median Commits Per Coding Day
    + show.rowCount # Coding Days
    + group.by month
    + vega.line Monthly Commit Trends
    + xColumn month
    + yColumn count
    + vega.bar Days worked by month
    + xColumn month
    + yColumn count
    + show.rowCount Total Commits
    + show.max time Most Recent Commit
    + show.min time First Commit
    + doc.categories programming
    + file templates/github-comparison.ohayo
    + data
    + doc.title GitHub Comparison
    + doc.subtitle A comparison of Ohayo with RStudio and Jupyter Notebook.
    + github.info rstudio/rstudio jupyter/notebook treenotation/ohayo
    + hidden
    + vega.bar Stars Comparison
    + yColumn stargazers_count
    + vega.scatter Stars by Year Created
    + xColumn created_at
    + yColumn stargazers_count
    + doc.categories programming
    + file templates/github-project-stats.ohayo
    + data
    + doc.title GitHub Project Stats
    + github.info treenotation/ohayo
    + hidden
    + show.value full_name Name
    + show.value description Description
    + show.value created_at Created
    + show.value pushed_at Last Updated
    + show.value stargazers_count Stars
    + doc.categories programming
    + file templates/humanPopulation.ohayo
    + data
    + doc.title Human Population
    + doc.subtitle A chart of human population growth.
    + doc.categories history
    + gen.range when -1000 2020 1
    + gen.growth populationInMillions 4 0.0025
    + vega.line Estimated Human Popuation
    + yColumn populationInMillions
    + xColumn when
    + file templates/life-expectancy.ohayo
    + data
    + doc.title Life Expectancy in the U.S.
    + doc.categories medicine
    + owid.lifeExpectancy
    + hidden
    + filter.where Code = USA
    + hidden
    + vega.line Life Expectancy in the USA
    + xColumn Year
    + yColumn Lifeexpectancy(years)
    + file templates/loc-with-bars.ohayo
    + data
    + doc.title Desktop Only: Analyze lines of code in a folder
    + web.get /disk?path=/ohayo/studio&lineStats=true&recursive=true
    + filter.without .DS_Store min.js node_modules ignore package-lock.json
    + show.sum lines Total LoC
    + columns.keep name extension lines words bytes wordsPerLine
    + rows.sortByReverse lines
    + tables.basic
    + group.by extension
    + reduce words sum words
    + reduce bytes sum bytes
    + reduce lines sum lines
    + vega.bar Lines of Code
    + yColumn lines
    + vega.bar Words
    + yColumn words
    + tables.basic
    + doc.categories programming
    + file templates/logs.ohayo
    + data
    + doc.title Exponents
    + math.gen exp 0 1 .01
    + vega.line 2.718^x from 0 to 1
    + xColumn input
    + yColumn output
    + math.gen exp 1 10 .1
    + vega.line 2.718^x from 1 to 10
    + xColumn input
    + yColumn output
    + math.gen exp 10 20 .1
    + vega.line 2.718^x from 10 to 20
    + xColumn input
    + yColumn output
    + doc.categories math
    + file templates/most-popular-websites.ohayo
    + data
    + doc.title 500 Most Popular Websites
    + doc.categories web
    + moz.top500
    + hidden
    + columns.setType LinkingRootDomains numberString
    + hidden
    + tables.basic
    + vega.bar Number of Inbound Links
    + xColumn Rank
    + yColumn LinkingRootDomains
    + file templates/ohayo-grammar-analysis.ohayo
    + data
    + doc.title Ohayo Grammar Analysis
    + doc.categories ohayo
    + debug.ohayoGrammar
    + hidden
    + text.lineCount
    + hidden
    + show.max lines Ohayo Grammar Lines of Code
    + text.wordCount
    + hidden
    + show.sum count Ohayo Total Grammar Words
    + show.rowCount Ohayo Unique Words
    + text.wordcloud
    + text.wordCount
    + hidden
    + rows.sortByReverse count
    + hidden
    + rows.first 10
    + hidden
    + tables.basic
    + file templates/ohayo-product-stats.ohayo
    + data
    + doc.title Ohayo Product Stats
    + doc.categories ohayo
    + templates.list
    + hidden
    + show.rowCount Number of Templates
    + debug.ohayoGrammar
    + hidden
    + text.matches string dataDomain
    + hidden
    + show.max count Number of Integrated Web Data Sources
    + challenge.list
    + hidden
    + show.rowCount Number of Challenges
    + debug.ohayoGrammarTree
    + hidden
    + text.lineCount
    + hidden
    + show.max lines Number of Ohayo Nodes
    + doc.comment show.static 2 Number of 0 Included Datasets
    + doc.comment show.static 2 Number of Datasets on ohayodatasets.breckyunits.com
    + debug.ohayoGrammar
    + hidden
    + text.lineCount
    + hidden
    + show.max lines Ohayo Grammar Lines of Code
    + text.wordCount
    + hidden
    + show.sum count Ohayo Total Grammar Words
    + show.rowCount Ohayo Unique Words
    + doc.comment Todo: show.static 2 Ohayo Grammar Lines of Javascript Code
    + file templates/ohayo-readme.ohayo
    + data
    + doc.title Ohayo Readme & Release Notes
    + web.get readme.md
    + parser text
    + hidden
    + markdown.toHtml
    + web.get releasenotes.md
    + parser text
    + hidden
    + markdown.toHtml
    + web.get ohayo/readme.md
    + parser text
    + hidden
    + markdown.toHtml
    + doc.categories ohayo
    + file templates/ohayo-reference.ohayo
    + data
    + doc.title Ohayo Reference
    + doc.author Breck Yunits
    + doc.date 12/05/2019
    + doc.categories ohayo
    +
    + doc.subtitle Ohayo is a language for data powered documents.
    +
    + doc.section
    + subtitle Overview
    + paragraph Ohayo is a combination of a Markdown-like language coupled with a collaboratively designed dataflow language for doing data science right in the browser.
    +
    +
    + doc.section
    + subtitle Sections
    + paragraph You can put whole sections into 1 tile.
    + paragraph Sections can have multiple paragraphs.
    + code python
    + # they can have code blocks too
    +
    + doc.section
    + subtitle Mixing data with content
    + paragraph You can mix and match doc tiles with any other Ohayo tile.
    +
    + data.inline
    + parser ssv
    + content
    + team superbowls
    + Patriots 6
    + Bills 0
    + vega.bar Number of Superbowl Wins
    +
    +
    + doc.subtitle A List of All Tiles
    + debug.ohayoGrammarTree
    + hidden
    + treenotation.outline
    +
    + doc.section
    + subtitle Secondary Notation (aka Text Styling)
    + paragraph Words can be bolded[bold] or italicized[em] or monospacedono] or linked[link http://ohayo.breckyunits.com] or footnoted[ref someRefId].
    +
    + doc.section
    + subtitle Links
    + link http://ohayo.breckyunits.com A whole sentence can be linked
    +
    + doc.section
    + subtitle Categories
    + paragraph You might want to add some tags categorizing your document.
    + code ohayo
    + doc.categories programming
    +
    + doc.section
    + subtitle Blank lines
    + paragraph
    + Blank lines are fine.
    +
    + In paragraphs.
    +
    + doc.section
    + subtitle Code
    + code python
    + # You can create blocks of code for printing
    + # If you provide a supported language ID, secondary notation (highlighting) can be added.
    +
    + doc.ref someRefId
    + url https://en.wikipedia.org/wiki/Note_(typography)
    + file templates/our-world-in-data.ohayo
    + data
    + doc.title Our World in Data
    + doc.subtitle Exploration of datasets in https://ourworldindata.org/
    + owid.list
    + vega.scatter Row Counts by ID
    + xColumn id
    + yColumn rowCount
    + vega.scatter
    + xColumn rowCount
    + yColumn columnCount
    + columns.describe
    + hidden
    + tables.basic
    + doc.categories dataScience
    + file templates/pca-of-flowers.ohayo
    + data
    + doc.title PCA Demonstration
    + samples.iris
    + hidden
    + bitanath.pca
    + hidden
    + vega.scatter PCA of the Iris Dataset
    + xColumn pc1
    + yColumn pc2
    + colorColumn Species
    + doc.categories math
    + doc.subtitle This demonstration uses the PCA library from bitanath.
    + file templates/planets-on-wikipedia.ohayo
    + data
    + doc.title The Planets on Wikipedia
    + wikipedia.page Venus Mercury_(planet) Earth Mars Neptune Saturn Jupiter Uranus
    + hidden
    + tables.basic
    + columns.keep title extract
    + hidden
    + text.combine extract
    + hidden
    + text.wordCount
    + hidden
    + text.wordcloud
    + doc.categories wikipedia
    + file templates/population-of-the-continents.ohayo
    + data
    + doc.title Population of the Continents
    + samples.populations
    + hidden
    + group.by Continent
    + reduce Population2016 sum Population
    + hidden
    + roughjs.pie Population of the Continents
    + label Continent
    + value Population
    + roughjs.bar Population of the Continents
    + label Continent
    + value Population
    + doc.categories geography
    + file templates/portals.ohayo
    + data
    + doc.title Data Portals
    + samples.portals
    + hidden
    + rows.sortByReverse datasets
    + hidden
    + tables.basic
    + doc.categories dataScience
    + file templates/public-apis.ohayo
    + data
    + doc.title Public APIs
    + doc.subtitle An overview of the Public API project to build a list of free APIs for use in software and web development.
    + publicapis.entries
    + hidden
    + group.by Category
    + hidden
    + vega.bar API Categories
    + filter.where Auth =
    + hidden
    + filter.where Cors = no
    + hidden
    + tables.basic
    + tables.basic
    + doc.categories programming
    + file templates/random.ohayo
    + data
    + doc.title Random Numbers
    + random.int 1000 0 1000
    + hidden
    + vega.scatter 1000 Random numbers between 0 and 100
    + xColumn index
    + yColumn number
    + rows.first 100
    + hidden
    + vega.scatter 100 of those
    + xColumn index
    + yColumn number
    + doc.categories math
    + file templates/reddit.ohayo
    + data
    + doc.title Top Stories on Reddit
    + reddit.all
    + hidden
    + columns.keep title created_utc score subreddit url
    + hidden
    + rows.sortByReverse score
    + tables.basic
    + vega.scatter
    + yColumn score
    + xColumn created_utc
    + vega.bar Top Stories on Reddit Right Now
    + yColumn score
    + doc.categories socialMedia
    + file templates/subreddit.ohayo
    + data
    + doc.title Top stories in a subreddit
    + reddit.sub Astronomy
    + columns.keep title created_utc score subreddit url
    + vega.scatter
    + yColumn score
    + xColumn created_utc
    + list.links
    + doc.categories socialMedia
    + file templates/template-generation.ohayo
    + data
    + doc.title Template Maker
    + doc.categories dataScience
    + samples.presidents
    + text.template Message
    + content
    + Hello {name}!
    + What was {HomeState} like?
    + columns.keep Message
    + hidden
    + tables.basic
    + file templates/tlds.ohayo
    + data
    + doc.title Most Popular Top Level Domains
    + doc.categories web
    + doc.subtitle This script looks at the top 500 domain names. It then extracts the TLD and groups them. The conclusion is that .com is the most popular by about 10x.
    + moz.top500
    + hidden
    + text.reverseSplit RootDomain . tld
    + hidden
    + tables.basic
    + group.by tld
    + hidden
    + rows.sortByReverse count
    + hidden
    + tables.basic
    + vega.bar .com is the most popular TLD by nearly 10x.
    + file templates/trends-in-baby-names.ohayo
    + data
    + doc.title Trends in Baby Names
    + doc.comment Uncomment the below line, and delete the following line, to use the full dataset
    + doc.comment web.get https://raw.githubusercontent.com/hadley/data-baby-names/master/baby-names.csv
    + samples.babyNames
    + filter.where name = Aria
    + filter.where sex = girl
    + vega.line
    + xColumn year
    + yColumn percent
    + doc.categories parenting
    + file templates/trigonometry.ohayo
    + data
    + doc.title Trigonometric Functions
    + math.gen sin 0 10 .1
    + vega.line Sin Wave
    + xColumn input
    + yColumn output
    + math.gen cos 0 10 .1
    + vega.line Cos Wave
    + xColumn input
    + yColumn output
    + math.gen tan 0 10 .1
    + vega.line Tan Wave
    + xColumn input
    + yColumn output
    + doc.categories math
    + file templates/typescript-interface-generator.ohayo
    + data
    + doc.title TypeScript Interface Generator
    + data.inline
    + content
    + state,number
    + Hawaii,50
    + schema.toTypescript
    + hidden
    + html.printAs code
    + doc.categories programming
    + file templates/ucimlr-overview.ohayo
    + data
    + doc.title The Datasets in UCIMLR
    + ucimlr.datasets
    + show.rowCount Total Datasets
    + group.by Category
    + vega.bar
    + doc.comment Filter out missing data:
    + filter.where Year > 1910
    + group.by Year
    + columns.setType Year year
    + vega.bar
    + xColumn Year
    + yColumn count
    + doc.categories dataScience
    + file templates/word-cloud.ohayo
    + data
    + doc.title Word Cloud
    + data.inline
    + text.wordCount
    + text.wordcloud
    + rows.sortByReverse count
    + tables.basic
    + parser text
    + content
    + If you put some text here, you will make yourself a word cloud. The more text you add, the better it will be. So keep writing, writing, writing, and you will get something that looks good.
    + doc.categories writing
    + `
    + ;("use strict")
    + window.StudioDrums = `panel new createNewBlankProgramCommand ctrl+n New file
    + mounted new cloneTabCommand ctrl+shift+n Clone file
    + panel new createMiniMapCommand shift+m Browse files
    + panel new openCreateNewProgramFromUrlDialogCommand New from Url
    + mounted new createNewSourceCodeVisualizationProgramCommand Visualize Source Code
    + mounted file saveTabAndNotifyCommand command+s Save file
    + mounted file showTabMoveFilePromptCommand Move file
    + mounted file cellCheckProgramCommand shift+c Check file for Errors
    + mounted file showDeleteFileConfirmDialogCommand shift+backspace Delete file
    + panel file openDeleteAllTabsPromptCommand Delete all open files
    + mounted navigation closeMountedProgramCommand ctrl+w Close focused tab
    + panel navigation closeAllTabsCommand ctrl+shift+w Close all tabs
    + mounted navigation mountPreviousTabCommand shift+left Previous tab
    + mounted navigation mountNextTabCommand shift+right Next tab
    + panel navigation openFullDiskFilePathPromptCommand shift+o Open file from path
    + panel navigation openFolderPromptCommand Open folder
    + panel navigation changeWorkingFolderPromptCommand Change working folder
    + mounted selection selectAllTilesCommand command+a Select all tiles
    + mounted selection clearSelectionCommand Clear Selection
    + mounted selection selectNextTileCommand shift+down Select next tile
    + mounted selection selectPreviousTileCommand shift+up Select previous Tile
    + mounted selection deleteSelectionCommand backspace Delete Selection
    + mounted selection duplicateSelectionCommand command+d Duplicate Selection
    + panel window toggleThemeCommand shift+t Toggle Theme
    + panel window toggleGutterCommand shift+u Toggle Source Editor Gutter
    + panel window toggleFullScreenCommand shift+f Toggle Full Screen
    + panel window toggleMenuCommand command+shift+f Toggle Menu
    + panel window closeModalCommand escape Close any open modal
    + mounted window clearTabMessagesCommand command+\\ Clear tab messages
    + panel window toggleAutoSaveCommand Toggle autosave
    + mounted window fetchAndReloadFocusedTabCommand shift+r Re-download and refresh tab
    + mounted edit undoFocusedProgramCommand command+z Undo
    + mounted edit redoFocusedProgramCommand command+shift+z Redo
    + mounted edit insertAdjacentTileCommand shift+i Insert Tile
    + panel ohayo toggleHelpCommand ? Help
    + panel ohayo confirmAndResetAppStateCommand Reset Ohayo Studio
    + panel ohayo toggleTreeComponentFrameworkDebuggerCommand shift+d Toggle TCF Debugger`
    + class AbstractPath {
    + constructor(path) {
    + this._checkPath(path)
    + this._path = path
    + }
    + _checkPath() {}
    + toString() {
    + return this._path.toString()
    + }
    - class MenuTreeComponent extends AbstractTreeComponent {
    - createParser() {
    - return new jtree.TreeNode.Parser(undefined, {
    - logo: LogoTreeComponent,
    - tabs: TabsTreeComponent,
    - newButton: NewButtonTreeComponent
    - })
    - }
    -
    - toggleVisibility() {
    - this.setWord(1, this.isVisible() ? "hidden" : "visible")
    - }
    -
    - isVisible() {
    - return this.getWord(1) === "visible"
    - }
    -
    - toHakonCode() {
    - const theme = this.getTheme()
    - const display = this.isVisible() ? "flex" : "none"
    - return `.MenuTreeComponent
    - ${theme.disableTextSelect(1)}
    - font-size 14px
    - padding-left 5px
    - box-sizing border-box
    - overflow-x scroll
    - right 0
    - left 0
    - position relative
    - height 30px
    - z-index 92
    - white-space nowrap
    - background ${theme.menuBackground}
    - display ${display}
    - .LogoTreeComponent,.NewButtonTreeComponent
    - padding-right 5px
    - line-height 30px
    - display inline-block
    - color ${theme.menuTreeComponentColor}`
    - }
    + class FullFilePath extends AbstractPath {
    + _checkPath(fullPath) {
    + if (!fullPath.startsWith("/")) throw new Error(`File fullPath "${fullPath}" does not begin with /.`)
    + if (fullPath.endsWith("/")) throw new Error(`File fullPath "${fullPath}" cannot end with /.`)
    + if (fullPath.includes("//")) throw new Error(`File fullPath "${fullPath}" cannot include //`)
    + }
    - window.MenuTreeComponent
    - = MenuTreeComponent
    - ;
    -
    -
    -
    -
    -
    -
    -
    - class TileMenuTreeComponent extends AbstractContextMenuTreeComponent {
    - toHakonCode() {
    - const theme = this.getTheme()
    - return `.TileMenuTreeComponent
    - background ${theme.contextMenuBackground}
    - border 1px solid ${theme.lineColor}
    - font-size 12px
    - position absolute
    - padding 8px
    - z-index 991
    - min-width 300px
    - top 100%
    - right 0
    - .TileCommandsDropDown
    - a
    - display block
    - cursor pointer
    - .TableInspection
    - margin-top 5px
    - border 1px solid ${theme.lineColor}
    - td
    - padding 2px 8px
    - text-align left
    - tr:nth-child(odd)
    - background-color ${theme.veryLightGrey}
    - svg
    - fill ${theme.greyish}
    - padding 1px 3px 3px 3px
    - &:hover
    - fill ${theme.foregroundColor}`
    - }
    -
    - getTargetTile() {
    - return this.getRootNode().getTargetTile()
    - }
    -
    - createProgramFromFocusedTileExampleCommand(uno, dos) {
    - return this.getTargetTile().createProgramFromTileExampleCommand(uno, dos)
    - }
    -
    - cloneFocusedTileCommand(uno, dos) {
    - return this.getTargetTile().cloneTileCommand(uno, dos)
    - }
    - destroyFocusedTileCommand(uno, dos) {
    - return this.getTargetTile().removeTileCommand(uno, dos)
    - }
    - inspectFocusedTileCommand(uno, dos) {
    - return this.getTargetTile().inspectTileCommand(uno, dos)
    - }
    - changeFocusedTileTypeCommand(uno, dos) {
    - return this.getTargetTile().changeTileTypeCommand(uno, dos)
    - }
    - changeFocusedTileParentCommand(uno, dos) {
    - return this.getTargetTile().changeParentCommand(uno, dos)
    - }
    - changeFocusedTileContentAndRenderCommand(uno, dos) {
    - return this.getTargetTile().changeTileContentAndRenderCommand(uno, dos)
    - }
    -
    - toStumpCode() {
    - const tile = this.getTargetTile()
    - const suggestions = this._getSuggestionsStumpCode()
    - const exampleTile = tile.getExampleTemplate()
    - let exampleTileButton = ""
    - if (exampleTile) {
    - exampleTileButton = `span ${Icons("function", 20)}
    - title See an example program with '${tile.getFirstWord()}'
    - class createProgramFromFocusedTileExampleButton
    - clickCommand createProgramFromFocusedTileExampleCommand`
    - }
    -
    - const links = `a Reload
    - clickCommand fetchAndReloadFocusedTabCommand
    - a Copy tile with inputs
    - tabindex -1
    - clickCommand copyTargetTileCommand
    - a Copy data as tree
    - clickCommand copyTargetTileDataAsTreeCommand
    - a Copy data as javascript
    - clickCommand copyTargetTileDataAsJavascriptCommand
    - a Copy data as tsv
    - clickCommand copyTargetTileDataCommand
    - value \t
    - a Copy data as csv
    - clickCommand copyTargetTileDataCommand
    - value ,
    - a Export data to csv file
    - clickCommand exportTargetTileDataCommand
    - a Export data to tree file
    - clickCommand exportTargetTileDataCommand
    - value tree`
    -
    - return new jtree.TreeNode(`div
    - class TileMenuTreeComponent
    - span ${Icons("copy", 20)}
    - title Duplicate Tile
    - clickCommand cloneFocusedTileCommand
    - span ${Icons("trash", 20)}
    - title Delete Tile
    - clickCommand destroyFocusedTileCommand
    - span ${Icons("inspector", 20)}
    - title Debug Tile
    - clickCommand inspectFocusedTileCommand
    - {exampleTileButton}
    - div
    - class TileCommandsDropDown
    - {links}`).templateToString({ exampleTileButton, links })
    - }
    -
    - _getSuggestionsStumpCode() {
    - //return `div Add Suggested:`
    - return "" //todo:
    - }
    + class FolderPath extends AbstractPath {
    + _checkPath(folderPath) {
    + if (folderPath.includes("//")) throw new Error(`File folderPath "${folderPath}" cannot include //`)
    + if (!folderPath.startsWith("/") || !folderPath.endsWith("/")) throw new Error(`Bad folder: '${folderPath}'. Folder must start and end with /.`)
    + }
    - window.TileMenuTreeComponent = TileMenuTreeComponent
    - ;
    -
    - const Version = "20.1.0"
    - if (typeof exports !== "undefined") module.exports = Version
    - ;
    -
    -
    -
    -
    -
    - class WallTreeComponent extends AbstractTreeComponent {
    - // pin?
    - // duplicate?
    - // reload?
    - toHakonCode() {
    - const theme = this.getTheme()
    - const gutterWidth = this._gutterWidth
    - return `.WallTreeComponent
    - background-color ${theme.wallBackground}
    - background-image ${theme.wallBackgroundImage || "none"}
    - width calc(100% - ${gutterWidth}px)
    - left ${gutterWidth}px
    - display block
    - position relative
    - height 100%
    - overflow scroll
    - .insertChildTileButton
    - text-align center
    - font-size 28px
    - font-weight bold
    - opacity .9
    - width 50px
    - margin auto
    - &:hover
    - opacity 1
    - cursor pointer
    -
    - .${OhayoConstants.selectedClass}
    - outline 3px solid ${theme.selectedOutline}`
    - }
    -
    - get _gutterWidth() {
    - const value = this.getWord(1)
    - return value === undefined ? this.getParent().getGutterWidth() : value
    - }
    -
    - setGutterWidth(newWidth) {
    - this.setWord(1, newWidth)
    - return this
    - }
    -
    - _getChildTreeComponents() {
    - const tilesProgram = this.getRootNode().getMountedTilesProgram()
    - return tilesProgram ? tilesProgram.getTiles() : []
    - }
    + class AbstractPathWithApp {
    + constructor(path, app) {
    + this._checkPath(path, app)
    + this._path = path
    + this._app = app
    + }
    - treeComponentDidMount() {
    - this.treeComponentDidUpdate()
    - }
    + getDiskId() {
    + return this._path.slice(0).split("/")[0]
    + }
    - toStumpCode() {
    - return `div
    - class WallTreeComponent
    - div +
    - class insertChildTileButton
    - clickCommand insertChildPickerTileCommand`
    - }
    + getFilePath() {
    + return this._path.replace(/^[^\/]+\//, "/")
    + }
    - _getSelectedTileStumpNodes() {
    - return this.getRootNode()
    - .getWillowBrowser()
    - .getBodyStumpNode()
    - .findStumpNodesWithClass(OhayoConstants.selectedClass) // todo: also filter by .abstractTileTreeComponentNode?
    - }
    + toString() {
    + return this._path.toString()
    + }
    - window.WallTreeComponent = WallTreeComponent
    - ;
    -
    -
    -
    -
    -
    -
    -
    -
    - class PanelTreeComponent extends AbstractTreeComponent {
    - createParser() {
    - return new jtree.TreeNode.Parser(undefined, {
    - gutter: GutterTreeComponent,
    - wall: WallTreeComponent
    - })
    - }
    -
    - getGutter() {
    - return this.getNode(StudioConstants.gutter)
    - }
    -
    - get _menuHeight() {
    - return this.getWord(2)
    - }
    -
    - setMenuHeight(value) {
    - this.setWord(2, value)
    - }
    -
    - toHakonCode() {
    - return `.PanelTreeComponent
    - position relative
    - left 0
    - right 0
    - bottom 0
    - height calc(100% - ${this._menuHeight}px)`
    - }
    -
    - getGutterWidth() {
    - return parseInt(this.getWord(1))
    - }
    + class FullFolderPath extends AbstractPathWithApp {
    + _checkPath(fullFolderPath, app) {
    + if (fullFolderPath.includes("//")) throw new Error(`File fullFolderPath "${fullFolderPath}" cannot include //`)
    + if (!fullFolderPath.endsWith("/")) throw new Error(`Bad fullFolderPath: '${fullFolderPath}'. Must end with /`)
    + if (fullFolderPath.startsWith("/")) throw new Error(`Bad fullFolderPath: '${fullFolderPath}'. Cannot start with /`)
    + if (!fullFolderPath.includes("/")) throw new Error(`Bad fullFolderPath: '${fullFolderPath}' must have a disk id and a folder path part. No / detected.`)
    + }
    - setGutterWidth(newWidth) {
    - this.setWord(1, newWidth)
    - this.getWall().setGutterWidth(newWidth)
    - this.getGutter().setGutterWidth(newWidth)
    - return this
    - }
    + async getFiles() {
    + return this._app.getDisks()[this.getDiskId()].readFiles(this.getFolderPath())
    + }
    - toggleGutterWidth() {
    - const newWidth = this.getGutterWidth() === 50 ? 400 : 50
    - this.setGutterWidth(newWidth)
    - return this
    - }
    + getFolderPath() {
    + return this.getFilePath()
    + }
    + }
    - toggleGutter() {
    - const newWidth = this.getGutterWidth() === 0 ? 400 : 0
    - this.setGutterWidth(newWidth)
    - return this
    - }
    + class FullDiskPath extends AbstractPathWithApp {
    + _checkPath(fullDiskFilePath, app) {
    + if (fullDiskFilePath.includes("//")) throw new Error(`File fullDiskFilePath "${fullDiskFilePath}" cannot include //`)
    + if (fullDiskFilePath.endsWith("/")) throw new Error(`Bad fullDiskFilePath: '${fullDiskFilePath}'. Cannot end with /`)
    + if (fullDiskFilePath.startsWith("/")) throw new Error(`Bad fullDiskFilePath: '${fullDiskFilePath}'. Cannot start with /`)
    + if (!fullDiskFilePath.includes("/")) throw new Error(`Bad fullDiskFilePath: '${fullDiskFilePath}' must have a disk id and a path part. No / detected.`)
    + }
    - getWall() {
    - return this.getNode(StudioConstants.wall)
    - }
    + getWithoutFilename() {
    + return this._path.replace(/\/[^\/]+$/, "/")
    + }
    - removeWall() {
    - const wall = this.getWall()
    - if (wall) wall.unmountAndDestroy()
    - }
    + getFilename() {
    + return this._path.split("/").pop()
    + }
    + }
    - // todo: remove?
    - addWall() {
    - this.removeWall()
    - return this.appendLine(StudioConstants.wall)
    - }
    + class FileHandle {
    + constructor(fullDiskFilePath, app) {
    + this._fullDiskFilePath = new FullDiskPath(fullDiskFilePath)
    + this._app = app
    + }
    +
    + _getDisk() {
    + return this._app.getDisks()[this._fullDiskFilePath.getDiskId()]
    + }
    +
    + unlinkFile() {
    + return this._getDisk().unlinkFile(this._fullDiskFilePath.getFilePath())
    + }
    +
    + readFile() {
    + return this._getDisk().readFile(this._fullDiskFilePath.getFilePath())
    + }
    +
    + writeFile(newVersion) {
    + return this._getDisk().writeFile(this._fullDiskFilePath.getFilePath(), newVersion)
    + }
    - window.PanelTreeComponent
    - = PanelTreeComponent
    - ;
    + window.FullFilePath = FullFilePath
    + window.FolderPath = FolderPath
    + window.FullFolderPath = FullFolderPath
    + window.FullDiskPath = FullDiskPath
    + window.FileHandle = FileHandle
    + class AbstractDisk {
    + constructor(rootTreeComponent) {
    + this._rootTreeComponent = rootTreeComponent
    + }
    + getPathBase() {
    + return this.getDisplayName() + this.getFolder()
    + }
    + getRootTreeComponent() {
    + return this._rootTreeComponent
    + }
    + getFolder() {
    + return this._folder || "/"
    + }
    + setFolder(folderPath) {
    + this._folder = new FolderPath(folderPath).toString()
    + return this
    + }
    + }
    + window.AbstractDisk = AbstractDisk
    + // todo: add a file type. program in PanelTreeComponent will be a child off
    + // File. then we can have diskFile, remoteFile, folderFile, templateFile, localstorageFile, et cetera.,
    + // each with it's own storage strategy. they can extend tree notation. they can implment fetch. they can
    + // handle readonly, et cetera. google docs file. dropbox file. derivative file (for example, from a png).
    + // then the bytes of the file get turned into a program. there are Tree Languages ohayo/fire caddoes and then there
    + // are non-treeLanguage files like pngs and JS, et cetera, that we can build ohayo in-memory templates for.
    + // folders and files =>
    + class AbstractFile extends jtree.TreeNode {
    + getFileLink() {
    + return this.getLine()
    + }
    + getFilename() {
    + return new FullDiskPath(this.getLine()).getFilename()
    + }
    + toFileObject() {
    + const str = this.childrenToString()
    + return {
    + filename: this.getFilename(),
    + link: this.getFileLink(),
    + size: str.length,
    + bytes: str,
    + }
    + }
    + }
    + window.AbstractFile = AbstractFile
    + class ServerStorageFile extends AbstractFile {}
    + // todo: use same constants file on serverside.
    + class ServerStorageDisk extends AbstractDisk {
    + _getWillow() {
    + return this.getRootTreeComponent().getWillowBrowser()
    + }
    +
    + async _httpPostUrl(method, options) {
    + const response = await this._getWillow().httpPostUrl("/serverStorage." + method, options)
    + return response.text
    + }
    +
    + getDisplayName() {
    + return this._getWillow().getHost()
    + }
    +
    + async readFiles(folder = this.getFolder()) {
    + // todo: speed tests/checks
    + const response = await this._getWillow().httpGetUrl("/serverStorage.list", { folder: folder })
    + return response.body.map((file) => new ServerStorageFile(file.data, this.getDisplayName() + folder + file.name))
    + }
    +
    + async getAvailablePermalink(permalink) {
    + const fullPath = this.getFolder() + permalink
    + const res = await this._httpPostUrl("getAvailablePermalink", { permalink: new FullFilePath(fullPath).toString() })
    + return res
    + }
    +
    + async unlinkFile(fullPath) {
    + const res = await this._httpPostUrl("delete", { fullPath: new FullFilePath(fullPath).toString() })
    + return res
    + }
    +
    + async writeFile(fullPath, newVersion) {
    + // todo: speed tests/checks
    + try {
    + const res = await this._httpPostUrl("write", { fullPath: new FullFilePath(fullPath).toString(), newVersion: newVersion })
    + return res
    + } catch (err) {
    + console.error(err)
    + throw new Error("Save failed!")
    + }
    + }
    +
    + async exists(fullPath) {
    + const res = await this._httpPostUrl("exists", { fullPath: new FullFilePath(fullPath).toString() })
    + return res.toString() === "true"
    + }
    +
    + async readFile(fullPath) {
    + // todo: speed tests/checks
    + const res = await this._httpPostUrl("read", { fullPath: new FullFilePath(fullPath).toString() })
    + return res
    + }
    + }
    +
    + window.ServerStorageDisk = ServerStorageDisk
    + const StorageKeys = {}
    + StorageKeys.autoSave = "__autoSave"
    + StorageKeys.appState = "__appState"
    + StorageKeys.visitCount = "__visitCount"
    + StorageKeys.workingFolderFullDiskFolderPath = "__workingFolderFullDiskFolderPath"
    + StorageKeys.isKey = (key) => {
    + if (!StorageKeys._storageKeysmap) {
    + StorageKeys._storageKeysmap = {}
    + Object.values(StorageKeys).forEach((value) => (StorageKeys._storageKeysmap[value] = true))
    + }
    + return StorageKeys._storageKeysmap[key]
    + }
    + window.StorageKeys = StorageKeys
    + class LocalStorageFile extends AbstractFile {}
    + class LocalStorageDisk extends AbstractDisk {
    + async readFiles() {
    + return this.readFilesSync()
    + }
    + readFilesSync() {
    + const app = this.getRootTreeComponent()
    + return app
    + .getStoreKeys()
    + .filter((key) => !StorageKeys.isKey(key))
    + .filter((key) => key.startsWith("/"))
    + .map((filename) => new LocalStorageFile(app.getFromStore(filename), this.getDisplayName() + filename))
    + }
    + getDisplayName() {
    + return "localStorage"
    + }
    + async unlinkFile(fullPath) {
    + this.getRootTreeComponent().removeValue(new FullFilePath(fullPath))
    + }
    + async getAvailablePermalink(permalink) {
    + const app = this.getRootTreeComponent()
    + return this.getFolder() + jtree.Utils.getAvailablePermalink(permalink, (fullPath) => app.getFromStore(this.getFolder() + fullPath) !== undefined)
    + }
    + async exists(fullPath) {
    + return this.getRootTreeComponent().getFromStore(new FullFilePath(fullPath)) !== undefined
    + }
    + async writeFile(fullPath, newVersion) {
    + this.getRootTreeComponent().storeValue(new FullFilePath(fullPath), newVersion)
    + }
    + async readFile(fullPath) {
    + return this.getRootTreeComponent().getFromStore(new FullFilePath(fullPath))
    + }
    + }
    + window.LocalStorageDisk = LocalStorageDisk
    + const DemoTemplates = `faq.ohayo
    + web.get ohayo/packages/samples/faq.md
    + parser text
    + hidden
    + markdown.toHtml
    + ohayo.ohayo
    + web.get ohayo/packages/samples/welcome.md
    + parser text
    + hidden
    + markdown.toHtml
    + templates.list
    + challenge.list`
    + window.DemoTemplates = DemoTemplates
    + // todo: title should be folder name?
    + const MiniTemplate = `editor.files
    + hidden
    + rows.sortBy link
    + hidden
    + editor.gallery`
    + window.MiniTemplate = MiniTemplate
    - class GlobalShortcutNode extends jtree.TreeNode {
    - getKeyCombo() {
    - return this.getWord(3)
    - }
    + const OhayoCodeEditorTemplate = (source, fileName, treeLanguage) =>
    + new jtree.TreeNode(`doc.title Source code visualization of {fileName}
    + data.inline
    + parser text
    + treeLanguage {treeLanguage}
    + text.lineCount
    + show.median lines Total lines
    + text.wordCount
    + show.sum count Total words
    + treenotation.3d
    + treenotation.outline
    + treenotation.wordTypes
    + html.printAs pre
    + text.wordCount
    + tables.basic
    + text.wordcloud
    + content
    + {source}`).templateToString({ source, fileName, treeLanguage })
    - getFn() {
    - return this.getWord(2)
    - }
    + window.OhayoCodeEditorTemplate = OhayoCodeEditorTemplate
    - getCategory() {
    - return this.getWord(1)
    - }
    + const OhayoTemplates = {}
    - getDescription() {
    - return this.getWordsFrom(4).join(" ")
    - }
    + OhayoTemplates._fromDelimited = (filename, data, app) => {
    + const key = app.initLocalDataStorage(filename, data)
    + return `data.localStorage ${key}
    + tables.basic`
    + }
    - isEnabled() {
    - return true
    - }
    + OhayoTemplates.tsv = OhayoTemplates._fromDelimited
    - execute(app) {
    - if (!this.isEnabled(app)) return false
    - const fn = this.getFn()
    - app.addToCommandLog(fn)
    - app[fn]()
    - }
    + OhayoTemplates.json = (filename, data, app) => {
    + const key = app.initLocalDataStorage(filename, data)
    + return `data.localStorage ${key}`
    - class MountedShortcutNode extends GlobalShortcutNode {
    - isEnabled(app) {
    - return !!app.getMountedTab()
    - }
    + OhayoTemplates.csv = (filename, data, app) => {
    + // todo: remove \r?
    + // check csv subtypes
    + const isMultiCsv = data.split("\n\n").length > 3
    + if (isMultiCsv) return OhayoTemplates._multiCsv(filename, data, app)
    + return OhayoTemplates._fromDelimited(filename, data, app)
    - class DrumsProgram extends jtree.TreeNode {
    - createParser() {
    - return new jtree.TreeNode.Parser(undefined, {
    - panel: GlobalShortcutNode,
    - mounted: MountedShortcutNode
    - })
    - }
    + OhayoTemplates._multiCsv = (filename, data, app) => {
    + return data
    + .split("\n\n")
    + .map((t) => t.trim())
    + .filter((t) => t)
    + .map((table) => {
    + const rows = table.split("\n")
    + const tableName = rows.shift()
    + const key = app.initLocalDataStorage(filename + "-" + tableName, rows.join("\n"))
    + return `data.localStorage ${key}
    + tables.basic ${tableName}`
    + })
    + .join("\n")
    - class StudioApp extends AbstractTreeComponent {
    - treeComponentWillMount() {
    - this._startVisitCounter()
    - const state = this.getFromStore(StorageKeys.appState)
    - if (state) this.setChildren(state)
    + window.OhayoTemplates = OhayoTemplates
    +
    + const SpeedTestTemplate = (title, rows) =>
    + `data.inline
    + content
    + ${rows.replace(/\n/g, "\n ")}
    + html.h1 ${title}
    + rows.sortBy timeToLoad
    + rows.reverse
    + doc.subtitle Slow Load Times
    + tables.basic
    + rows.sortBy timeToRender
    + rows.reverse
    + doc.subtitle Slow Render Times
    + tables.basic
    + show.mean timeToLoad
    + show.mean timeToRender
    + show.median timeToRender
    + show.sum timeToLoad
    + show.sum timeToRender
    + show.rowCount`
    - this._restoreTabs()
    + window.SpeedTestTemplate = SpeedTestTemplate
    - this._makeProgramLinksOpenImmediately()
    - this._makeDocumentCopyableAndCuttable()
    - this._bindKeyboardShortcuts()
    + const CodeMirrorCss = `.CodeMirror {
    + font-family: monospace;
    + height: 300px;
    + color: #000
    + }
    - const willowDoc = this.getWillowBrowser()
    + .CodeMirror-lines {
    + padding: 4px 0
    + }
    - willowDoc.setResizeEndHandler(event => this._onResizeEndEvent(event))
    - willowDoc.setPasteHandler(event => this._onPasteEvent(event))
    - willowDoc.setLoadedDroppedFileHandler(files => {
    - files.forEach(file => this.createProgramFromFileCommand(file.filename, file.data))
    - }, "Drop to create a new program.")
    + .CodeMirror pre {
    + padding: 0 4px
    + }
    - this._setErrorHandlers()
    - this.addStumpCodeMessageToLog(`div Ohayo!`)
    + .CodeMirror-scrollbar-filler,
    + .CodeMirror-gutter-filler {
    + background-color: #fff
    + }
    - const deepLink = this._getDeepLink()
    - if (deepLink) this.createAndOpenNewProgramFromDeepLinkCommand(deepLink)
    - else if (this._getVisitCount() === 1) this.playFirstVisitCommand()
    - }
    + .CodeMirror-gutters {
    + border-right: 0;
    + background-color: #f7f7f7;
    + white-space: nowrap
    + }
    - _getDeepLink() {
    - if (this.isNodeJs()) return false
    - return window.location.href.includes(StudioConstants.deepLinks.filename) ? window.location.href : ""
    - }
    + .CodeMirror-linenumber {
    + padding: 0 3px 0 5px;
    + min-width: 20px;
    + text-align: right;
    + color: #999;
    + white-space: nowrap
    + }
    - async _onPasteEvent(event) {
    - // Return true if worker is editing an input
    - if (this.terminalHasFocus() || this.getWillowBrowser().someInputHasFocus()) return true
    - if (event.clipboardData && event.clipboardData.getData) await this.pasteCommand(event.clipboardData.getData("text/plain"))
    - }
    + .CodeMirror-guttermarker {
    + color: #000
    + }
    - _onResizeEndEvent(event) {
    - delete this._bodyShadowDimensionsCache
    - this.renderApp()
    - }
    + .CodeMirror-guttermarker-subtle {
    + color: #999
    + }
    - _restoreTabs() {
    - this.getTabs().forEach(async tab => {
    - await tab._fetchTabInitProgramRenderAndRun(tab.isMountedTab())
    - this.renderApp()
    - })
    - }
    + .CodeMirror-cursor {
    + border-left: 1px solid #000;
    + border-right: none;
    + width: 0
    + }
    - _getProjectRootDir() {
    - return this.isNodeJs() ? jtree.Utils.findProjectRoot(__dirname, "ohayo") : ""
    - }
    + .CodeMirror div.CodeMirror-secondarycursor {
    + border-left: 1px solid silver
    + }
    - terminalHasFocus() {
    - const terminalNode = this.getTerminalNode()
    - return terminalNode && terminalNode.hasFocus()
    - }
    + .cm-fat-cursor .CodeMirror-cursor {
    + width: auto;
    + border: 0!important;
    + background: #7e7
    + }
    - getTerminalNode() {
    - return this.getPanel().getNode(`${StudioConstants.gutter} ${StudioConstants.terminal}`)
    - }
    + .cm-fat-cursor div.CodeMirror-cursors {
    + z-index: 1
    + }
    - getConsoleNode() {
    - return this.getPanel().getNode(`${StudioConstants.gutter} ${StudioConstants.console}`)
    - }
    + .cm-animate-fat-cursor {
    + width: auto;
    + border: 0;
    + -webkit-animation: blink 1.06s steps(1) infinite;
    + -moz-animation: blink 1.06s steps(1) infinite;
    + animation: blink 1.06s steps(1) infinite;
    + background-color: #7e7
    + }
    - initLocalDataStorage(key, value) {
    - key = jtree.Utils.stringToPermalink(key)
    - key = this.getUnusedStoreKey(key)
    - this.getRootNode().storeValue(key, value)
    - return key
    + @-moz-keyframes blink {
    + 50% {
    + background-color: transparent
    + }
    - getBodyShadowDimensions() {
    - if (!this._bodyShadowDimensionsCache) this._bodyShadowDimensionsCache = this._getBodyShadowDimensions()
    - return this._bodyShadowDimensionsCache
    + @-webkit-keyframes blink {
    + 50% {
    + background-color: transparent
    + }
    - _getBodyShadowDimensions() {
    - // depends on window.resize and whether gutter is open
    -
    - const bodyStumpNode = this.getWillowBrowser().getBodyStumpNode()
    - const bodyShadow = bodyStumpNode.getShadow()
    -
    - return {
    - width: bodyShadow.getShadowWidth(),
    - height: bodyShadow.getShadowHeight()
    - }
    + @keyframes blink {
    + 50% {
    + background-color: transparent
    + }
    - static getDefaultStartState() {
    - const defaultGutterWidth = 400
    - const menuHeight = 30
    - return `${StudioConstants.theme} ${ThemeTreeComponent.defaultTheme}
    - ${StudioConstants.menu} visible
    - logo
    - tabs
    - newButton
    - ${StudioConstants.panel} ${defaultGutterWidth} ${menuHeight}
    - ${StudioConstants.gutter} ${defaultGutterWidth}
    - ${StudioConstants.terminal}
    - ${StudioConstants.console}`
    - }
    + .cm-tab {
    + display: inline-block;
    + text-decoration: inherit
    + }
    - saveAppState() {
    - this.storeValue(StorageKeys.appState, this.toString())
    - }
    + .CodeMirror-rulers {
    + position: absolute;
    + left: 0;
    + right: 0;
    + top: -50px;
    + bottom: -20px;
    + overflow: hidden
    + }
    - resetAppState() {
    - this.removeValue(StorageKeys.appState)
    - return this
    - }
    + .CodeMirror-ruler {
    + border-left: 1px solid #ccc;
    + top: 0;
    + bottom: 0;
    + position: absolute
    + }
    - executeCommandLine(args) {
    - this.addToCommandLog(args.join(" "))
    - return this[args[0]].apply(this, args.slice(1))
    - }
    + .cm-s-default .cm-header {
    + color: blue
    + }
    - getOhayoGrammarAsTree() {
    - if (!this._ohayoGrammarTree) this._ohayoGrammarTree = new ohayoNode().getHandGrammarProgram()
    - return this._ohayoGrammarTree
    - }
    + .cm-s-default .cm-quote {
    + color: #090
    + }
    - getTargetTile() {
    - return this._targetTile
    - }
    + .cm-negative {
    + color: #d44
    + }
    - setTargetTile(tile) {
    - this._targetTile = tile
    - return this
    - }
    + .cm-positive {
    + color: #292
    + }
    - getVersion() {
    - return Version
    - }
    + .cm-header,
    + .cm-strong {
    + font-weight: 700
    + }
    - getDefinitionLoadingPromiseMap() {
    - if (!this._loadingPromiseMap) this._loadingPromiseMap = new Map()
    - return this._loadingPromiseMap
    - }
    + .cm-em {
    + font-style: italic
    + }
    - _startVisitCounter() {
    - let visitCount = this._getVisitCount()
    + .cm-link {
    + text-decoration: underline
    + }
    - visitCount++
    - this.setVisitCount(visitCount)
    - }
    + .cm-strikethrough {
    + text-decoration: line-through
    + }
    - setVisitCount(visitCount) {
    - // exposed for unit testing
    - this.storeValue(StorageKeys.visitCount, visitCount)
    - }
    + .cm-s-default .cm-keyword {
    + color: #708
    + }
    - _getVisitCount() {
    - const visitCountStr = this.getFromStore(StorageKeys.visitCount)
    - return visitCountStr ? parseInt(visitCountStr) : 0
    - }
    + .cm-s-default .cm-atom {
    + color: #219
    + }
    - createParser() {
    - const map = {}
    - map[StudioConstants.tabMenu] = TabMenuTreeComponent
    - map[StudioConstants.tileMenu] = TileMenuTreeComponent
    - map[StudioConstants.panel] = PanelTreeComponent
    - map[StudioConstants.menu] = MenuTreeComponent
    - map[StudioConstants.theme] = ThemeTreeComponent
    - map[StudioConstants.helpModal] = HelpModal
    - map["TreeComponentFrameworkDebuggerComponent"] = TreeComponentFrameworkDebuggerComponent
    + .cm-s-default .cm-number {
    + color: #164
    + }
    - return new jtree.TreeNode.Parser(jtree.TreeNode, map)
    - }
    + .cm-s-default .cm-def {
    + color: #00f
    + }
    - toHakonCode() {
    - const theme = this.getTheme()
    - return `.StudioApp
    - height 100%
    - width 100%
    - .OhayoError
    - color ${theme.errorColor}`
    - }
    + .cm-s-default .cm-variable-2 {
    + color: #05a
    + }
    - isConnectedToStudioServerApp() {
    - return typeof isConnectedToStudioServerApp !== "undefined"
    - }
    + .cm-s-default .cm-variable-3,
    + .cm-s-default .cm-type {
    + color: #085
    + }
    - isUrlGetProxyAvailable() {
    - return this.isConnectedToStudioServerApp()
    - }
    + .cm-s-default .cm-comment {
    + color: #a50
    + }
    - goRed(err) {
    - const tab = this.getMountedTab()
    - const message = err ? err.reason || err : ""
    - if (tab) tab.addStumpErrorMessageToLog(`Error: ${message}.`)
    - else this.addStumpErrorMessageToLog(`Error on tab: ${tab ? tab.getFullTabFilePath() : ""}: ${message}`)
    - this.renderApp()
    - }
    + .cm-s-default .cm-string {
    + color: #a11
    + }
    - _setErrorHandlers() {
    - const that = this
    - this.getWillowBrowser().setErrorHandler((message, file, line) => {
    - that.goRed(message)
    - console.error(message)
    - })
    - }
    + .cm-s-default .cm-string-2 {
    + color: #f50
    + }
    - closeModal() {
    - this.getOpenModals().forEach(node => node.unmountAndDestroy())
    - }
    + .cm-s-default .cm-meta {
    + color: #555
    + }
    - getOpenModals() {
    - return this.filter(node => node instanceof AbstractModalTreeComponent)
    - }
    + .cm-s-default .cm-qualifier {
    + color: #555
    + }
    - closeAllContextMenus() {
    - this.filter(node => node instanceof AbstractContextMenuTreeComponent).forEach(node => node.unmountAndDestroy())
    - }
    + .cm-s-default .cm-builtin {
    + color: #30a
    + }
    - // todo: delete this
    - makeAllDirty() {
    - this.getTopDownArray()
    - .filter(child => child instanceof AbstractTreeComponent)
    - .forEach(child => {
    - child._setLastRenderedTime(0)
    - })
    - }
    + .cm-s-default .cm-bracket {
    + color: #997
    + }
    - renderApp() {
    - const report = this.renderAndGetRenderReport(this.getWillowBrowser().getBodyStumpNode())
    - // console.log(report.toString())
    - // console.log(this.toString())
    - }
    + .cm-s-default .cm-tag {
    + color: #170
    + }
    - _appendTiles(line, children) {
    - return this.getNodeCursors().map(cursor => cursor.appendLineAndChildren(line, children))
    - }
    + .cm-s-default .cm-attribute {
    + color: #00c
    + }
    - getNodeCursors() {
    - const tilesProgram = this.getMountedTilesProgram()
    - const selectedNodes = tilesProgram.getSelectedNodes()
    - return selectedNodes.length ? selectedNodes : [tilesProgram]
    - }
    + .cm-s-default .cm-hr {
    + color: #999
    + }
    - async _openOhayoProgram(name) {
    - const disk = this.getDefaultDisk()
    - const fullPath = disk.getPathBase() + name
    - const openTab = this.getOpenTabByFullFilePath(fullPath)
    + .cm-s-default .cm-link {
    + color: #00c
    + }
    - if (openTab) {
    - this.setMountedTab(openTab)
    - this.getRootNode().renderApp()
    - return undefined
    - }
    + .cm-s-default .cm-error {
    + color: red
    + }
    - const fullDiskFilePath = new FullDiskPath(fullPath)
    + .cm-invalidchar {
    + color: red
    + }
    - const result = await disk.exists(fullDiskFilePath.getFilePath())
    - if (result) return this.openFullPathInNewTabAndFocus(fullPath)
    + .CodeMirror-composing {
    + border-bottom: 2px solid
    + }
    - return this._createAndOpen(new jtree.TreeNode(DemoTemplates).getNode(name).childrenToString(), name)
    - }
    + div.CodeMirror span.CodeMirror-matchingbracket {
    + color: #0f0
    + }
    - async createFileOnDefaultDisk(filename, sourceStr) {
    - const disk = this.getDefaultDisk()
    - const permalink = jtree.Utils.stringToPermalink(filename)
    - const newName = await disk.getAvailablePermalink(permalink)
    + div.CodeMirror span.CodeMirror-nonmatchingbracket {
    + color: #f22
    + }
    - await disk.writeFile(newName, sourceStr)
    - return disk.getDisplayName() + newName
    - }
    + .CodeMirror-matchingtag {
    + background: rgba(255, 150, 0, .3)
    + }
    - async _createAndOpen(sourceStr, filename, tabIndex) {
    - const newName = await this.createFileOnDefaultDisk(filename, sourceStr)
    - const res = await this.openFullPathInNewTabAndFocus(newName, tabIndex)
    - return res
    - }
    + .CodeMirror-activeline-background {
    + background: #e8f2ff
    + }
    - async _createAndOpenInBackgroundTab(sourceStr, filename) {
    - const newName = await this.createFileOnDefaultDisk(filename, sourceStr)
    - const tab = await this._openFullDiskFilePathInNewTab(newName)
    - return tab
    - }
    + .CodeMirror {
    + position: relative;
    + overflow: hidden;
    + background: #fff
    + }
    - setMountedTab(tab) {
    - const currentTab = this._getMountedTab()
    - if (currentTab === tab) return this
    - else if (currentTab) {
    - currentTab.markAsUnmounted()
    - this.getPanel().removeWall()
    - }
    - this._focusedTab = tab
    - tab.markAsMounted()
    - // update terminal and console
    - this._setTerminalAndConsole(tab.getFullTabFilePath())
    + .CodeMirror-scroll {
    + overflow: scroll!important;
    + margin-bottom: -30px;
    + margin-right: -30px;
    + padding-bottom: 30px;
    + height: 100%;
    + outline: none;
    + position: relative
    + }
    - this.getPanel().addWall()
    - this._updateLocationForRestoreOnRefresh()
    - return this
    - }
    + .CodeMirror-sizer {
    + position: relative;
    + border-right: 30px solid transparent
    + }
    - _setTerminalAndConsole(fileName) {
    - const terminal = this.getTerminalNode()
    - if (terminal) terminal.setFile(fileName)
    - const consoleNode = this.getConsoleNode()
    - if (consoleNode) consoleNode.setFile(fileName)
    - }
    + .CodeMirror-vscrollbar,
    + .CodeMirror-hscrollbar,
    + .CodeMirror-scrollbar-filler,
    + .CodeMirror-gutter-filler {
    + position: absolute;
    + z-index: 6;
    + display: none
    + }
    - closeTab(tab) {
    - // todo: terminal and console on last tab close.
    - if (tab.isMountedTab()) {
    - const tabToMountNext = jtree.Utils.getNextOrPrevious(this.getTabs(), tab)
    - this.getPanel().removeWall()
    - tab.markAsUnmounted()
    - tab.unmountAndDestroy()
    - delete this._focusedTab
    - if (tabToMountNext) this.setMountedTab(tabToMountNext)
    - } else tab.unmountAndDestroy()
    + .CodeMirror-vscrollbar {
    + right: 0;
    + top: 0;
    + overflow-x: hidden;
    + overflow-y: scroll
    + }
    - if (!this.getTabs().length) this._setTerminalAndConsole()
    + .CodeMirror-hscrollbar {
    + bottom: 0;
    + left: 0;
    + overflow-y: hidden;
    + overflow-x: scroll
    + }
    - this._updateLocationForRestoreOnRefresh()
    - }
    + .CodeMirror-scrollbar-filler {
    + right: 0;
    + bottom: 0
    + }
    - mountPreviousTab() {
    - const tabs = this.getTabs()
    - const mountedTab = this._getMountedTab()
    - if (tabs.length < 2 || !mountedTab) return this
    - const tabIndex = tabs.indexOf(mountedTab)
    - return this._mountTabByIndex(tabIndex === 0 ? tabs.length - 1 : tabIndex - 1)
    - }
    + .CodeMirror-gutter-filler {
    + left: 0;
    + bottom: 0
    + }
    - mountNextTab() {
    - const tabs = this.getTabs()
    - const mountedTab = this._getMountedTab()
    - if (tabs.length < 2 || !mountedTab) return this
    - const tabIndex = tabs.indexOf(mountedTab)
    - return this._mountTabByIndex(tabIndex === tabs.length - 1 ? 0 : tabIndex + 1)
    - }
    + .CodeMirror-gutters {
    + position: absolute;
    + left: 0;
    + top: 0;
    + min-height: 100%;
    + z-index: 3
    + }
    - getTabs() {
    - return this._getTabsNode().getOpenTabs()
    - }
    + .CodeMirror-gutter {
    + white-space: normal;
    + height: 100%;
    + display: inline-block;
    + vertical-align: top;
    + margin-bottom: -30px
    + }
    - _updateLocationForRestoreOnRefresh() {
    - this.saveAppState()
    - }
    + .CodeMirror-gutter-wrapper {
    + position: absolute;
    + z-index: 4;
    + background: none!important;
    + border: none!important
    + }
    - async getAlreadyOpenTabOrOpenFullFilePathInNewTab(filePath, andMount = false, tabIndex) {
    - const existingTab = this.getOpenTabByFullFilePath(new FullDiskPath(filePath).toString())
    - if (existingTab) {
    - if (andMount) {
    - this.setMountedTab(existingTab)
    - this.renderApp()
    - }
    - return existingTab
    - }
    + .CodeMirror-gutter-background {
    + position: absolute;
    + top: 0;
    + bottom: 0;
    + z-index: 4
    + }
    - const tab = this._getTabsNode().insertTab(new FullDiskPath(filePath).toString(), tabIndex)
    + .CodeMirror-gutter-elt {
    + position: absolute;
    + cursor: default;
    + z-index: 4
    + }
    - await tab._fetchTabInitProgramRenderAndRun(andMount)
    + .CodeMirror-gutter-wrapper ::selection {
    + background-color: transparent
    + }
    - this.renderApp()
    - return tab
    - }
    + .CodeMirror-gutter-wrapper ::-moz-selection {
    + background-color: transparent
    + }
    - getOpenTabByFullFilePath(fullPath) {
    - return this.getTabs().find(tab => tab.getFullTabFilePath() === fullPath)
    - }
    + .CodeMirror-lines {
    + cursor: text;
    + min-height: 1px
    + }
    - getPanel() {
    - return this.getNode(StudioConstants.panel)
    - }
    + .CodeMirror pre {
    + -moz-border-radius: 0;
    + -webkit-border-radius: 0;
    + border-radius: 0;
    + border-width: 0;
    + background: transparent;
    + font-family: inherit;
    + font-size: inherit;
    + margin: 0;
    + white-space: pre;
    + word-wrap: normal;
    + line-height: inherit;
    + color: inherit;
    + z-index: 2;
    + position: relative;
    + overflow: visible;
    + -webkit-tap-highlight-color: transparent;
    + -webkit-font-variant-ligatures: contextual;
    + font-variant-ligatures: contextual
    + }
    - getMountedTilesProgram() {
    - const mountedTab = this.getMountedTab()
    - return mountedTab && mountedTab.getTabProgram()
    - }
    + .CodeMirror-wrap pre {
    + word-wrap: break-word;
    + white-space: pre-wrap;
    + word-break: normal
    + }
    - getMenuTreeComponent() {
    - return this.getNode(StudioConstants.menu)
    - }
    + .CodeMirror-linebackground {
    + position: absolute;
    + left: 0;
    + right: 0;
    + top: 0;
    + bottom: 0;
    + z-index: 0
    + }
    - async _openFullDiskFilePathInNewTab(fullDiskFilePath) {
    - const res = await this.getAlreadyOpenTabOrOpenFullFilePathInNewTab(new FullDiskPath(fullDiskFilePath).toString())
    - return res
    - }
    + .CodeMirror-linewidget {
    + position: relative;
    + z-index: 2;
    + overflow: auto
    + }
    - async openFullPathInNewTabAndFocus(fullDiskFilePath, tabIndex) {
    - const tab = await this.getAlreadyOpenTabOrOpenFullFilePathInNewTab(new FullDiskPath(fullDiskFilePath).toString(), true, tabIndex)
    - return tab
    - }
    + .CodeMirror-rtl pre {
    + direction: rtl
    + }
    - isAutoSaveEnabled() {
    - return this.getFromStore(StorageKeys.autoSave) !== "false"
    - }
    + .CodeMirror-code {
    + outline: none
    + }
    - getThemeName() {
    - return this.get(StudioConstants.theme)
    - }
    + .CodeMirror-scroll,
    + .CodeMirror-sizer,
    + .CodeMirror-gutter,
    + .CodeMirror-gutters,
    + .CodeMirror-linenumber {
    + -moz-box-sizing: content-box;
    + box-sizing: content-box
    + }
    - isGlassTheme() {
    - const name = this.getThemeName()
    - return name === ThemeTreeComponent.ThemeConstants.glass || name === ThemeTreeComponent.ThemeConstants.clearGlass
    - }
    + .CodeMirror-measure {
    + position: absolute;
    + width: 100%;
    + height: 0;
    + overflow: hidden;
    + visibility: hidden
    + }
    - getTheme() {
    - return ThemeTreeComponent.Themes[this.getThemeName()] || ThemeTreeComponent.Themes.glass
    - }
    + .CodeMirror-cursor {
    + position: absolute;
    + pointer-events: none
    + }
    - _toggleTheme() {
    - const newThemeName = jtree.Utils.toggle(this.getThemeName(), Object.keys(ThemeTreeComponent.Themes))
    - this.addStumpCodeMessageToLog(`div Switched to ${newThemeName} theme`)
    - this.set(StudioConstants.theme, newThemeName)
    - this.saveAppState()
    - this.makeAllDirty() // todo:remove
    - this.renderApp()
    - }
    + .CodeMirror-measure pre {
    + position: static
    + }
    - async promptToMoveFile(existingFullDiskFilePath, suggestedNewFilename, isRenameOp = false) {
    - const path = new FullDiskPath(existingFullDiskFilePath)
    - const suggestedFullDiskFilePath = suggestedNewFilename ? path.getWithoutFilename() + suggestedNewFilename : existingFullDiskFilePath
    + div.CodeMirror-cursors {
    + visibility: hidden;
    + position: relative;
    + z-index: 3
    + }
    - let newFullDiskFilePath
    + div.CodeMirror-dragcursors {
    + visibility: visible
    + }
    - if (isRenameOp) {
    - const newNameOnly = await this.getWillowBrowser().promptThen("Enter new name for file", suggestedNewFilename || path.getFilename())
    - newFullDiskFilePath = newNameOnly ? path.getWithoutFilename() + newNameOnly : newNameOnly
    - } else newFullDiskFilePath = await this.getWillowBrowser().promptThen("Enter new name for file", suggestedFullDiskFilePath || existingFullDiskFilePath)
    + .CodeMirror-focused div.CodeMirror-cursors {
    + visibility: visible
    + }
    - if (!newFullDiskFilePath || newFullDiskFilePath === existingFullDiskFilePath) return undefined
    + .CodeMirror-selected {
    + background: #d9d9d9
    + }
    - newFullDiskFilePath = new FullDiskPath(newFullDiskFilePath)
    + .CodeMirror-focused .CodeMirror-selected {
    + background: #d7d4f0
    + }
    - newFullDiskFilePath = newFullDiskFilePath.getWithoutFilename() + jtree.Utils.stringToPermalink(newFullDiskFilePath.getFilename())
    - if (!newFullDiskFilePath) return undefined
    - const resultingName = await this.moveFileCommand(existingFullDiskFilePath, newFullDiskFilePath)
    + .CodeMirror-crosshair {
    + cursor: crosshair
    + }
    - this.addStumpCodeMessageToLog(`div Moved`)
    - return resultingName
    - }
    + .CodeMirror-line::selection,
    + .CodeMirror-line>span::selection,
    + .CodeMirror-line>span>span::selection {
    + background: #d7d4f0
    + }
    - getKeyboardShortcuts() {
    - if (!this._shortcuts)
    - this._shortcuts = new DrumsProgram(
    - typeof StudioDrums === "undefined" ? jtree.TreeNode.fromDisk(this._getProjectRootDir() + "studio/treeComponents/Studio.drums") : new jtree.TreeNode(StudioDrums)
    - )
    - return this._shortcuts
    - }
    + .CodeMirror-line::-moz-selection,
    + .CodeMirror-line>span::-moz-selection,
    + .CodeMirror-line>span>span::-moz-selection {
    + background: #d7d4f0
    + }
    - _getMousetrap() {
    - return this.getWillowBrowser().getMousetrap()
    - }
    + .cm-searching {
    + background: #ffa;
    + background: rgba(255, 255, 0, .4)
    + }
    - _bindKeyboardShortcuts() {
    - const mouseTrap = this._getMousetrap()
    - const willowBrowser = this.getWillowBrowser()
    + .cm-force-border {
    + padding-right: .1px
    + }
    - mouseTrap._originalStopCallback = mouseTrap.prototype.stopCallback
    - mouseTrap.prototype.stopCallback = function(evt, element, shortcut) {
    - const stumpNode = willowBrowser.getStumpNodeFromElement(element)
    - if (stumpNode && shortcut === "command+s" && stumpNode.stumpNodeHasClass("savable")) {
    - stumpNode.getShadow().triggerShadowEvent("change")
    - evt.preventDefault()
    - return true
    - }
    - if (mouseTrap._pause) return true
    - return mouseTrap._originalStopCallback.call(this, evt, element)
    - }
    + @media print {
    + .CodeMirror div.CodeMirror-cursors {
    + visibility: hidden
    + }
    + }
    - const app = this
    + .cm-tab-wrap-hack:after {
    + content: ''
    + }
    - this.getKeyboardShortcuts().forEach(shortcut => {
    - const keyCombo = shortcut.getKeyCombo()
    - if (!keyCombo) return true
    - mouseTrap.bind(keyCombo, function(evt) {
    - shortcut.execute(app)
    - // todo: handle the below when we need to
    - if (evt.preventDefault) evt.preventDefault()
    - return false
    - })
    - })
    - }
    + span.CodeMirror-selectedtext {
    + background: none
    + }
    - pauseShortcutListener() {
    - this._getMousetrap()._pause = true
    - }
    + .CodeMirror-hints {
    + position: absolute;
    + z-index: 10;
    + overflow: hidden;
    + list-style: none;
    + margin: 0;
    + padding: 2px;
    + -webkit-box-shadow: 2px 3px 5px rgba(0, 0, 0, .2);
    + -moz-box-shadow: 2px 3px 5px rgba(0, 0, 0, .2);
    + box-shadow: 2px 3px 5px rgba(0, 0, 0, .2);
    + border-radius: 3px;
    + border: 1px solid silver;
    + background: #fff;
    + font-size: 90%;
    + font-family: monospace;
    + max-height: 20em;
    + overflow-y: auto
    + }
    - resumeShortcutListener() {
    - this._getMousetrap()._pause = false
    - }
    + .CodeMirror-hint {
    + margin: 0;
    + padding: 0 4px;
    + border-radius: 2px;
    + white-space: pre;
    + color: #000;
    + cursor: pointer
    + }
    - getStore() {
    - return this.getWillowBrowser().getStore()
    - }
    + li.CodeMirror-hint-active {
    + background: #08f;
    + color: #fff
    + }
    - getUnusedStoreKey(key) {
    - return jtree.Utils.getAvailablePermalink(key, key => this.getFromStore(key) !== undefined)
    - }
    + .CodeMirror { background: transparent;}
    - getStoreKeys() {
    - const prefix = this.constructor.name
    - const prefixLength = prefix.length
    - const keys = []
    - this.getStore().each((value, key) => {
    - if (key.startsWith(prefix)) keys.push(key.substr(prefixLength))
    - })
    - return keys
    - }
    + .cm-s-oceanic-next.CodeMirror { background: #304148; color: #f8f8f2; }
    - dumpStore() {
    - this.getStore().each((value, key) => {
    - console.log(key)
    - })
    - return this
    - }
    + .cm-s-oceanic-next div.CodeMirror-selected { background: rgba(101, 115, 126, 0.33); }
    + .cm-s-oceanic-next .CodeMirror-line::selection, .cm-s-oceanic-next .CodeMirror-line > span::selection, .cm-s-oceanic-next .CodeMirror-line > span > span::selection { background: rgba(101, 115, 126, 0.33); }
    + .cm-s-oceanic-next .CodeMirror-line::-moz-selection, .cm-s-oceanic-next .CodeMirror-line > span::-moz-selection, .cm-s-oceanic-next .CodeMirror-line > span > span::-moz-selection { background: rgba(101, 115, 126, 0.33); }
    + .cm-s-oceanic-next .CodeMirror-gutters { background: #304148; border-right: 10px; }
    + .cm-s-oceanic-next .CodeMirror-guttermarker { color: white; }
    + .cm-s-oceanic-next .CodeMirror-guttermarker-subtle { color: #d0d0d0; }
    + .cm-s-oceanic-next .CodeMirror-linenumber { color: #d0d0d0; }
    + .cm-s-oceanic-next .CodeMirror-cursor { border-left: 1px solid #f8f8f0; }
    - getStoreDiskUsage() {
    - // todo: is there a way to do this?
    - let bytes = 0
    - this.getStore().each((value, key) => {
    - bytes += value.toString().length + key.toString().length
    - })
    - return bytes / 5000000
    - }
    + .cm-s-oceanic-next span.cm-comment { color: #65737E; }
    + .cm-s-oceanic-next span.cm-atom { color: #C594C5; }
    + .cm-s-oceanic-next span.cm-number { color: #F99157; }
    - getFromStore(key) {
    - return this.getStore().get(this.constructor.name + key.toString())
    - }
    + .cm-s-oceanic-next span.cm-property { color: #99C794; }
    + .cm-s-oceanic-next span.cm-attribute,
    + .cm-s-oceanic-next span.cm-keyword { color: #C594C5; }
    + .cm-s-oceanic-next span.cm-builtin { color: #66d9ef; }
    + .cm-s-oceanic-next span.cm-string { color: #99C794; }
    - storeValue(key, value) {
    - // todo: handle quotaexceeded
    - return this.getStore().set(this.constructor.name + key.toString(), value)
    - }
    + .cm-s-oceanic-next span.cm-variable,
    + .cm-s-oceanic-next span.cm-variable-2,
    + .cm-s-oceanic-next span.cm-variable-3 { color: #f8f8f2; }
    + .cm-s-oceanic-next span.cm-def { color: #6699CC; }
    + .cm-s-oceanic-next span.cm-bracket { color: #5FB3B3; }
    + .cm-s-oceanic-next span.cm-tag { color: #C594C5; }
    + .cm-s-oceanic-next span.cm-header { color: #C594C5; }
    + .cm-s-oceanic-next span.cm-link { color: #C594C5; }
    + .cm-s-oceanic-next span.cm-error { background: #C594C5; color: #f8f8f0; }
    - removeValue(key) {
    - return this.getStore().remove(this.constructor.name + key.toString())
    - }
    + .cm-s-oceanic-next .CodeMirror-activeline-background { background: rgba(101, 115, 126, 0.33); }
    + .cm-s-oceanic-next .CodeMirror-matchingbracket {
    + text-decoration: underline;
    + color: white !important;
    + }
    - _makeDocumentCopyableAndCuttable() {
    - const app = this
    - this.getWillowBrowser()
    - .setCopyHandler(evt => app.copySelectionCommand(evt))
    - .setCutHandler(evt => app.cutSelectionCommand(evt))
    - }
    + .cm-s-oceanic-next.CodeMirror {background: transparent;}
    + `.replace(/\n/g, "")
    - _handleLinkClick(stumpNode, evt) {
    - if (!stumpNode) return undefined
    - const link = stumpNode.getStumpNodeAttr("href")
    - if (!link || stumpNode.getStumpNodeAttr("target")) return undefined
    - evt.preventDefault()
    - if (this.getWillowBrowser().isExternalLink(link)) {
    - this.openExternalLink(link)
    - return false
    - }
    - }
    + window.CodeMirrorCss = CodeMirrorCss
    - openExternalLink(link) {
    - this.getWillowBrowser().openUrl(link)
    - }
    + const SVGS = {}
    - getAppWall() {
    - return this.getPanel().getWall()
    - }
    + SVGS[
    + "nw"
    + ] = ` `
    + SVGS[
    + "lt-eq"
    + ] = ` `
    + SVGS[
    + "lt"
    + ] = ` `
    + SVGS[
    + "pencil"
    + ] = ``
    + SVGS[
    + "fork"
    + ] = ` `
    + SVGS[
    + "call"
    + ] = ` `
    + SVGS[
    + "hashtag"
    + ] = ` `
    + SVGS[
    + "minus"
    + ] = ``
    + SVGS[
    + "font-1"
    + ] = ` `
    + SVGS[
    + "check"
    + ] = ` `
    + SVGS[
    + "copy"
    + ] = ` `
    + SVGS[
    + "coding"
    + ] = ` `
    + SVGS[
    + "inspector"
    + ] = ` `
    + SVGS[
    + "trash"
    + ] = ` `
    + SVGS[
    + "multiply"
    + ] = ``
    + SVGS[
    + "divide"
    + ] = ` `
    + SVGS[
    + "add"
    + ] = ``
    + SVGS[
    + "printer"
    + ] = ` `
    + SVGS[
    + "function"
    + ] = ` `
    + SVGS[
    + "export"
    + ] = ` `
    + SVGS[
    + "import"
    + ] = ` `
    + SVGS[
    + "folder"
    + ] = ``
    + SVGS[
    + "score"
    + ] = ` `
    + SVGS[
    + "tree"
    + ] = ` `
    + SVGS[
    + "www"
    + ] = ` `
    + SVGS[
    + "font"
    + ] = ` `
    + SVGS[
    + "text"
    + ] = ` `
    + SVGS[
    + "table"
    + ] = ` `
    + SVGS[
    + "filter"
    + ] = ``
    + SVGS[
    + "reddit"
    + ] = ` `
    + SVGS[
    + "whitehouse"
    + ] = ` `
    +
    + window.SVGS = SVGS
    - // for tests
    - getRenderedTilesDiagnostic() {
    - return this.getMountedTilesProgram()
    - .getTiles()
    - .filter(tile => tile.isVisible() && tile.isMounted())
    - }
    + function Icons(name, size) {
    + const rawSvg = SVGS[name]
    + const svg = rawSvg.substr(4)
    + const prefix = `
    + return prefix + svg
    + }
    - // for tests
    - getMountedTilesDiagnostic() {
    - return jtree.Utils.flatten(
    - this._getTabsNode()
    - .getOpenTabs()
    - .map(tab =>
    - tab
    - .getTabProgram()
    - .getTiles()
    - .filter(tile => tile.isMounted())
    - )
    - )
    - }
    + window.Icons = Icons
    - async _createProgramFromPaste(pastedText) {
    - await this._createAndOpen(pastedText, `untitled${StudioConstants.ohayoExtension}`) // todo: guess language!
    - }
    + const ThemeConstants = {}
    + ThemeConstants.dark = "dark"
    + ThemeConstants.workshop = "workshop"
    + ThemeConstants.white = "white"
    + ThemeConstants.glass = "glass"
    + ThemeConstants.clearGlass = "clearGlass"
    - // for tests and debugging
    - // todo: only relevant for OhayoTiles with tables
    - dumpTablesDiagnostic() {
    - return this.getRenderedTilesDiagnostic().forEach(tile => {
    - console.log(tile.getLine())
    - console.log(tile.getOutputOrInputTable())
    - })
    - }
    + class Theme {
    + constructor(options = {}) {
    + const { backgroundColor = "rgb(255,255,255)", foregroundColor = "black", fn = "lighten", selectionColor = "rgb(42, 89, 178)" } = options
    +
    + let grayStartColor = options.grayStartColor || foregroundColor
    + this.backgroundColor = backgroundColor
    + this.solidBackgroundColorOrTransparent = options.hasSolidBackground ? backgroundColor : "transparent"
    + this.menuBackground = backgroundColor
    + this.tabBackground = "transparent"
    + this.programsBackground = backgroundColor
    + this.bodyBackground = backgroundColor
    + this.wallBackground = backgroundColor
    + this.contextMenuBackground = backgroundColor
    + this.tileBackgroundColor = backgroundColor
    + this.tileShadow = "none"
    + this.tileOpacity = 1
    +
    + this.menuTreeComponentColor = foregroundColor
    + this.foregroundColor = foregroundColor
    +
    + this.lineColor = tinycolor(foregroundColor).setAlpha(0.075).toString()
    + this.boxShadow = tinycolor(foregroundColor).setAlpha(0.1).toString()
    + this.slightlyDarkerBackground = tinycolor(backgroundColor).darken(5).toString()
    + this.darkerBackground = tinycolor(backgroundColor).darken(10).toString()
    +
    + this.activeTabColor = this.darkerBackground
    +
    + const alterGrayShades = (amount) => tinycolor(grayStartColor)[fn](amount).toString()
    +
    + this.darkBlack = alterGrayShades(20)
    + this.mediumBlack = alterGrayShades(40)
    + this.midGray = alterGrayShades(60)
    + this.greyish = options.greyish || alterGrayShades(82)
    + this.lightGrey = alterGrayShades(93)
    + this.lightGrey = options.lightGrey || alterGrayShades(93)
    + this.veryLightGrey = options.veryLightGrey || alterGrayShades(97)
    +
    + this.borderColor = this.greyish
    +
    + this.hoverBackground = selectionColor
    + this.linkColor = selectionColor
    + this.selectedOutline = tinycolor(selectionColor).setAlpha(0.8).toString()
    + this.selectionBackground = tinycolor(selectionColor).setAlpha(0.1).toString()
    +
    + this.errorColor = "rgb(226, 120, 121)"
    + this.successColor = "#4CAF50"
    + this.warningColor = "orange"
    + this.white = "#fff"
    +
    + this.fonts = `'San Francisco', 'Myriad Set Pro', 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, Verdana, sans-serif`
    +
    + this.modalDimmerBackground = tinycolor("#000").setAlpha(0.4).toString()
    +
    + // Pass values overwrite all
    + Object.assign(this, options)
    +
    + // todo: cleanup
    + this.enableTextSelect1 = this._enableTextSelect(1)
    + this.enableTextSelect2 = this._enableTextSelect(2)
    + }
    +
    + _enableTextSelect(indent) {
    + return new jtree.TreeNode(`-moz-user-select text
    + -webkit-user-select text
    + -ms-user-select text
    + user-select text`).toString(indent)
    + }
    - getDisks() {
    - if (!this._disks) this._mountDisks()
    - return this._disks
    - }
    + getHeatColor(percent) {
    + return `hsl(200, ${25 + percent * 75}%, ${20 + percent * 25}%)`
    + }
    - writeFile(fullDiskFilePath, newVersion) {
    - return new FileHandle(fullDiskFilePath, this).writeFile(newVersion)
    - }
    + disableTextSelect(indent) {
    + return new jtree.TreeNode(
    + `-webkit-touch-callout none
    + -webkit-user-select none
    + -khtml-user-select none
    + -moz-user-select none
    + -ms-user-select none
    + user-select none`
    + ).toString(indent)
    + }
    - readFile(fullDiskFilePath) {
    - return new FileHandle(fullDiskFilePath, this).readFile()
    - }
    + hakonToCss(str) {
    + const hakonProgram = new hakonNode(str)
    + // console.log(hakonProgram.getAllErrors())
    + return hakonProgram.compile()
    + }
    + }
    - unlinkFile(fullDiskFilePath) {
    - return new FileHandle(fullDiskFilePath, this).unlinkFile()
    - }
    + const Themes = {}
    - async moveFile(existingFullDiskFilePath, newFullDiskFilePath) {
    - const content = await this.readFile(existingFullDiskFilePath)
    - // Todo: check to make sure we arent overwriting
    - // Todo: check to make sure things worked before unlinking.
    - await this.writeFile(newFullDiskFilePath, content)
    - await this.unlinkFile(existingFullDiskFilePath)
    - return newFullDiskFilePath
    - }
    + Themes[ThemeConstants.dark] = new Theme({
    + hasSolidBackground: true,
    + backgroundColor: "rgb(16, 16, 16)",
    + foregroundColor: "#fff",
    + fn: "darken",
    + })
    - _mountDisks() {
    - this._disks = {}
    - const localDisk = new LocalStorageDisk(this)
    - this._defaultDisk = localDisk
    - this._disks[localDisk.getDisplayName()] = localDisk
    - const addServerDisk = this.isNodeJs() ? false : this.isConnectedToStudioServerApp()
    - let serverDisk
    - if (addServerDisk) {
    - serverDisk = new ServerStorageDisk(this)
    - this._disks[serverDisk.getDisplayName()] = serverDisk
    - }
    + Themes[ThemeConstants.workshop] = new Theme({
    + hasSolidBackground: true,
    + wallBackgroundImage: "url('images/transparenttextures.com/wine-cork.png')",
    + wallBackground: "rgba(244,216,105,.4)",
    + menuBackground: "#3B539A",
    + tileOpacity: 0.95,
    + tileShadow: "0 2px 4px rgba(33,33,33,.2)",
    + menuTreeComponentColor: "white",
    + })
    - const cwd = typeof DefaultServerCurrentWorkingDirectory === "undefined" ? "/" : DefaultServerCurrentWorkingDirectory
    - const workingFolder = this.getFromStore(StorageKeys.workingFolderFullDiskFolderPath)
    - if (workingFolder) this.setWorkingFolder(workingFolder)
    - else this.setWorkingFolder(addServerDisk ? serverDisk.getDisplayName() + cwd : localDisk.getDisplayName() + "/")
    - }
    + const glassColors = {
    + hasSolidBackground: false,
    + selectionColor: "rgba(46, 195, 212, .9)",
    + bodyBackground: "linear-gradient(130deg, rgb(56, 114, 127), rgb(28, 98, 151) 45%, rgb(62, 73, 135))",
    + backgroundColor: "rgba(0,0,0,.12)",
    + contextMenuBackground: "rgba(0,0,0,.90)",
    + tileBackgroundColor: "rgba(0,0,0,.12)",
    + programsBackground: "transparent",
    + boxShadow: "transparent",
    + wallBackground: "transparent",
    + activeTabColor: "transparent",
    + lightGrey: "rgba(0,0,0,.16)",
    + greyish: "rgba(0,0,0,.20)",
    + veryLightGrey: "rgba(0,0,0,.12)",
    + borderColor: "transparent",
    + foregroundColor: "#eee",
    + }
    - setWorkingFolder(newWorkingFolder) {
    - const path = new FullFolderPath(newWorkingFolder)
    - this.setDefaultDisk(path.getDiskId())
    - this.getDefaultDisk().setFolder(path.getFolderPath())
    + const whiteColors = Object.assign({}, glassColors)
    + whiteColors.bodyBackground = "white"
    + whiteColors.foregroundColor = "black"
    + whiteColors.tileBackgroundColor = "transparent"
    - this.storeValue(StorageKeys.workingFolderFullDiskFolderPath, newWorkingFolder)
    - }
    + Themes[ThemeConstants.white] = new Theme(whiteColors)
    - getDefaultDisk() {
    - const disks = this.getDisks()
    - return this._defaultDisk
    - }
    + Themes[ThemeConstants.glass] = new Theme(glassColors)
    - setDefaultDisk(id) {
    - if (!this._disks[id]) throw new Error(`Disk ${id} not found.`)
    - this._defaultDisk = this._disks[id]
    - return this
    - }
    + glassColors.tileBackgroundColor = "transparent"
    + Themes[ThemeConstants.clearGlass] = new Theme(glassColors)
    - // todo: remove this crap?
    - _makeProgramLinksOpenImmediately() {
    - const app = this
    - const willowBrowser = this.getWillowBrowser()
    - willowBrowser
    - .getBodyStumpNode()
    - .getShadow()
    - .onShadowEvent("click", "a", function(evt) {
    - app._handleLinkClick(willowBrowser.getStumpNodeFromElement(this), evt)
    - })
    - }
    + class ThemeTreeComponent extends AbstractTreeComponent {
    + toStumpCode() {
    + const theme = this.getTheme()
    + return `styleTag ${CodeMirrorCss} .CodeMirror{color: ${theme.mediumBlack};} .CodeMirror .CodeMirror-gutters,.cm-s-oceanic-next .CodeMirror-gutters {background: ${theme.solidBackgroundColorOrTransparent}}`
    + }
    + toHakonCode() {
    + const theme = this.getTheme()
    + return `html,body,h1,h2,h3,h4,h5,h6,table,tr,td
    + margin 0
    + padding 0
    - _onCommandWillRun() {
    - this.closeAllContextMenus() // todo: move these to a body handler?
    - this.closeAllDropDownMenusCommand()
    - }
    + html,body
    + width 100%
    + height 100%
    + font-family ${theme.fonts}
    + color ${theme.mediumBlack}
    - async _executeCommandByStumpNodeChild(commandName, stumpNodeChild) {
    - const willowBrowser = this.getWillowBrowser()
    - const stumpNode = willowBrowser.getBodyStumpNode().findStumpNodeByChild(stumpNodeChild)
    - await this._executeCommandOnStumpNode(stumpNode, stumpNode.getStumpNodeAttr(commandName))
    - }
    + body
    + overscroll-behavior-x none
    - async _executeCommandByStumpNodeString(commandName, str) {
    - const willowBrowser = this.getWillowBrowser()
    - const stumpNode = willowBrowser.getBodyStumpNode().findStumpNodeByChildString(str)
    - await this._executeCommandOnStumpNode(stumpNode, stumpNode.getStumpNodeAttr(commandName))
    - }
    + code
    + white-space pre
    - async playFirstVisitCommand() {
    - // await this.openOhayoProgramCommand("faq.ohayo")
    - // todo: make this create in memory?
    - await this.openOhayoProgramCommand(StudioConstants.productName + StudioConstants.ohayoExtension)
    - }
    + html
    + background ${theme.bodyBackground}
    - copyTargetTileCommand(uno, dos) {
    - return this.getTargetTile().copyTileCommand(uno, dos)
    - }
    + table
    + border-collapse collapse
    + border-spacing 0
    + table-layout fixed
    - copyTargetTileDataAsTreeCommand(uno, dos) {
    - return this.getTargetTile().copyDataAsTreeCommand(uno, dos)
    - }
    + .ThemeTreeComponent
    + display none
    - copyTargetTileDataAsJavascriptCommand(uno, dos) {
    - return this.getTargetTile().copyDataAsJavascriptCommand(uno, dos)
    - }
    + a
    + cursor pointer
    + text-decoration none
    + color ${theme.linkColor}
    - copyTargetTileDataCommand(uno, dos) {
    - return this.getTargetTile().copyDataCommand(uno, dos)
    - }
    + ::-webkit-scrollbar
    + display none
    - exportTargetTileDataCommand(uno, dos) {
    - return this.getTargetTile().exportTileDataCommand(uno, dos)
    - }
    + .leftButton,.rightButton
    + background transparent
    + border 0
    - async cellCheckProgramCommand() {
    - const program = this.mountedTab.getTabProgram()
    - const errors = program.getAllErrors().map(err => err.getMessage())
    - if (errors.length)
    - this.mountedTab.addStumpCodeMessageToLog(
    - `div ${errors.length} errors in ${this.mountedTab.getFileName()}
    - class OhayoError
    - div - ${errors.join("\n div - ")}`
    - )
    - else this.mountedTab.addStumpCodeMessageToLog(`div 0 errors in ${this.mountedTab.getFileName()}`)
    - this.renderApp()
    - }
    + .LintError,.LintErrorWithSuggestion,.LintCellTypeHints
    + white-space pre
    + color red
    + background #e5e5e5
    - async printProgramStatsCommand(tabId) {
    - const tab = this._getTabByIdOrMountedTab(tabId)
    - const stats = new jtree.TreeNode(tab.getTabProgram().toRunTimeStats()).toString()
    - tab.logMessageText(stats)
    - this.renderApp()
    - }
    + .LintCellTypeHints
    + color black
    - createProgramFromFileCommand(filename, data) {
    - // todo: how do we handle multi-table-csv?
    - // there are multiple types of CSVs.
    - const extension = jtree.Utils.getFileExtension(filename)
    - if (extension === StudioConstants.ohayoExtension) return this._createAndOpen(data, filename)
    + .LintErrorWithSuggestion
    + cursor pointer
    - const templateFn = OhayoTemplates[extension]
    - const program = templateFn ? templateFn(filename, data, this) : `html.h1 No visualization templates for ${filename}`
    - return this._createAndOpen(program, filename + StudioConstants.ohayoExtension)
    - }
    + .TileTextArea
    + padding 5px
    + width 100%
    + height 100%
    + min-height 200px
    + box-sizing border-box
    + outline 0
    + border 0
    + font-size 14px
    + font-family ${theme.fonts}
    + resize none
    - async toggleShadowByIdCommand(id) {
    - this.willowBrowser
    - .getBodyStumpNode()
    - .findStumpNodeByChild("id " + id)
    - .getShadow()
    - .toggleShadow()
    - }
    + .rightButton
    + float right
    - async fillShadowInputOrTextAreaByClassNameCommand(className, value) {
    - this.willowBrowser
    - .getBodyStumpNode()
    - .findStumpNodesWithClass(className)
    - .forEach(stumpNode => {
    - stumpNode.getShadow().setInputOrTextAreaValue(value)
    - })
    - }
    + .LargeLabel
    + font-size 12px
    + color ${theme.midGray}
    + position absolute
    + left 26px
    + top 2px
    - async openDeleteAllTabsPromptCommand() {
    - const tabs = this.getTabs()
    + .LargeTileInput
    + display block
    + width 100%
    + height 34px
    + margin-top 4px
    + padding 2px 20px
    + font-size 14px
    + line-height 1.428571429
    + vertical-align middle
    + box-sizing border-box
    + color ${theme.darkBlack}
    + background ${theme.backgroundColor}
    + border 0
    - const shouldProceed = await this.willowBrowser.confirmThen(`Are you sure you want to delete ${tabs.length} open files?`)
    + .dragOver
    + opacity 0.5
    - return shouldProceed
    - ? Promise.all(
    - tabs.map(tab => {
    - tab.unlinkTab()
    - this.closeTab(tab)
    - })
    - )
    - : false
    - }
    + #dragOverHelp
    + position absolute
    + font-size 36px
    + width 100%
    + height 100%
    + z-index 300
    + display flex
    + align-items center
    + justify-content center
    + top 0
    + left 0
    - async closeAllDropDownMenusCommand() {
    - this.getTopDownArray().forEach(treeComponent => {
    - if (treeComponent.getLine().includes(StudioConstants.DropDownMenuSubstring)) treeComponent.unmountAndDestroy()
    - })
    - }
    + .SVGIcon
    + fill ${theme.foregroundColor}
    + cursor pointer
    - async appendTileAndSelectCommand(line, children) {
    - const tiles = this._appendTiles(line, children)
    - tiles.forEach(tile => tile.execute())
    - this.mountedProgram.clearSelection()
    - await this.mountedProgram.getTab().autosaveAndRender()
    + .buttonPrimary
    + border-radius 2px
    + cursor pointer
    + border none
    + padding 15px 32px
    + text-align center
    + text-decoration none
    + font-size 16px
    + color white
    + background ${theme.successColor}
    - tiles.forEach(tile => tile.selectTile())
    - }
    + .divider
    + background ${theme.lineColor}
    + height 1px
    + margin 10px 0
    + width 100%
    - async insertChildPickerTileCommand() {
    - const program = this.getMountedTilesProgram()
    - const tiles = program.getTiles()
    - const target = tiles.length ? tiles[tiles.length - 1] : program
    - const newTile = target.appendLineAndChildren(OhayoConstants.pickerTile)
    - await this.getMountedTab().autosaveAndRender()
    - newTile.selectTile()
    - }
    + input,textarea
    + background transparent
    + color ${theme.foregroundColor}
    - async insertAdjacentTileCommand() {
    - // todo: remove?
    - // todo: it seems like we don't want to have that insert multiple behavior. removed it for now.
    - const newTiles = this.getNodeCursors()
    - .slice(0, 1)
    - .map(cursor => cursor.appendLine(OhayoConstants.pickerTile))
    - const promise = await app.getMountedTab().autosaveAndRender()
    - this.mountedProgram.clearSelection()
    - newTiles.forEach(tile => tile.selectTile())
    - return promise
    - }
    + .abstractTileTreeComponentNode
    + position relative
    + opacity ${theme.tileOpacity}
    + background ${theme.tileBackgroundColor}
    + margin 10px 15px
    + box-shadow ${theme.tileShadow}
    + ol
    + height 100%
    + width 100%
    + overflow scroll
    + box-sizing border-box
    + margin 0
    + z-index 1
    + ${theme.disableTextSelect(1)}
    + &.TileMaximized
    + z-index 2
    + .TileDropDownButton,.TileInsertBetweenButton
    + opacity .4
    + cursor pointer
    + font-size 10px
    + line-height 12px
    + .TileDropDownButton
    + &:hover
    + opacity 1
    + .TileInsertBetweenButton
    + font-weight bold
    + &:hover
    + opacity 1
    + &:hover
    + z-index 2
    + .TileSelectable
    + ${theme.enableTextSelect2}
    + .TileBody
    + padding 15px 5px
    + width 100%
    + max-height 400px
    + box-sizing border-box
    + overflow scroll
    + .TileFooter
    + font-size 12px
    + height 20px
    + line-height 20px
    + padding-left 5px
    + padding-right 3px
    + white-space nowrap
    + color ${theme.midGray}
    + background ${theme.tileBackgroundColor}
    + overflow hidden
    + position absolute
    + max-width 100%
    + box-sizing border-box
    + bottom 0
    + right 0
    + iframe
    + width 100%
    + height 100%
    + border 0`
    + }
    + }
    - async appendTileCommand(line, children) {
    - // Todo: we just removed race condition. But does UI suffer?
    - await Promise.all(this._appendTiles(line, children).map(tile => tile.execute()))
    - return this.mountedTab.autosaveAndRender()
    - }
    + ThemeTreeComponent.defaultTheme = ThemeConstants.workshop
    + ThemeTreeComponent.Themes = Themes
    + ThemeTreeComponent.ThemeConstants = ThemeConstants
    - async deleteAllRowsInTargetTileCommand() {
    - const inputTable = this.getTargetTile().getParentOrDummyTable()
    - await Promise.all(inputTable.getRows().map(row => row.destroyRow(this)))
    - this.renderApp() // todo: cleanup
    - }
    + window.ThemeTreeComponent = ThemeTreeComponent
    - openOhayoProgramCommand(names) {
    - return Promise.all(names.split(" ").map(name => this._openOhayoProgram(name)))
    - }
    + class AbstractContextMenuTreeComponent extends AbstractTreeComponent {
    + toHakonCode() {
    + const theme = this.getTheme()
    + return `.AbstractContextMenuTreeComponent
    + position fixed
    + overflow scroll
    + max-height 100%
    + z-index 221
    + background ${theme.contextMenuBackground}
    + border 1px solid ${theme.borderColor}
    + box-shadow 0 1px 3px 0 ${theme.boxShadow}
    + font-size 14px
    + a
    + display block
    + padding 3px
    + font-size 14px
    + text-decoration none
    + color ${theme.darkBlack}
    + &:hover
    + color ${theme.white}
    + background ${theme.hoverBackground}`
    + }
    - deleteFileCommand(filepath) {
    - return this.unlinkFile(filepath)
    - }
    + toStumpCode() {
    + return new jtree.TreeNode(`div
    + class AbstractContextMenuTreeComponent {constructorName}
    + {body}`).templateToString({ constructorName: this.constructor.name, body: this.getContextMenuBodyStumpCode() })
    + }
    +
    + treeComponentDidMount() {
    + const container = this.getStumpNode()
    + const app = this.getRootNode()
    + const willowBrowser = app.getWillowBrowser()
    + const bodyShadow = willowBrowser.getBodyStumpNode().getShadow()
    + const unmountOnClick = function () {
    + bodyShadow.offShadowEvent("click", unmountOnClick) // todo: should we move this to before unmount?
    + app.closeAllContextMenus()
    + }
    + setTimeout(() => bodyShadow.onShadowEvent("click", unmountOnClick), 100) // todo: fix this.
    + const event = app.getMouseEvent()
    + const windowSize = willowBrowser.getWindowSize()
    + const css = this._getContextMenuPosition(windowSize.width, windowSize.height, event.clientX, event.clientY, container.getShadow())
    + container.setStumpNodeCss(css)
    + }
    +
    + _getContextMenuPosition(windowWidth, windowHeight, x, y, shadow) {
    + let boxTop = y
    + let boxLeft = x
    + const boxWidth = shadow.getShadowOuterWidth()
    + const boxHeight = shadow.getShadowOuterHeight()
    + const boxHeightOverflow = boxHeight + boxTop - windowHeight
    + const boxRightOverflow = boxWidth + boxLeft - windowWidth
    +
    + // todo: instead of this change orientation
    + if (boxHeightOverflow > 0) boxTop -= boxHeightOverflow
    +
    + if (boxRightOverflow > 0) boxLeft = x - boxWidth - 5
    +
    + if (boxTop < 0) boxTop = 0
    +
    + return {
    + left: boxLeft,
    + top: boxTop,
    + }
    + }
    + }
    +
    + window.AbstractContextMenuTreeComponent = AbstractContextMenuTreeComponent
    - async moveFileCommand(existingFullDiskFilePath, newFullDiskFilePath) {
    - return this.moveFile(existingFullDiskFilePath, newFullDiskFilePath)
    - }
    + class AbstractDropDownMenuTreeComponent extends AbstractTreeComponent {
    + toHakonCode() {
    + const theme = this.getTheme()
    + return `
    + .subdued
    + color ${theme.midGray}
    - getAutocompleteResultsAtDocEndDiagnostic() {
    - const lastLineIndex = this.mountedProgram.getNumberOfLines() - 1
    - const lastLineNode = this.mountedProgram.nodeAtLine(lastLineIndex)
    - const charIndex = lastLineNode.getIndentLevel() + lastLineNode.getLine().length - 1
    - return this.mountedProgram
    - .getAutocompleteResultsAt(lastLineIndex, charIndex)
    - .matches.map(match => match.text)
    - .join(" ")
    - }
    + .dropdownMenu
    + min-width 200px
    + position absolute
    + top 0
    + left 0
    + z-index 100
    + padding 7px 0
    + background ${theme.contextMenuBackground}
    + border 1px solid ${theme.borderColor}
    + box-shadow 0 1px 3px 0 ${theme.boxShadow}
    + .message
    + line-height 30px
    + padding 0 10px
    + a
    + color ${theme.foregroundColor}
    + display block
    + line-height 30px
    + padding 0 10px
    + &:hover
    + background ${theme.hoverBackground}
    + color ${theme.white}`
    + }
    +
    + treeComponentDidMount() {
    + const app = this.getRootNode()
    + const willowBrowser = app.getWillowBrowser()
    + const bodyStumpNode = willowBrowser.getBodyStumpNode()
    + const bodyShadow = bodyStumpNode.getShadow()
    + const unmountOnClick = function () {
    + bodyShadow.offShadowEvent("click", unmountOnClick)
    + app.closeAllDropDownMenusCommand()
    + }
    + setTimeout(() => bodyShadow.onShadowEvent("click", unmountOnClick), 100) // todo: fix this.
    + }
    +
    + toStumpCode() {
    + const anchorId = this.getAnchorId()
    + const buttonStumpNode = this.getParent()
    + .getStumpNode()
    + .findStumpNodeByChild("id " + anchorId)
    + const buttonStumpNodeShadow = buttonStumpNode.getShadow()
    + const left = buttonStumpNodeShadow.getShadowPosition().left
    +
    + return new jtree.TreeNode(`div
    + style top: 30px; left: ${left}px;
    + class dropdownMenu
    + {dropDownStump}`).templateToString({ dropDownStump: this.getDropDownStumpCode() })
    + }
    + }
    - async createNewBlankProgramCommand(filename = "untitled" + StudioConstants.ohayoExtension) {
    - const tab = await this._createAndOpen("", filename)
    - tab.addStumpCodeMessageToLog(`div Created '${tab.getFullTabFilePath()}'`)
    - }
    + window.AbstractDropDownMenuTreeComponent = AbstractDropDownMenuTreeComponent
    - async copyTabDeepLinkCommand(tabId) {
    - this.getWillowBrowser().copyTextToClipboard(this._getTabByIdOrMountedTab(tabId).getDeepLink())
    - }
    + class AbstractModalTreeComponent extends AbstractTreeComponent {
    + toHakonCode() {
    + const theme = this.getTheme()
    + return `${super.toHakonCode()}
    + .modalBackground
    + position fixed
    + top 0
    + left 0
    + width 100%
    + height 100%
    + z-index 1000
    + display flex
    + padding-top 50px
    + align-items baseline
    + justify-content center
    + box-sizing border-box
    + background ${theme.modalDimmerBackground}
    - _getTabByIdOrMountedTab(tabId) {
    - return tabId === undefined || tabId === "" ? this.mountedTab : this.getTabs().find(tab => tab._getUid().toString() === tabId)
    - }
    + .modalContent
    + background ${theme.contextMenuBackground}
    + color ${theme.foregroundColor}
    + box-shadow 0px 0px 2px ${theme.boxShadow}
    + padding 20px
    + position relative
    + min-width 600px
    + max-width 800px
    + max-height 90%
    + white-space nowrap
    + text-overflow ellipsis
    + overflow-x hidden
    + overflow-y scroll
    + textarea
    + margin-bottom 10px
    + white-space pre
    + pre
    + ${theme.enableTextSelect2}
    - async createAndOpenNewProgramFromDeepLinkCommand(deepLink) {
    - const uri = new URLSearchParams(new URL(deepLink).search)
    - const fileName = decodeURIComponent(uri.get(StudioConstants.deepLinks.filename))
    - let sourceCode = decodeURIComponent(uri.get(StudioConstants.deepLinks.data))
    - if (uri.get(StudioConstants.deepLinks.edgeSymbol)) sourceCode = sourceCode.replace(new RegExp(uri.get(StudioConstants.deepLinks.edgeSymbol), "g"), " ")
    - if (uri.get(StudioConstants.deepLinks.nodeBreakSymbol)) sourceCode = sourceCode.replace(new RegExp(uri.get(StudioConstants.deepLinks.nodeBreakSymbol), "g"), "\n")
    + .modalClose
    + position absolute
    + top 10px
    + right 10px
    + cursor pointer`
    + }
    - // todo: sec scan
    + toStumpCode() {
    + return new jtree.TreeNode(`section
    + clickCommand unmountAndDestroyCommand
    + class modalBackground
    + section
    + clickCommand stopPropagationCommand
    + class modalContent
    + a X
    + id closeModalX
    + clickCommand unmountAndDestroyCommand
    + class modalClose
    + {modelStumpCode}`).templateToString({ modelStumpCode: this.getModalStumpCode() })
    + }
    + }
    - await this._createAndOpen(sourceCode, fileName)
    - // Now remove the current page from history.
    - // todo: cleanup by moving to willow
    - if (typeof window !== "undefined") window.history.replaceState({}, document.title, location.pathname)
    - }
    + window.AbstractModalTreeComponent = AbstractModalTreeComponent
    - async openCreateNewProgramFromUrlDialogCommand() {
    - const url = await this.willowBrowser.promptThen(`Enter the url to clone and edit`, "")
    + class BasicTerminalTreeComponent extends AbstractTreeComponent {
    + toHakonCode() {
    + return `.sourceTextarea
    + height ${this._getHeight()}px
    + font-size 110%
    + border 0
    + white-space nowrap
    + width 100%`
    + }
    +
    + async saveChangesCommand() {
    + // tood: this is broken. needs to unmount first.
    + // todo: add a patch method to tree.
    + if (this.hasChanges()) await this._getTab().autosaveAndReloadWith(this.getCode())
    + }
    +
    + _getHeight() {
    + return Math.floor((this.getRootNode().getBodyShadowDimensions().height - 60) * 0.7)
    + }
    +
    + _getProgramSource() {
    + const tab = this._getTab()
    + return tab ? tab.getTabProgram().childrenToString() : ""
    + }
    +
    + _getProgram() {
    + const mountedTab = this._getTab()
    + return mountedTab && mountedTab.getTabProgram()
    + }
    +
    + _getTab() {
    + return this.getRootNode().getMountedTab()
    + }
    +
    + toStumpCode() {
    + return new jtree.TreeNode(`div
    + style font-size: 16px;
    + class TerminalDiv
    + textarea
    + class sourceTextarea
    + blurCommand saveChangesCommand
    + bern
    + {lines}`).templateToString({ lines: this._getProgramSource() })
    + }
    +
    + _getTextareaShadow() {
    + return this.getStumpNode().getNode("textarea").getShadow()
    + }
    +
    + _updateTA() {
    + if (this._getTextareaShadow()) this._getTextareaShadow().setInputOrTextAreaValue(this._getProgramSource())
    + }
    +
    + setFile(fileName) {
    + this.setWord(1, fileName)
    + }
    +
    + treeComponentDidUpdate() {
    + this._updateTA()
    + super.treeComponentDidUpdate()
    + }
    +
    + getDependencies() {
    + const gutter = this.getParent()
    + const deps = gutter.getDependencies()
    + const panel = gutter.getParent()
    + const tab = this._getTab()
    + const tabProgram = tab && tab.getTabProgram()
    + if (tabProgram && this._getProgramSource() !== this.getCode()) deps.push({ getLineModifiedTime: () => tabProgram.getLineOrChildrenModifiedTime() })
    + deps.push(panel)
    + return deps
    + }
    +
    + _updateHtml() {
    + // noop. todo: is this a good pattern? we noop it because of codemirror.
    + }
    +
    + getCode() {
    + const ta = this._getTextareaShadow()
    + return ta ? ta.getShadowValue() : ""
    + }
    +
    + hasChanges() {
    + const program = this._getProgram()
    + return program && this.getCode() !== program.childrenToString()
    + }
    +
    + getWhetherToUpdateAndReason() {
    + if (this.hasFocus())
    + return {
    + shouldUpdate: false,
    + reason: "should NOT Update because currently has focus",
    + }
    + // NEVER UPDATE IF THIS HAS CHANGES.
    + // todo: add tests!
    + return super.getWhetherToUpdateAndReason()
    + }
    +
    + hasFocus() {
    + return false
    + }
    + }
    +
    + window.BasicTerminalTreeComponent = BasicTerminalTreeComponent
    - if (!url) return undefined
    + // TODO!!!! UNDO/REDO HISTORY IS SAVED ACROSS TAB SWITCHES.
    - const res = await this.willowBrowser.httpGetUrl(url)
    + const CodeMirrorConstants = {}
    - const tab = await this._createAndOpen(res.text, "untitled" + StudioConstants.ohayoExtension)
    - tab.addStumpCodeMessageToLog(`div Created '${tab.getFullTabFilePath()}'`)
    - }
    + CodeMirrorConstants.options = {}
    + CodeMirrorConstants.options.theme = "theme"
    + CodeMirrorConstants.themes = {}
    + CodeMirrorConstants.themes.oceanicNext = "oceanic-next"
    + CodeMirrorConstants.themes.default = "default"
    + CodeMirrorConstants.events = {}
    + CodeMirrorConstants.events.blur = "blur"
    + CodeMirrorConstants.events.gutterClick = "gutterClick"
    + CodeMirrorConstants.keyMap = {}
    + CodeMirrorConstants.keyMap.cmdEnter = "Cmd-Enter"
    + CodeMirrorConstants.keyMap.shiftCmdEnter = "Shift-Cmd-Enter"
    + CodeMirrorConstants.keyMap.cmdBackSlash = "Cmd-\\"
    + CodeMirrorConstants.keyMap.cmdS = "Cmd-S"
    + CodeMirrorConstants.keyMap.ctrlS = "Ctrl-S"
    + CodeMirrorConstants.keyMap.escape = "Esc"
    - async openFolderPromptCommand() {
    - const folder = await this.willowBrowser.promptThen(`Enter a folder path to open multiple files`, this.getDefaultDisk().getPathBase())
    - return folder ? this.openFolderCommand(folder) : undefined
    - }
    + class CodeMirrorTerminalTreeComponent extends BasicTerminalTreeComponent {
    + getCode() {
    + // todo: this is buggy! figure it out. when toggling pane, it comes back w/o highlighting.
    + // probably shouldn't need this if check
    + const cm = this._getCMEditorInstance()
    + return cm ? cm.getValue() : ""
    + }
    +
    + _getCMEditorInstance() {
    + return this._CMEditorInstance
    + }
    +
    + hasFocus() {
    + const cm = this._getCMEditorInstance()
    + return cm && cm.hasFocus()
    + }
    +
    + treeComponentDidMount() {
    + this._loadCodeMirror()
    + super.treeComponentDidMount()
    + }
    +
    + _updateTheme() {
    + const cm = this._getCMEditorInstance()
    + if (cm.getOption(CodeMirrorConstants.options.theme) !== this._getCMThemeToUse()) cm.setOption(CodeMirrorConstants.options.theme, this._getCMThemeToUse())
    + }
    +
    + _updateTA() {}
    +
    + treeComponentDidUpdate() {
    + const cm = this._getCMEditorInstance()
    + // todo: perf problems here.
    + if (cm) {
    + this._updateTheme()
    + cm.setValue(this._getProgramSource())
    + }
    + super.treeComponentDidUpdate()
    + }
    +
    + _getKeyMap() {
    + const cm = this._getCMEditorInstance()
    + const keyMap = {}
    +
    + keyMap[CodeMirrorConstants.keyMap.cmdBackSlash] = () => {
    + this.getRootNode().clearTabMessagesCommand()
    + }
    +
    + keyMap[CodeMirrorConstants.keyMap.escape] = () => {
    + cm.getInputField().blur()
    + }
    +
    + keyMap[CodeMirrorConstants.keyMap.cmdS] = async () => {
    + await this.saveChangesCommand()
    + const app = this.getRootNode()
    + await app.cellCheckProgramCommand()
    + // todo: scroll to proper tile
    + const tile = this._getClosestTileAtCurrentLine()
    + if (tile) tile.scrollIntoView()
    + }
    +
    + keyMap[CodeMirrorConstants.keyMap.ctrlS] = keyMap[CodeMirrorConstants.keyMap.cmdS]
    +
    + return keyMap
    + }
    +
    + _getClosestTileAtCurrentLine() {
    + const cm = this._getCMEditorInstance()
    + const range = cm.listSelections()[0]
    + const line = range && range.head.line
    + const app = this.getRootNode()
    + const tab = app.getMountedTab()
    + const tabProgram = tab.getTabProgram()
    + return tabProgram && line !== false ? tabProgram.getTileClosestToLine(line) : undefined
    + }
    +
    + _getCMThemeToUse() {
    + return this.getRootNode().isGlassTheme() ? CodeMirrorConstants.themes.oceanicNext : CodeMirrorConstants.themes.default
    + }
    +
    + _loadCodeMirror() {
    + if (!CodeMirrorTerminalTreeComponent._cMMode) {
    + const app = this.getRootNode()
    +
    + CodeMirrorTerminalTreeComponent._cMMode = new jtree.TreeNotationCodeMirrorMode(
    + "tree",
    + () => ohayoNode,
    + () => (app.getMountedTab() ? this.getCode() : undefined),
    + CodeMirror
    + ).register()
    + }
    +
    + const cmInstance = CodeMirrorTerminalTreeComponent._cMMode.fromTextAreaWithAutocomplete(this._getTextareaShadow().getShadowElement(), {
    + theme: this._getCMThemeToUse(),
    + })
    +
    + this._CMEditorInstance = cmInstance
    +
    + cmInstance.setSize(undefined, this._getHeight())
    +
    + cmInstance.on(CodeMirrorConstants.events.blur, () => {
    + // note: if you have changes in terminal/gutter, they will be saved. no cancel yet.
    + this.saveChangesCommand()
    + })
    + cmInstance.addKeyMap(this._getKeyMap())
    +
    + let waiting
    + const codeWidgets = []
    + cmInstance.on("keyup", () => {
    + clearTimeout(waiting)
    + waiting = setTimeout(() => this._updateHints(cmInstance, codeWidgets), 100)
    + })
    + }
    +
    + _updateHints(codeInstance, codeWidgets) {
    + const app = this.getRootNode()
    + const tab = app.getMountedTab()
    + const program = new ohayoNode(this.getCode())
    + const errs = program.getAllErrors()
    + const cursor = codeInstance.getCursor()
    +
    + // todo: what if 2 errors?
    + codeInstance.operation(function () {
    + codeWidgets.forEach((widget) => codeInstance.removeLineWidget(widget))
    + codeWidgets.length = 0
    +
    + errs
    + .filter((err) => !err.isCursorOnWord(cursor.line, cursor.ch))
    + .slice(0, 1) // Only show 1 error at a time. Otherwise UX is not fun.
    + .forEach((err) => {
    + const el = err.getCodeMirrorLineWidgetElement(() => {
    + codeInstance.setValue(program.toString())
    + // todo: do we need to trigger update?
    + })
    + codeWidgets.push(codeInstance.addLineWidget(err.getLineNumber() - 1, el, { coverGutter: false, noHScroll: false }))
    + })
    + const info = codeInstance.getScrollInfo()
    + const after = codeInstance.charCoords({ line: cursor.line + 1, ch: 0 }, "local").top
    + if (info.top + info.clientHeight < after) codeInstance.scrollTo(null, after - info.clientHeight + 3)
    + })
    + }
    + }
    +
    + window.CodeMirrorTerminalTreeComponent = CodeMirrorTerminalTreeComponent
    - async changeWorkingFolderPromptCommand() {
    - const current = this.getDefaultDisk().getPathBase()
    - const newWorkingFolder = await this.willowBrowser.promptThen(`Enter a folder path`, current)
    - if (!newWorkingFolder || current === newWorkingFolder) return undefined
    - return this.changeWorkingFolderCommand(newWorkingFolder)
    - }
    + class ConsoleTreeComponent extends AbstractTreeComponent {
    + _getConsoleOutput() {
    + const logLines = this._getMessageBuffer().map((message) => message.childrenToString())
    + logLines.reverse()
    + return logLines.join("\n")
    + }
    +
    + _getHeight() {
    + return Math.floor((this.getRootNode().getBodyShadowDimensions().height - 60) * 0.3)
    + }
    +
    + setFile(fileName) {
    + this.setWord(1, fileName)
    + }
    +
    + toHakonCode() {
    + return `.consoleOutput
    + height ${this._getHeight()}px
    + overflow scroll
    + font-family monospace
    + white-space nowrap
    + div
    + margin-top 2px`
    + }
    +
    + _getMessageBuffer() {
    + // todo: cleanup
    + const app = this.getRootNode()
    + const tab = app.getMountedTab()
    + return tab ? tab.getMessageBuffer() : app.getMessageBuffer()
    + }
    +
    + getDependencies() {
    + // todo: cleanup
    + // 2 dependencies. the program and the programs message buffer.
    + // let's call the latter the panel buffer for now.
    + const deps = this.getParent().getDependencies()
    + const messages = this._getMessageBuffer()
    + if (messages.length) deps.push(messages.nodeAt(-1))
    + else deps.push(new jtree.TreeNode())
    +
    + deps.push(this.getParent().getParent())
    + return deps
    + }
    +
    + toStumpCode() {
    + return new jtree.TreeNode(`div
    + class consoleOutput
    + {messageBuffer}`).templateToString({ messageBuffer: this._getConsoleOutput() })
    + }
    + }
    - async changeWorkingFolderCommand(newWorkingFolder) {
    - newWorkingFolder = newWorkingFolder.replace(/\/$/, "") + "/"
    - this.setWorkingFolder(newWorkingFolder)
    - }
    + window.ConsoleTreeComponent = ConsoleTreeComponent
    - async openFullDiskFilePathPromptCommand(suggestion) {
    - const fullPath = await this.willowBrowser.promptThen(`Enter a full path to open`, suggestion || this.getDefaultDisk().getPathBase())
    + const OhayoConstants = {}
    + OhayoConstants.tileCssScript = "tileCssScript"
    + OhayoConstants.tileScript = "tileScript"
    + OhayoConstants.tileSize = "tileSize"
    + OhayoConstants.abstractTileSetting = "abstractTileSetting"
    - if (!fullPath) return undefined
    - new FullDiskPath(fullPath)
    - // Todo: what if it does not exist.
    - return this.openFullPathInNewTabAndFocus(fullPath)
    - }
    + OhayoConstants.noPicker = "noPicker"
    - async openFolderCommand(fullFolderPath) {
    - fullFolderPath = new FullFolderPath(fullFolderPath, this)
    - const files = await fullFolderPath.getFiles()
    + OhayoConstants.selectedClass = "selected"
    - return Promise.all(files.map(file => this._openFullDiskFilePathInNewTab(file.getFileLink())))
    - }
    + OhayoConstants.maximized = "maximized"
    + OhayoConstants.pickerTile = "doc.picker"
    - async confirmAndResetAppStateCommand() {
    - const result = await this.willowBrowser.confirmThen(`Are you sure you want to reset the Ohayo Studio UI? Your files will not be lost.`)
    - if (!result) return undefined
    - this.resetAppState()
    - this.willowBrowser.reload()
    - }
    + OhayoConstants.abstractTileTreeComponentNode = "abstractTileTreeComponentNode"
    - openUrlInNewTabCommand(url) {
    - return this._openFullDiskFilePathInNewTab(new FullDiskPath(url).toString())
    - }
    + window.OhayoConstants = OhayoConstants
    - async mountTabCommand(tabId) {
    - const tab = this._getTabByIdOrMountedTab(tabId)
    - this.setMountedTab(tab)
    - this.renderApp()
    - }
    + // rename lodash
    + if (!window.lodash) window.lodash = _
    - async mountTabByIndexCommand(index) {
    - this.setMountedTab(this.getTabs()[index])
    - this.renderApp()
    - }
    + // Shim window.console for IE.
    + if (!window.console) window.console = { log: () => {}, time: () => {}, error: () => {}, debug: () => {} }
    - async closeTabCommand(tabId) {
    - this.closeTab(this._getTabByIdOrMountedTab(tabId))
    - this.renderApp()
    - }
    + // Safari polyfill:
    + if (!Object.values) Object.values = (obj) => Object.keys(obj).map((key) => obj[key])
    - _mountTabByIndex(tabIndex) {
    - this.setMountedTab(this.getTabs()[tabIndex])
    - this.renderApp()
    - return this
    - }
    + const d3format = {}
    + d3format.format = d3.format
    - getMountedTab() {
    - return this._getMountedTab()
    - }
    + const StudioConstants = {}
    - _getMountedTab() {
    - return this._focusedTab
    - }
    + StudioConstants.gutter = "gutter"
    + StudioConstants.terminal = "terminal"
    + StudioConstants.console = "console"
    + StudioConstants.theme = "theme"
    + StudioConstants.menu = "menu"
    + StudioConstants.wall = "wall"
    + StudioConstants.panel = "panel"
    + StudioConstants.tabs = "tabs"
    + StudioConstants.helpModal = "helpModal"
    + StudioConstants.tabMenu = "tabMenu"
    + StudioConstants.tileMenu = "tileMenu"
    + StudioConstants.DropDownMenuSubstring = "DropDownMenu"
    - _getTabsNode() {
    - return this.getNode("menu tabs")
    - }
    + StudioConstants.productName = "ohayo"
    + StudioConstants.githubLink = "https://github.com/treenotation/ohayo"
    + StudioConstants.subredditLink = "https://www.reddit.com/r/ohayocomputer"
    + StudioConstants.slogan = "a fast and free data science studio"
    - async toggleAutoSaveCommand() {
    - const newSetting = !this.isAutoSaveEnabled()
    - if (!newSetting) this.storeValue(StorageKeys.autoSave, "false")
    - else this.removeValue(StorageKeys.autoSave)
    - this.addStumpCodeMessageToLog(`div Autosave is ${newSetting}`)
    - }
    + StudioConstants.ohayoExtension = ".ohayo"
    - get willowBrowser() {
    - return this.getWillowBrowser()
    - }
    + StudioConstants.deepLinks = {}
    + StudioConstants.deepLinks.filename = "filename"
    + StudioConstants.deepLinks.data = "data"
    + StudioConstants.deepLinks.edgeSymbol = "edgeSymbol"
    + StudioConstants.deepLinks.nodeBreakSymbol = "nodeBreakSymbol"
    - get mountedProgram() {
    - return this.getMountedTilesProgram()
    - }
    + window.StudioConstants = StudioConstants
    - get mountedTab() {
    - return this.getMountedTab()
    - }
    + class GutterTreeComponent extends AbstractTreeComponent {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, {
    + console: ConsoleTreeComponent,
    + terminal: this.isNodeJs() ? BasicTerminalTreeComponent : CodeMirrorTerminalTreeComponent,
    + })
    + }
    +
    + get _gutterWidth() {
    + return this.getWord(1)
    + }
    +
    + setGutterWidth(newWidth) {
    + this.setWord(1, newWidth)
    + return this
    + }
    +
    + toHakonCode() {
    + const theme = this.getTheme()
    + return `${super.toHakonCode()}
    + .Gutter
    + width ${this._gutterWidth}px
    + left 0
    + background ${theme.backgroundColor}
    + border-color ${theme.borderColor}
    + position absolute
    + border-right-width 1px
    + border-right-style solid
    + box-sizing border-box
    + top 0
    + bottom 0
    + padding 20px
    + .closeGutter
    + cursor pointer
    + position absolute
    + top 10px
    + right 5px
    + display block
    + font-size 12px
    + line-height 10px
    + text-align center
    + opacity .25
    + &:hover
    + opacity 1`
    + }
    - async toggleThemeCommand() {
    - this._toggleTheme()
    - }
    + toStumpCode() {
    + return `div
    + class Gutter
    + span <>
    + class closeGutter
    + clickCommand toggleGutterWidthCommand`
    + }
    + }
    - openFullPathInNewTabAndFocusCommand(url) {
    - return this.openFullPathInNewTabAndFocus(url)
    - }
    + window.GutterTreeComponent = GutterTreeComponent
    - async _showTabMoveFilePromptCommand(tabId, suggestedNewFilename, isRenameOp = false) {
    - const tab = this._getTabByIdOrMountedTab(tabId)
    + class HelpModal extends AbstractModalTreeComponent {
    + getMomentHelp() {
    + return `Char;Example;Description
    + YYYY;2014;4 or 2 digit year
    + YY;14;2 digit year
    + Y;-25;Year with any number of digits and sign
    + Q;1..4;Quarter of year. Sets month to first month in quarter.
    + M MM;1..12;Month number
    + MMM MMMM;Jan..December;Month name in locale set by moment.locale()
    + D DD;1..31;Day of month
    + Do;1st..31st;Day of month with ordinal
    + DDD DDDD;1..365;Day of year
    + X;1410715640.579;Unix timestamp
    + x;1410715640579;Unix ms timestamp
    + H HH;0..23;24 hour time
    + h hh;1..12;12 hour time used with a A.
    + a/p A/P;am pm;Post or ante meridiem
    + m mm;0..59;Minutes
    + s ss;0..59;Seconds
    + S SS SSS;0..999;Fractional seconds
    + Z ZZ;+12:00;Offset from UTC as +-HH:mm, +-HHmm, or Z
    + w ww;1..53;Locale week of year
    + e;0..6;Locale day of week
    + ddd dddd;Mon...Sunday;Day name in locale set by moment.locale()
    + E;1..7;ISO day of week`
    + .split("\n")
    + .map((line) => {
    + const parts = line.split(";")
    + return `${parts[0]}${parts[1]}${parts[2]}`
    + })
    + .join("")
    + }
    +
    + toHakonCode() {
    + return `${super.toHakonCode()}
    + p
    + width 100%
    + white-space normal
    + .helpToggle
    + display block
    + .helpSection
    + .helpCategory
    + font-weight bold
    + #shortcutsHelp td
    + padding-right 10px`
    + }
    +
    + _getShortcutsHelpStumpCode() {
    + let lastCat = ""
    + const app = this.getRootNode()
    + const shortcutRows = app
    + .getKeyboardShortcuts()
    + .map((shortcut) => {
    + const category = shortcut.getCategory()
    + let cat = ""
    + if (category !== lastCat) {
    + cat = ` tr
    + td
    ${category}
    + class helpCategory
    + td
    + `
    + lastCat = category
    + }
    + const description = shortcut.getDescription()
    + return `${cat} tr
    + style ${description ? "" : "display: none;"}
    + td ${shortcut.getKeyCombo() || "-"}
    + td   
    + ${shortcut.isEnabled(app) ? "a" : "span"} ${description}
    + clickCommand ${shortcut.getFn()}`
    + })
    + .join("\n")
    + return `table
    + id shortcutsHelp
    + class helpSection
    + ${shortcutRows}`
    + }
    - const newName = await this.promptToMoveFile(tab.getFullTabFilePath(), suggestedNewFilename, isRenameOp)
    - if (!newName) return false
    - const tabIndex = tab.getIndex()
    - await this.closeTab(tab)
    - await this.openFullPathInNewTabAndFocus(newName, tabIndex)
    - this.renderApp()
    - }
    + getModalStumpCode() {
    + const app = this.getRootNode()
    + return `h4 About ${StudioConstants.productName}
    + p ${StudioConstants.productName} is ${StudioConstants.slogan}.
    + p
    + span ${StudioConstants.productName} is on
    + a GitHub
    + href ${StudioConstants.githubLink}
    + span and
    + a Reddit
    + href ${StudioConstants.subredditLink}
    + p Current working folder: ${app.getDefaultDisk().getPathBase()}
    + p Version ${app.getVersion()} ${app.constructor.name}
    + p
    + a Open Demo Page
    + id welcomePageButton
    + clickCommand openOhayoProgramCommand
    + value ohayo.ohayo
    + div Keyboard Shortcuts:
    + ${this._getShortcutsHelpStumpCode()}`
    + }
    + }
    - async showTabMoveFilePromptCommand(tabId, suggestedNewFilename) {
    - await this._showTabMoveFilePromptCommand(tabId, suggestedNewFilename)
    - }
    + window.HelpModal = HelpModal
    - async showTabRenameFilePromptCommand(tabId, suggestedNewFilename) {
    - await this._showTabMoveFilePromptCommand(tabId, suggestedNewFilename, true)
    - }
    + class TabMenuTreeComponent extends AbstractContextMenuTreeComponent {
    + getContextMenuBodyStumpCode() {
    + const tabId = this.getWord(1)
    + return `a Save File
    + clickCommand saveTabAndNotifyCommand
    + value ${tabId}
    + a Close File
    + clickCommand closeTabCommand
    + value ${tabId}
    + a Rename File
    + clickCommand showTabRenameFilePromptCommand
    + value ${tabId}
    + a Move File
    + clickCommand showTabMoveFilePromptCommand
    + value ${tabId}
    + a Clone File
    + clickCommand cloneTabCommand
    + value ${tabId}
    + a Delete File
    + clickCommand showDeleteFileConfirmDialogCommand
    + value ${tabId}
    + a Copy program as link
    + clickCommand copyTabDeepLinkCommand
    + value ${tabId}
    + a Log program stats
    + clickCommand printProgramStatsCommand
    + value ${tabId}
    + a Close all other files
    + clickCommand closeAllTabsExceptThisOneCommand
    + value ${tabId}`
    + }
    + }
    - async toggleOfflineModeCommand() {
    - this.willowBrowser.toggleOfflineMode()
    - }
    + class TabsTreeComponent extends AbstractTreeComponent {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, {
    + tab: TabTreeComponent,
    + })
    + }
    +
    + getOpenTabs() {
    + return this.getChildrenByNodeConstructor(TabTreeComponent)
    + }
    +
    + insertTab(url, tabIndex) {
    + return this.insertLine(`tab unmounted ${new FullDiskPath(url).toString()}`, tabIndex)
    + }
    +
    + toHakonCode() {
    + const theme = this.getTheme()
    + // todo: add comments to Hakon? So we can annotate why we have valignTop
    + const valignTop = "vertical-align top" // https://stackoverflow.com/questions/23529369/why-does-x-overflowhidden-cause-extra-space-below
    + // todo: make tab cell width dynamic? smaller as more tabs open?s
    +
    + return `.TabsTreeComponent
    + display inline-block
    + .TabStub
    + height 30px
    + display inline-block
    + max-width 150px
    + text-overflow ellipsis
    + white-space nowrap
    + ${valignTop}
    + overflow-x hidden
    + box-sizing border-box
    + position relative
    + font-size 13px
    + padding 0 15px
    + color ${theme.menuTreeComponentColor}
    + line-height 30px
    + border-right 1px solid rgba(0,0,0,.2)
    + &:hover
    + background rgba(0,0,0,.1)
    + &:active
    + background rgba(0,0,0,.2)
    + span
    + position absolute
    + top 10px
    + right 5px
    + display block
    + font-size 12px
    + line-height 10px
    + text-align center
    + opacity .25
    + &:hover
    + opacity 1
    + &.mountedTab
    + background rgba(0,0,0,.2)
    + border-bottom 0`
    + }
    + }
    - async sleepCommand(ms = 1000) {
    - return new Promise(resolve => setTimeout(resolve, ms))
    - }
    + class TabTreeComponent extends AbstractTreeComponent {
    + toStumpCode() {
    + const app = this.getRootNode()
    + const index = this.getIndex()
    + const fullPath = this.getFullTabFilePath()
    + const filename = this.getFileName()
    + const tabId = this._getUid()
    + const filenameWithoutExtension = jtree.Utils.removeFileExtension(filename)
    + return `a ${filenameWithoutExtension}
    + clickCommand mountTabCommand
    + collapse
    + value ${tabId}
    + title ${fullPath}
    + id tab${index}
    + class TabStub ${this.isMountedTab() ? "mountedTab" : ""}
    + span ▾
    + collapse
    + clickCommand openTabMenuCommand
    + value ${tabId}
    + class tabDropDownButton`
    + }
    - async toggleHelpCommand() {
    - this.toggleAndRender(StudioConstants.helpModal)
    - }
    + toHakonCode() {
    + return `.TabStub
    + .tabDropDownButton
    + opacity 0
    + &:hover
    + .tabDropDownButton
    + cursor pointer
    + opacity 1
    + .TabStub.mountedTab
    + .tabDropDownButton
    + opacity 1`
    + }
    +
    + async openTabMenuCommand(tabId) {
    + this.getRootNode().toggleAndRender(`${StudioConstants.tabMenu} ${tabId}`)
    + }
    +
    + getDeepLink() {
    + const obj = {}
    + obj[StudioConstants.deepLinks.filename] = this.getFileName()
    + return this.getRootNode().getWillowBrowser().toPrettyDeepLink(this.getTabProgram().childrenToString(), obj)
    + }
    +
    + autosaveAndRender() {
    + const savingPromise = this.autosaveTab()
    + this.getRootNode().renderApp()
    + return savingPromise
    + }
    +
    + async autosaveAndReloadWith(str) {
    + this.getTabProgram().setChildren(str)
    + await this.autosaveTab()
    + this.getTabWall().unmount() //ugly!
    + await this._initProgramRenderAndRun(str)
    + this.getRootNode().renderApp()
    + }
    +
    + async _initProgramRenderAndRun(source, shouldMount) {
    + this._program = new ohayoNode(source)
    + this._program.saveVersion()
    + this._program.setTab(this)
    + const app = this.getRootNode()
    +
    + if (shouldMount) app.setMountedTab(this)
    +
    + app.renderApp()
    + await this._program.loadAndIncrementalRender()
    + return this
    + }
    +
    + async reloadFromDisk() {
    + const source = await this.getRootNode().readFile(this.getFullTabFilePath())
    + return this.autosaveAndReloadWith(source)
    + }
    +
    + async _fetchTabInitProgramRenderAndRun(shouldMount) {
    + const source = await this.getRootNode().readFile(this.getFullTabFilePath())
    + const res = await this._initProgramRenderAndRun(source, shouldMount)
    + return res
    + }
    +
    + async autosaveTab() {
    + this.getTabProgram().saveVersion()
    + const app = this.getRootNode()
    + if (!app.isAutoSaveEnabled()) return undefined
    +
    + await this.forceSaveToFile()
    + this.addStumpCodeMessageToLog(`div Saved ${this.getFileName()}
    + title Saved ${this.getFullTabFilePath()}`)
    + }
    +
    + forceSaveToFile() {
    + const newVersion = this.getTabProgram().toString()
    + return this.getRootNode().writeFile(this.getFullTabFilePath(), newVersion)
    + }
    +
    + getFullTabFilePath() {
    + return this.getWordsFrom(2).join(" ")
    + }
    +
    + getFileName() {
    + return jtree.Utils.getFileName(this.getFullTabFilePath())
    + }
    +
    + getTabWall() {
    + return this.getRootNode().getAppWall()
    + }
    +
    + isMountedTab() {
    + return this.getWord(1) === "mounted"
    + }
    +
    + markAsUnmounted() {
    + this.setWord(1, "unmounted")
    + return this
    + }
    +
    + markAsMounted() {
    + this.setWord(1, "mounted")
    + return this
    + }
    +
    + async appendFromPaste(pastedText) {
    + const tabProgram = this.getTabProgram()
    + const newNodes = tabProgram.concat(pastedText)
    + const newTiles = newNodes.filter((tile) => tile.doesExtend && tile.doesExtend(OhayoConstants.abstractTileTreeComponentNode))
    + this.addStumpCodeMessageToLog(`div Pasted ${newTiles.length} nodes`)
    + await this.autosaveTab()
    + tabProgram.clearSelection()
    + this.getTabWall().unmount()
    +
    + // todo: catch if a tile throws so that we still render the terminal.
    + await tabProgram.loadAndIncrementalRender()
    + newTiles.forEach((tile) => tile.selectTile())
    + }
    +
    + getTabProgram() {
    + return this._program
    + }
    +
    + async unlinkTab() {
    + return this.getRootNode().unlinkFile(this.getFullTabFilePath())
    + }
    + }
    - async closeMountedProgramCommand() {
    - this.closeTab(this.mountedTab)
    - this.renderApp()
    - }
    + window.TabsTreeComponent = TabsTreeComponent
    - fetchAndReloadFocusedTabCommand() {
    - return this.mountedTab.reloadFromDisk()
    - }
    + window.TabMenuTreeComponent = TabMenuTreeComponent
    - async selectAllTilesCommand() {
    - // todo: bug. they are not showing selected state.
    - this.mountedProgram.getTiles().forEach(tile => tile.selectTile())
    - }
    + class LogoTreeComponent extends AbstractTreeComponent {
    + toStumpCode() {
    + return `a help
    + clickCommand toggleHelpCommand
    + class LogoTreeComponent`
    + }
    + }
    - async clearSelectionCommand() {
    - this.addToCommandLog("app clearSelectionCommand") // todo: what is this?
    - this.mountedProgram.clearSelection()
    - }
    + class NewButtonTreeComponent extends AbstractTreeComponent {
    + toStumpCode() {
    + return `a  +
    + id newButton
    + class NewButtonTreeComponent
    + clickCommand createNewBlankProgramCommand
    + value untitled.ohayo`
    + }
    + }
    - async deleteSelectionCommand() {
    - this._deleteSelection()
    - await this.mountedProgram.getTab().autosaveAndRender()
    - // Todo: need to reposition all tiles if not using a custom layout
    - // todo: makes me think we should put css top/left/width/height separately from css and stump (so mount 3 things)
    - }
    + class MenuTreeComponent extends AbstractTreeComponent {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, {
    + logo: LogoTreeComponent,
    + tabs: TabsTreeComponent,
    + newButton: NewButtonTreeComponent,
    + })
    + }
    +
    + toggleVisibility() {
    + this.setWord(1, this.isVisible() ? "hidden" : "visible")
    + }
    +
    + isVisible() {
    + return this.getWord(1) === "visible"
    + }
    +
    + toHakonCode() {
    + const theme = this.getTheme()
    + const display = this.isVisible() ? "flex" : "none"
    + return `.MenuTreeComponent
    + ${theme.disableTextSelect(1)}
    + font-size 14px
    + padding-left 5px
    + box-sizing border-box
    + overflow-x scroll
    + right 0
    + left 0
    + position relative
    + height 30px
    + z-index 92
    + white-space nowrap
    + background ${theme.menuBackground}
    + display ${display}
    + .LogoTreeComponent,.NewButtonTreeComponent
    + padding-right 5px
    + line-height 30px
    + display inline-block
    + color ${theme.menuTreeComponentColor}`
    + }
    + }
    - _deleteSelection() {
    - const tiles = this.mountedProgram.getSelectedNodes()
    - if (!tiles.length) return undefined
    - tiles.forEach(tile => {
    - // New behavior is: shift children left 1. Dont delete them along with parent.
    - tile
    - .filter(tile => tile.doesExtend(OhayoConstants.abstractTileTreeComponentNode) && !tile.isSelected())
    - .forEach(child => {
    - child.unmount()
    - child.shiftLeft()
    - })
    - tile.unmountAndDestroy()
    - })
    - }
    + window.MenuTreeComponent = MenuTreeComponent
    - async duplicateSelectionCommand() {
    - const newTiles = this.mountedProgram.getSelectedNodes().map(tile => tile.duplicate())
    - await this.renderApp()
    - this.mountedProgram.clearSelection()
    - newTiles.forEach(tile => tile.selectTile())
    - await this.mountedProgram.getTab().autosaveAndRender()
    - }
    + class TileMenuTreeComponent extends AbstractContextMenuTreeComponent {
    + toHakonCode() {
    + const theme = this.getTheme()
    + return `.TileMenuTreeComponent
    + background ${theme.contextMenuBackground}
    + border 1px solid ${theme.lineColor}
    + font-size 12px
    + position absolute
    + padding 8px
    + z-index 991
    + min-width 300px
    + top 100%
    + right 0
    + .TileCommandsDropDown
    + a
    + display block
    + cursor pointer
    + .TableInspection
    + margin-top 5px
    + border 1px solid ${theme.lineColor}
    + td
    + padding 2px 8px
    + text-align left
    + tr:nth-child(odd)
    + background-color ${theme.veryLightGrey}
    + svg
    + fill ${theme.greyish}
    + padding 1px 3px 3px 3px
    + &:hover
    + fill ${theme.foregroundColor}`
    + }
    +
    + getTargetTile() {
    + return this.getRootNode().getTargetTile()
    + }
    +
    + createProgramFromFocusedTileExampleCommand(uno, dos) {
    + return this.getTargetTile().createProgramFromTileExampleCommand(uno, dos)
    + }
    +
    + cloneFocusedTileCommand(uno, dos) {
    + return this.getTargetTile().cloneTileCommand(uno, dos)
    + }
    + destroyFocusedTileCommand(uno, dos) {
    + return this.getTargetTile().removeTileCommand(uno, dos)
    + }
    + inspectFocusedTileCommand(uno, dos) {
    + return this.getTargetTile().inspectTileCommand(uno, dos)
    + }
    + changeFocusedTileTypeCommand(uno, dos) {
    + return this.getTargetTile().changeTileTypeCommand(uno, dos)
    + }
    + changeFocusedTileParentCommand(uno, dos) {
    + return this.getTargetTile().changeParentCommand(uno, dos)
    + }
    + changeFocusedTileContentAndRenderCommand(uno, dos) {
    + return this.getTargetTile().changeTileContentAndRenderCommand(uno, dos)
    + }
    +
    + toStumpCode() {
    + const tile = this.getTargetTile()
    + const suggestions = this._getSuggestionsStumpCode()
    + const exampleTile = tile.getExampleTemplate()
    + let exampleTileButton = ""
    + if (exampleTile) {
    + exampleTileButton = `span ${Icons("function", 20)}
    + title See an example program with '${tile.getFirstWord()}'
    + class createProgramFromFocusedTileExampleButton
    + clickCommand createProgramFromFocusedTileExampleCommand`
    + }
    - async showDeleteFileConfirmDialogCommand(tabId) {
    - const tab = this._getTabByIdOrMountedTab(tabId)
    - const filename = tab.getFileName()
    - // todo: make this an undo operation. on web should be easyish. on desktop via move to trash.
    - const result = await this.willowBrowser.confirmThen(`Are you sure you want to delete ${filename}?`)
    - return result ? this.deleteFocusedTabCommand() : undefined
    - }
    + const links = `a Reload
    + clickCommand fetchAndReloadFocusedTabCommand
    + a Copy tile with inputs
    + tabindex -1
    + clickCommand copyTargetTileCommand
    + a Copy data as tree
    + clickCommand copyTargetTileDataAsTreeCommand
    + a Copy data as javascript
    + clickCommand copyTargetTileDataAsJavascriptCommand
    + a Copy data as tsv
    + clickCommand copyTargetTileDataCommand
    + value \t
    + a Copy data as csv
    + clickCommand copyTargetTileDataCommand
    + value ,
    + a Export data to csv file
    + clickCommand exportTargetTileDataCommand
    + a Export data to tree file
    + clickCommand exportTargetTileDataCommand
    + value tree`
    - async deleteFocusedTabCommand() {
    - const tab = this.mountedTab
    - await tab.unlinkTab()
    + return new jtree.TreeNode(`div
    + class TileMenuTreeComponent
    + span ${Icons("copy", 20)}
    + title Duplicate Tile
    + clickCommand cloneFocusedTileCommand
    + span ${Icons("trash", 20)}
    + title Delete Tile
    + clickCommand destroyFocusedTileCommand
    + span ${Icons("inspector", 20)}
    + title Debug Tile
    + clickCommand inspectFocusedTileCommand
    + {exampleTileButton}
    + div
    + class TileCommandsDropDown
    + {links}`).templateToString({ exampleTileButton, links })
    + }
    - this.closeTab(tab)
    - this.renderApp()
    - }
    + _getSuggestionsStumpCode() {
    + //return `div Add Suggested:`
    + return "" //todo:
    + }
    + }
    - async mountPreviousTabCommand() {
    - this.mountPreviousTab()
    - }
    + window.TileMenuTreeComponent = TileMenuTreeComponent
    - async mountNextTabCommand() {
    - this.mountNextTab()
    - }
    + const Version = "20.1.0"
    + if (typeof exports !== "undefined") module.exports = Version
    - async closeAllTabsCommand() {
    - // todo: confirm before closing if unsaved changes?
    - this._getTabsNode()
    - .getOpenTabs()
    - .forEach(tab => {
    - this.closeTab(tab)
    - })
    - this.renderApp()
    - }
    + class WallTreeComponent extends AbstractTreeComponent {
    + // pin?
    + // duplicate?
    + // reload?
    + toHakonCode() {
    + const theme = this.getTheme()
    + const gutterWidth = this._gutterWidth
    + return `.WallTreeComponent
    + background-color ${theme.wallBackground}
    + background-image ${theme.wallBackgroundImage || "none"}
    + width calc(100% - ${gutterWidth}px)
    + left ${gutterWidth}px
    + display block
    + position relative
    + height 100%
    + overflow scroll
    + .insertChildTileButton
    + text-align center
    + font-size 28px
    + font-weight bold
    + opacity .9
    + width 50px
    + margin auto
    + &:hover
    + opacity 1
    + cursor pointer
    - async closeAllTabsExceptThisOneCommand(tabId) {
    - const keepTabOpen = this._getTabByIdOrMountedTab(tabId)
    - // todo: confirm before closing if unsaved changes?
    - this._getTabsNode()
    - .getOpenTabs()
    - .forEach(tab => {
    - if (tab !== keepTabOpen) this.closeTab(tab)
    - })
    - this.renderApp()
    - }
    + .${OhayoConstants.selectedClass}
    + outline 3px solid ${theme.selectedOutline}`
    + }
    - async toggleFullScreenCommand() {
    - this.willowBrowser.toggleFullScreen()
    - }
    + get _gutterWidth() {
    + const value = this.getWord(1)
    + return value === undefined ? this.getParent().getGutterWidth() : value
    + }
    - toggleMenuCommand() {
    - const menu = this.getMenuTreeComponent()
    - menu.toggleVisibility()
    - this.getPanel().setMenuHeight(menu.isVisible() ? 30 : 0)
    - this.renderApp()
    - }
    + setGutterWidth(newWidth) {
    + this.setWord(1, newWidth)
    + return this
    + }
    - // TODO: make it slidable.?
    - async toggleGutterWidthCommand() {
    - this.getPanel().toggleGutterWidth()
    - this.renderApp()
    - }
    + _getChildTreeComponents() {
    + const tilesProgram = this.getRootNode().getMountedTilesProgram()
    + return tilesProgram ? tilesProgram.getTiles() : []
    + }
    - async toggleGutterCommand() {
    - this.getPanel().toggleGutter()
    - this.renderApp()
    - }
    + treeComponentDidMount() {
    + this.treeComponentDidUpdate()
    + }
    - async selectNextTileCommand() {
    - this._selectTileByDelta(1)
    - }
    + toStumpCode() {
    + return `div
    + class WallTreeComponent
    + div +
    + class insertChildTileButton
    + clickCommand insertChildPickerTileCommand`
    + }
    - _selectTileByDelta(delta) {
    - const program = this.mountedProgram
    - const arr = program.getTiles()
    - if (arr.length < 2) return true
    - let currentIndex = arr.indexOf(program.getSelectedNodes()[0])
    - const potentialNewIndex = currentIndex + delta
    - program.clearSelection()
    - arr[potentialNewIndex > arr.length - 1 ? 0 : potentialNewIndex === -1 ? arr.length - 1 : potentialNewIndex].selectTile()
    - }
    + _getSelectedTileStumpNodes() {
    + return this.getRootNode().getWillowBrowser().getBodyStumpNode().findStumpNodesWithClass(OhayoConstants.selectedClass) // todo: also filter by .abstractTileTreeComponentNode?
    + }
    + }
    - async selectFirstTileCommand() {
    - const firstTile = this.mountedProgram.getTiles()[0]
    - firstTile && firstTile.selectTile()
    - }
    + window.WallTreeComponent = WallTreeComponent
    - async selectPreviousTileCommand() {
    - this._selectTileByDelta(-1)
    - }
    + class PanelTreeComponent extends AbstractTreeComponent {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, {
    + gutter: GutterTreeComponent,
    + wall: WallTreeComponent,
    + })
    + }
    +
    + getGutter() {
    + return this.getNode(StudioConstants.gutter)
    + }
    +
    + get _menuHeight() {
    + return this.getWord(2)
    + }
    +
    + setMenuHeight(value) {
    + this.setWord(2, value)
    + }
    +
    + toHakonCode() {
    + return `.PanelTreeComponent
    + position relative
    + left 0
    + right 0
    + bottom 0
    + height calc(100% - ${this._menuHeight}px)`
    + }
    - async createNewSourceCodeVisualizationProgramCommand() {
    - // todo: make this create in memory? but then a refresh will end it.
    - const sourceCode = this.mountedProgram.childrenToString()
    - const template = OhayoCodeEditorTemplate(sourceCode, this.mountedTab.getFileName(), StudioConstants.ohayoExtension.substr(1))
    - const tab = await this._createAndOpen(template, this.mountedTab.getFileName() + "-source-code-vis.ohayo")
    + getGutterWidth() {
    + return parseInt(this.getWord(1))
    + }
    - tab.addStumpCodeMessageToLog(`div Created '${tab.getFullTabFilePath()}'`)
    - }
    + setGutterWidth(newWidth) {
    + this.setWord(1, newWidth)
    + this.getWall().setGutterWidth(newWidth)
    + this.getGutter().setGutterWidth(newWidth)
    + return this
    + }
    - async createMiniMapCommand() {
    - // todo: make this create in memory? but then a refresh will end it.
    - const tab = await this._createAndOpen(MiniTemplate, "myPrograms" + StudioConstants.ohayoExtension)
    + toggleGutterWidth() {
    + const newWidth = this.getGutterWidth() === 50 ? 400 : 50
    + this.setGutterWidth(newWidth)
    + return this
    + }
    - tab.addStumpCodeMessageToLog(`div Created '${tab.getFullTabFilePath()}'`)
    - }
    + toggleGutter() {
    + const newWidth = this.getGutterWidth() === 0 ? 400 : 0
    + this.setGutterWidth(newWidth)
    + return this
    + }
    - async clearTabMessagesCommand() {
    - await this.mountedTab.clearMessageBufferCommand()
    + getWall() {
    + return this.getNode(StudioConstants.wall)
    + }
    - this.renderApp()
    - }
    + removeWall() {
    + const wall = this.getWall()
    + if (wall) wall.unmountAndDestroy()
    + }
    - async undoFocusedProgramCommand() {
    - return this._undoOrRedo()
    - }
    + // todo: remove?
    + addWall() {
    + this.removeWall()
    + return this.appendLine(StudioConstants.wall)
    + }
    + }
    - async redoFocusedProgramCommand() {
    - return this._undoOrRedo(false)
    - }
    + window.PanelTreeComponent = PanelTreeComponent
    - async _undoOrRedo(undo = true) {
    - this.mountedTab.getTabWall().unmount()
    - undo ? this.mountedProgram.undo() : this.mountedProgram.redo()
    - await this.mountedProgram.loadAndIncrementalRender()
    - }
    + class GlobalShortcutNode extends jtree.TreeNode {
    + getKeyCombo() {
    + return this.getWord(3)
    + }
    - async closeModalCommand() {
    - this.closeModal()
    - }
    + getFn() {
    + return this.getWord(2)
    + }
    - async clearStoreCommand() {
    - // todo: only clear this app values?
    - return this.getStore().disabled ? undefined : this.getStore().clearAll()
    - }
    + getCategory() {
    + return this.getWord(1)
    + }
    - async copySelectionCommand(evt) {
    - if (!this.mountedProgram) return true
    + getDescription() {
    + return this.getWordsFrom(4).join(" ")
    + }
    - const str = this._copySelection(evt)
    - if (!str) return undefined
    - this.mountedProgram.getRootNode().addStumpCodeMessageToLog(`div Items copied`)
    - return str
    - }
    + isEnabled() {
    + return true
    + }
    - async cutSelectionCommand(evt) {
    - const str = this._copySelection(evt)
    - if (!str) return undefined
    - this._deleteSelection()
    - this.mountedProgram.getRootNode().addStumpCodeMessageToLog(`div Items cut`)
    - await this.mountedProgram.getTab().autosaveAndRender()
    - }
    + execute(app) {
    + if (!this.isEnabled(app)) return false
    + const fn = this.getFn()
    + app.addToCommandLog(fn)
    + app[fn]()
    + }
    + }
    - _copySelection(evt) {
    - const willowBrowser = this.getWillowBrowser()
    - if (this.terminalHasFocus() || willowBrowser.someInputHasFocus()) return ""
    - // copy selected tiles
    - const str = this.mountedProgram.selectionToString()
    - if (!str) return ""
    - willowBrowser.setCopyData(evt, str)
    - return str
    - }
    + class MountedShortcutNode extends GlobalShortcutNode {
    + isEnabled(app) {
    + return !!app.getMountedTab()
    + }
    + }
    - async echoCommand(...words) {
    - this.addStumpCodeMessageToLog(`div ${words.join(" ")}`)
    - }
    + class DrumsProgram extends jtree.TreeNode {
    + createParser() {
    + return new jtree.TreeNode.Parser(undefined, {
    + panel: GlobalShortcutNode,
    + mounted: MountedShortcutNode,
    + })
    + }
    + }
    - async saveTabAndNotifyCommand(tabId) {
    - const tab = this._getTabByIdOrMountedTab(tabId)
    - await tab.forceSaveToFile()
    - tab.addStumpCodeMessageToLog(`div Saved ${tab.getFileName()}
    + class StudioApp extends AbstractTreeComponent {
    + treeComponentWillMount() {
    + this._startVisitCounter()
    + const state = this.getFromStore(StorageKeys.appState)
    + if (state) this.setChildren(state)
    +
    + this._restoreTabs()
    +
    + this._makeProgramLinksOpenImmediately()
    + this._makeDocumentCopyableAndCuttable()
    + this._bindKeyboardShortcuts()
    +
    + const willowDoc = this.getWillowBrowser()
    +
    + willowDoc.setResizeEndHandler((event) => this._onResizeEndEvent(event))
    + willowDoc.setPasteHandler((event) => this._onPasteEvent(event))
    + willowDoc.setLoadedDroppedFileHandler((files) => {
    + files.forEach((file) => this.createProgramFromFileCommand(file.filename, file.data))
    + }, "Drop to create a new program.")
    +
    + this._setErrorHandlers()
    + this.addStumpCodeMessageToLog(`div Ohayo!`)
    +
    + const deepLink = this._getDeepLink()
    + if (deepLink) this.createAndOpenNewProgramFromDeepLinkCommand(deepLink)
    + else if (this._getVisitCount() === 1) this.playFirstVisitCommand()
    + }
    +
    + _getDeepLink() {
    + if (this.isNodeJs()) return false
    + return window.location.href.includes(StudioConstants.deepLinks.filename) ? window.location.href : ""
    + }
    +
    + async _onPasteEvent(event) {
    + // Return true if worker is editing an input
    + if (this.terminalHasFocus() || this.getWillowBrowser().someInputHasFocus()) return true
    + if (event.clipboardData && event.clipboardData.getData) await this.pasteCommand(event.clipboardData.getData("text/plain"))
    + }
    +
    + _onResizeEndEvent(event) {
    + delete this._bodyShadowDimensionsCache
    + this.renderApp()
    + }
    +
    + _restoreTabs() {
    + this.getTabs().forEach(async (tab) => {
    + await tab._fetchTabInitProgramRenderAndRun(tab.isMountedTab())
    + this.renderApp()
    + })
    + }
    +
    + _getProjectRootDir() {
    + return this.isNodeJs() ? jtree.Utils.findProjectRoot(__dirname, "ohayo") : ""
    + }
    +
    + terminalHasFocus() {
    + const terminalNode = this.getTerminalNode()
    + return terminalNode && terminalNode.hasFocus()
    + }
    +
    + getTerminalNode() {
    + return this.getPanel().getNode(`${StudioConstants.gutter} ${StudioConstants.terminal}`)
    + }
    +
    + getConsoleNode() {
    + return this.getPanel().getNode(`${StudioConstants.gutter} ${StudioConstants.console}`)
    + }
    +
    + initLocalDataStorage(key, value) {
    + key = jtree.Utils.stringToPermalink(key)
    + key = this.getUnusedStoreKey(key)
    + this.getRootNode().storeValue(key, value)
    + return key
    + }
    +
    + getBodyShadowDimensions() {
    + if (!this._bodyShadowDimensionsCache) this._bodyShadowDimensionsCache = this._getBodyShadowDimensions()
    + return this._bodyShadowDimensionsCache
    + }
    +
    + _getBodyShadowDimensions() {
    + // depends on window.resize and whether gutter is open
    +
    + const bodyStumpNode = this.getWillowBrowser().getBodyStumpNode()
    + const bodyShadow = bodyStumpNode.getShadow()
    +
    + return {
    + width: bodyShadow.getShadowWidth(),
    + height: bodyShadow.getShadowHeight(),
    + }
    + }
    +
    + static getDefaultStartState() {
    + const defaultGutterWidth = 400
    + const menuHeight = 30
    + return `${StudioConstants.theme} ${ThemeTreeComponent.defaultTheme}
    + ${StudioConstants.menu} visible
    + logo
    + tabs
    + newButton
    + ${StudioConstants.panel} ${defaultGutterWidth} ${menuHeight}
    + ${StudioConstants.gutter} ${defaultGutterWidth}
    + ${StudioConstants.terminal}
    + ${StudioConstants.console}`
    + }
    +
    + saveAppState() {
    + this.storeValue(StorageKeys.appState, this.toString())
    + }
    +
    + resetAppState() {
    + this.removeValue(StorageKeys.appState)
    + return this
    + }
    +
    + executeCommandLine(args) {
    + this.addToCommandLog(args.join(" "))
    + return this[args[0]].apply(this, args.slice(1))
    + }
    +
    + getOhayoGrammarAsTree() {
    + if (!this._ohayoGrammarTree) this._ohayoGrammarTree = new ohayoNode().getHandGrammarProgram()
    + return this._ohayoGrammarTree
    + }
    +
    + getTargetTile() {
    + return this._targetTile
    + }
    +
    + setTargetTile(tile) {
    + this._targetTile = tile
    + return this
    + }
    +
    + getVersion() {
    + return Version
    + }
    +
    + getDefinitionLoadingPromiseMap() {
    + if (!this._loadingPromiseMap) this._loadingPromiseMap = new Map()
    + return this._loadingPromiseMap
    + }
    +
    + _startVisitCounter() {
    + let visitCount = this._getVisitCount()
    +
    + visitCount++
    + this.setVisitCount(visitCount)
    + }
    +
    + setVisitCount(visitCount) {
    + // exposed for unit testing
    + this.storeValue(StorageKeys.visitCount, visitCount)
    + }
    +
    + _getVisitCount() {
    + const visitCountStr = this.getFromStore(StorageKeys.visitCount)
    + return visitCountStr ? parseInt(visitCountStr) : 0
    + }
    +
    + createParser() {
    + const map = {}
    + map[StudioConstants.tabMenu] = TabMenuTreeComponent
    + map[StudioConstants.tileMenu] = TileMenuTreeComponent
    + map[StudioConstants.panel] = PanelTreeComponent
    + map[StudioConstants.menu] = MenuTreeComponent
    + map[StudioConstants.theme] = ThemeTreeComponent
    + map[StudioConstants.helpModal] = HelpModal
    + map["TreeComponentFrameworkDebuggerComponent"] = TreeComponentFrameworkDebuggerComponent
    +
    + return new jtree.TreeNode.Parser(jtree.TreeNode, map)
    + }
    +
    + toHakonCode() {
    + const theme = this.getTheme()
    + return `.StudioApp
    + height 100%
    + width 100%
    + .OhayoError
    + color ${theme.errorColor}`
    + }
    +
    + isConnectedToStudioServerApp() {
    + return typeof isConnectedToStudioServerApp !== "undefined"
    + }
    +
    + isUrlGetProxyAvailable() {
    + return this.isConnectedToStudioServerApp()
    + }
    +
    + goRed(err) {
    + const tab = this.getMountedTab()
    + const message = err ? err.reason || err : ""
    + if (tab) tab.addStumpErrorMessageToLog(`Error: ${message}.`)
    + else this.addStumpErrorMessageToLog(`Error on tab: ${tab ? tab.getFullTabFilePath() : ""}: ${message}`)
    + this.renderApp()
    + }
    +
    + _setErrorHandlers() {
    + const that = this
    + this.getWillowBrowser().setErrorHandler((message, file, line) => {
    + that.goRed(message)
    + console.error(message)
    + })
    + }
    +
    + closeModal() {
    + this.getOpenModals().forEach((node) => node.unmountAndDestroy())
    + }
    +
    + getOpenModals() {
    + return this.filter((node) => node instanceof AbstractModalTreeComponent)
    + }
    +
    + closeAllContextMenus() {
    + this.filter((node) => node instanceof AbstractContextMenuTreeComponent).forEach((node) => node.unmountAndDestroy())
    + }
    +
    + // todo: delete this
    + makeAllDirty() {
    + this.getTopDownArray()
    + .filter((child) => child instanceof AbstractTreeComponent)
    + .forEach((child) => {
    + child._setLastRenderedTime(0)
    + })
    + }
    +
    + renderApp() {
    + const report = this.renderAndGetRenderReport(this.getWillowBrowser().getBodyStumpNode())
    + // console.log(report.toString())
    + // console.log(this.toString())
    + }
    +
    + _appendTiles(line, children) {
    + return this.getNodeCursors().map((cursor) => cursor.appendLineAndChildren(line, children))
    + }
    +
    + getNodeCursors() {
    + const tilesProgram = this.getMountedTilesProgram()
    + const selectedNodes = tilesProgram.getSelectedNodes()
    + return selectedNodes.length ? selectedNodes : [tilesProgram]
    + }
    +
    + async _openOhayoProgram(name) {
    + const disk = this.getDefaultDisk()
    + const fullPath = disk.getPathBase() + name
    + const openTab = this.getOpenTabByFullFilePath(fullPath)
    +
    + if (openTab) {
    + this.setMountedTab(openTab)
    + this.getRootNode().renderApp()
    + return undefined
    + }
    +
    + const fullDiskFilePath = new FullDiskPath(fullPath)
    +
    + const result = await disk.exists(fullDiskFilePath.getFilePath())
    + if (result) return this.openFullPathInNewTabAndFocus(fullPath)
    +
    + return this._createAndOpen(new jtree.TreeNode(DemoTemplates).getNode(name).childrenToString(), name)
    + }
    +
    + async createFileOnDefaultDisk(filename, sourceStr) {
    + const disk = this.getDefaultDisk()
    + const permalink = jtree.Utils.stringToPermalink(filename)
    + const newName = await disk.getAvailablePermalink(permalink)
    +
    + await disk.writeFile(newName, sourceStr)
    + return disk.getDisplayName() + newName
    + }
    +
    + async _createAndOpen(sourceStr, filename, tabIndex) {
    + const newName = await this.createFileOnDefaultDisk(filename, sourceStr)
    + const res = await this.openFullPathInNewTabAndFocus(newName, tabIndex)
    + return res
    + }
    +
    + async _createAndOpenInBackgroundTab(sourceStr, filename) {
    + const newName = await this.createFileOnDefaultDisk(filename, sourceStr)
    + const tab = await this._openFullDiskFilePathInNewTab(newName)
    + return tab
    + }
    +
    + setMountedTab(tab) {
    + const currentTab = this._getMountedTab()
    + if (currentTab === tab) return this
    + else if (currentTab) {
    + currentTab.markAsUnmounted()
    + this.getPanel().removeWall()
    + }
    + this._focusedTab = tab
    + tab.markAsMounted()
    + // update terminal and console
    + this._setTerminalAndConsole(tab.getFullTabFilePath())
    +
    + this.getPanel().addWall()
    + this._updateLocationForRestoreOnRefresh()
    + return this
    + }
    +
    + _setTerminalAndConsole(fileName) {
    + const terminal = this.getTerminalNode()
    + if (terminal) terminal.setFile(fileName)
    + const consoleNode = this.getConsoleNode()
    + if (consoleNode) consoleNode.setFile(fileName)
    + }
    +
    + closeTab(tab) {
    + // todo: terminal and console on last tab close.
    + if (tab.isMountedTab()) {
    + const tabToMountNext = jtree.Utils.getNextOrPrevious(this.getTabs(), tab)
    + this.getPanel().removeWall()
    + tab.markAsUnmounted()
    + tab.unmountAndDestroy()
    + delete this._focusedTab
    + if (tabToMountNext) this.setMountedTab(tabToMountNext)
    + } else tab.unmountAndDestroy()
    +
    + if (!this.getTabs().length) this._setTerminalAndConsole()
    +
    + this._updateLocationForRestoreOnRefresh()
    + }
    +
    + mountPreviousTab() {
    + const tabs = this.getTabs()
    + const mountedTab = this._getMountedTab()
    + if (tabs.length < 2 || !mountedTab) return this
    + const tabIndex = tabs.indexOf(mountedTab)
    + return this._mountTabByIndex(tabIndex === 0 ? tabs.length - 1 : tabIndex - 1)
    + }
    +
    + mountNextTab() {
    + const tabs = this.getTabs()
    + const mountedTab = this._getMountedTab()
    + if (tabs.length < 2 || !mountedTab) return this
    + const tabIndex = tabs.indexOf(mountedTab)
    + return this._mountTabByIndex(tabIndex === tabs.length - 1 ? 0 : tabIndex + 1)
    + }
    +
    + getTabs() {
    + return this._getTabsNode().getOpenTabs()
    + }
    +
    + _updateLocationForRestoreOnRefresh() {
    + this.saveAppState()
    + }
    +
    + async getAlreadyOpenTabOrOpenFullFilePathInNewTab(filePath, andMount = false, tabIndex) {
    + const existingTab = this.getOpenTabByFullFilePath(new FullDiskPath(filePath).toString())
    + if (existingTab) {
    + if (andMount) {
    + this.setMountedTab(existingTab)
    + this.renderApp()
    + }
    + return existingTab
    + }
    +
    + const tab = this._getTabsNode().insertTab(new FullDiskPath(filePath).toString(), tabIndex)
    +
    + await tab._fetchTabInitProgramRenderAndRun(andMount)
    +
    + this.renderApp()
    + return tab
    + }
    +
    + getOpenTabByFullFilePath(fullPath) {
    + return this.getTabs().find((tab) => tab.getFullTabFilePath() === fullPath)
    + }
    +
    + getPanel() {
    + return this.getNode(StudioConstants.panel)
    + }
    +
    + getMountedTilesProgram() {
    + const mountedTab = this.getMountedTab()
    + return mountedTab && mountedTab.getTabProgram()
    + }
    +
    + getMenuTreeComponent() {
    + return this.getNode(StudioConstants.menu)
    + }
    +
    + async _openFullDiskFilePathInNewTab(fullDiskFilePath) {
    + const res = await this.getAlreadyOpenTabOrOpenFullFilePathInNewTab(new FullDiskPath(fullDiskFilePath).toString())
    + return res
    + }
    +
    + async openFullPathInNewTabAndFocus(fullDiskFilePath, tabIndex) {
    + const tab = await this.getAlreadyOpenTabOrOpenFullFilePathInNewTab(new FullDiskPath(fullDiskFilePath).toString(), true, tabIndex)
    + return tab
    + }
    +
    + isAutoSaveEnabled() {
    + return this.getFromStore(StorageKeys.autoSave) !== "false"
    + }
    +
    + getThemeName() {
    + return this.get(StudioConstants.theme)
    + }
    +
    + isGlassTheme() {
    + const name = this.getThemeName()
    + return name === ThemeTreeComponent.ThemeConstants.glass || name === ThemeTreeComponent.ThemeConstants.clearGlass
    + }
    +
    + getTheme() {
    + return ThemeTreeComponent.Themes[this.getThemeName()] || ThemeTreeComponent.Themes.glass
    + }
    +
    + _toggleTheme() {
    + const newThemeName = jtree.Utils.toggle(this.getThemeName(), Object.keys(ThemeTreeComponent.Themes))
    + this.addStumpCodeMessageToLog(`div Switched to ${newThemeName} theme`)
    + this.set(StudioConstants.theme, newThemeName)
    + this.saveAppState()
    + this.makeAllDirty() // todo:remove
    + this.renderApp()
    + }
    +
    + async promptToMoveFile(existingFullDiskFilePath, suggestedNewFilename, isRenameOp = false) {
    + const path = new FullDiskPath(existingFullDiskFilePath)
    + const suggestedFullDiskFilePath = suggestedNewFilename ? path.getWithoutFilename() + suggestedNewFilename : existingFullDiskFilePath
    +
    + let newFullDiskFilePath
    +
    + if (isRenameOp) {
    + const newNameOnly = await this.getWillowBrowser().promptThen("Enter new name for file", suggestedNewFilename || path.getFilename())
    + newFullDiskFilePath = newNameOnly ? path.getWithoutFilename() + newNameOnly : newNameOnly
    + } else newFullDiskFilePath = await this.getWillowBrowser().promptThen("Enter new name for file", suggestedFullDiskFilePath || existingFullDiskFilePath)
    +
    + if (!newFullDiskFilePath || newFullDiskFilePath === existingFullDiskFilePath) return undefined
    +
    + newFullDiskFilePath = new FullDiskPath(newFullDiskFilePath)
    +
    + newFullDiskFilePath = newFullDiskFilePath.getWithoutFilename() + jtree.Utils.stringToPermalink(newFullDiskFilePath.getFilename())
    + if (!newFullDiskFilePath) return undefined
    + const resultingName = await this.moveFileCommand(existingFullDiskFilePath, newFullDiskFilePath)
    +
    + this.addStumpCodeMessageToLog(`div Moved`)
    + return resultingName
    + }
    +
    + getKeyboardShortcuts() {
    + if (!this._shortcuts)
    + this._shortcuts = new DrumsProgram(
    + typeof StudioDrums === "undefined" ? jtree.TreeNode.fromDisk(this._getProjectRootDir() + "studio/treeComponents/Studio.drums") : new jtree.TreeNode(StudioDrums)
    + )
    + return this._shortcuts
    + }
    +
    + _getMousetrap() {
    + return this.getWillowBrowser().getMousetrap()
    + }
    +
    + _bindKeyboardShortcuts() {
    + const mouseTrap = this._getMousetrap()
    + const willowBrowser = this.getWillowBrowser()
    +
    + mouseTrap._originalStopCallback = mouseTrap.prototype.stopCallback
    + mouseTrap.prototype.stopCallback = function (evt, element, shortcut) {
    + const stumpNode = willowBrowser.getStumpNodeFromElement(element)
    + if (stumpNode && shortcut === "command+s" && stumpNode.stumpNodeHasClass("savable")) {
    + stumpNode.getShadow().triggerShadowEvent("change")
    + evt.preventDefault()
    + return true
    + }
    + if (mouseTrap._pause) return true
    + return mouseTrap._originalStopCallback.call(this, evt, element)
    + }
    +
    + const app = this
    +
    + this.getKeyboardShortcuts().forEach((shortcut) => {
    + const keyCombo = shortcut.getKeyCombo()
    + if (!keyCombo) return true
    + mouseTrap.bind(keyCombo, function (evt) {
    + shortcut.execute(app)
    + // todo: handle the below when we need to
    + if (evt.preventDefault) evt.preventDefault()
    + return false
    + })
    + })
    + }
    +
    + pauseShortcutListener() {
    + this._getMousetrap()._pause = true
    + }
    +
    + resumeShortcutListener() {
    + this._getMousetrap()._pause = false
    + }
    +
    + getStore() {
    + return this.getWillowBrowser().getStore()
    + }
    +
    + getUnusedStoreKey(key) {
    + return jtree.Utils.getAvailablePermalink(key, (key) => this.getFromStore(key) !== undefined)
    + }
    +
    + getStoreKeys() {
    + const prefix = this.constructor.name
    + const prefixLength = prefix.length
    + const keys = []
    + this.getStore().each((value, key) => {
    + if (key.startsWith(prefix)) keys.push(key.substr(prefixLength))
    + })
    + return keys
    + }
    +
    + dumpStore() {
    + this.getStore().each((value, key) => {
    + console.log(key)
    + })
    + return this
    + }
    +
    + getStoreDiskUsage() {
    + // todo: is there a way to do this?
    + let bytes = 0
    + this.getStore().each((value, key) => {
    + bytes += value.toString().length + key.toString().length
    + })
    + return bytes / 5000000
    + }
    +
    + getFromStore(key) {
    + return this.getStore().get(this.constructor.name + key.toString())
    + }
    +
    + storeValue(key, value) {
    + // todo: handle quotaexceeded
    + return this.getStore().set(this.constructor.name + key.toString(), value)
    + }
    +
    + removeValue(key) {
    + return this.getStore().remove(this.constructor.name + key.toString())
    + }
    +
    + _makeDocumentCopyableAndCuttable() {
    + const app = this
    + this.getWillowBrowser()
    + .setCopyHandler((evt) => app.copySelectionCommand(evt))
    + .setCutHandler((evt) => app.cutSelectionCommand(evt))
    + }
    +
    + _handleLinkClick(stumpNode, evt) {
    + if (!stumpNode) return undefined
    + const link = stumpNode.getStumpNodeAttr("href")
    + if (!link || stumpNode.getStumpNodeAttr("target")) return undefined
    + evt.preventDefault()
    + if (this.getWillowBrowser().isExternalLink(link)) {
    + this.openExternalLink(link)
    + return false
    + }
    + }
    +
    + openExternalLink(link) {
    + this.getWillowBrowser().openUrl(link)
    + }
    +
    + getAppWall() {
    + return this.getPanel().getWall()
    + }
    +
    + // for tests
    + getRenderedTilesDiagnostic() {
    + return this.getMountedTilesProgram()
    + .getTiles()
    + .filter((tile) => tile.isVisible() && tile.isMounted())
    + }
    +
    + // for tests
    + getMountedTilesDiagnostic() {
    + return jtree.Utils.flatten(
    + this._getTabsNode()
    + .getOpenTabs()
    + .map((tab) =>
    + tab
    + .getTabProgram()
    + .getTiles()
    + .filter((tile) => tile.isMounted())
    + )
    + )
    + }
    +
    + async _createProgramFromPaste(pastedText) {
    + await this._createAndOpen(pastedText, `untitled${StudioConstants.ohayoExtension}`) // todo: guess language!
    + }
    +
    + // for tests and debugging
    + // todo: only relevant for OhayoTiles with tables
    + dumpTablesDiagnostic() {
    + return this.getRenderedTilesDiagnostic().forEach((tile) => {
    + console.log(tile.getLine())
    + console.log(tile.getOutputOrInputTable())
    + })
    + }
    +
    + getDisks() {
    + if (!this._disks) this._mountDisks()
    + return this._disks
    + }
    +
    + writeFile(fullDiskFilePath, newVersion) {
    + return new FileHandle(fullDiskFilePath, this).writeFile(newVersion)
    + }
    +
    + readFile(fullDiskFilePath) {
    + return new FileHandle(fullDiskFilePath, this).readFile()
    + }
    +
    + unlinkFile(fullDiskFilePath) {
    + return new FileHandle(fullDiskFilePath, this).unlinkFile()
    + }
    +
    + async moveFile(existingFullDiskFilePath, newFullDiskFilePath) {
    + const content = await this.readFile(existingFullDiskFilePath)
    + // Todo: check to make sure we arent overwriting
    + // Todo: check to make sure things worked before unlinking.
    + await this.writeFile(newFullDiskFilePath, content)
    + await this.unlinkFile(existingFullDiskFilePath)
    + return newFullDiskFilePath
    + }
    +
    + _mountDisks() {
    + this._disks = {}
    + const localDisk = new LocalStorageDisk(this)
    + this._defaultDisk = localDisk
    + this._disks[localDisk.getDisplayName()] = localDisk
    + const addServerDisk = this.isNodeJs() ? false : this.isConnectedToStudioServerApp()
    + let serverDisk
    + if (addServerDisk) {
    + serverDisk = new ServerStorageDisk(this)
    + this._disks[serverDisk.getDisplayName()] = serverDisk
    + }
    +
    + const cwd = typeof DefaultServerCurrentWorkingDirectory === "undefined" ? "/" : DefaultServerCurrentWorkingDirectory
    + const workingFolder = this.getFromStore(StorageKeys.workingFolderFullDiskFolderPath)
    + if (workingFolder) this.setWorkingFolder(workingFolder)
    + else this.setWorkingFolder(addServerDisk ? serverDisk.getDisplayName() + cwd : localDisk.getDisplayName() + "/")
    + }
    +
    + setWorkingFolder(newWorkingFolder) {
    + const path = new FullFolderPath(newWorkingFolder)
    + this.setDefaultDisk(path.getDiskId())
    + this.getDefaultDisk().setFolder(path.getFolderPath())
    +
    + this.storeValue(StorageKeys.workingFolderFullDiskFolderPath, newWorkingFolder)
    + }
    +
    + getDefaultDisk() {
    + const disks = this.getDisks()
    + return this._defaultDisk
    + }
    +
    + setDefaultDisk(id) {
    + if (!this._disks[id]) throw new Error(`Disk ${id} not found.`)
    + this._defaultDisk = this._disks[id]
    + return this
    + }
    +
    + // todo: remove this crap?
    + _makeProgramLinksOpenImmediately() {
    + const app = this
    + const willowBrowser = this.getWillowBrowser()
    + willowBrowser
    + .getBodyStumpNode()
    + .getShadow()
    + .onShadowEvent("click", "a", function (evt) {
    + app._handleLinkClick(willowBrowser.getStumpNodeFromElement(this), evt)
    + })
    + }
    +
    + _onCommandWillRun() {
    + this.closeAllContextMenus() // todo: move these to a body handler?
    + this.closeAllDropDownMenusCommand()
    + }
    +
    + async _executeCommandByStumpNodeChild(commandName, stumpNodeChild) {
    + const willowBrowser = this.getWillowBrowser()
    + const stumpNode = willowBrowser.getBodyStumpNode().findStumpNodeByChild(stumpNodeChild)
    + await this._executeCommandOnStumpNode(stumpNode, stumpNode.getStumpNodeAttr(commandName))
    + }
    +
    + async _executeCommandByStumpNodeString(commandName, str) {
    + const willowBrowser = this.getWillowBrowser()
    + const stumpNode = willowBrowser.getBodyStumpNode().findStumpNodeByChildString(str)
    + await this._executeCommandOnStumpNode(stumpNode, stumpNode.getStumpNodeAttr(commandName))
    + }
    +
    + async playFirstVisitCommand() {
    + // await this.openOhayoProgramCommand("faq.ohayo")
    + // todo: make this create in memory?
    + await this.openOhayoProgramCommand(StudioConstants.productName + StudioConstants.ohayoExtension)
    + }
    +
    + copyTargetTileCommand(uno, dos) {
    + return this.getTargetTile().copyTileCommand(uno, dos)
    + }
    +
    + copyTargetTileDataAsTreeCommand(uno, dos) {
    + return this.getTargetTile().copyDataAsTreeCommand(uno, dos)
    + }
    +
    + copyTargetTileDataAsJavascriptCommand(uno, dos) {
    + return this.getTargetTile().copyDataAsJavascriptCommand(uno, dos)
    + }
    +
    + copyTargetTileDataCommand(uno, dos) {
    + return this.getTargetTile().copyDataCommand(uno, dos)
    + }
    +
    + exportTargetTileDataCommand(uno, dos) {
    + return this.getTargetTile().exportTileDataCommand(uno, dos)
    + }
    +
    + async cellCheckProgramCommand() {
    + const program = this.mountedTab.getTabProgram()
    + const errors = program.getAllErrors().map((err) => err.getMessage())
    + if (errors.length)
    + this.mountedTab.addStumpCodeMessageToLog(
    + `div ${errors.length} errors in ${this.mountedTab.getFileName()}
    + class OhayoError
    + div - ${errors.join("\n div - ")}`
    + )
    + else this.mountedTab.addStumpCodeMessageToLog(`div 0 errors in ${this.mountedTab.getFileName()}`)
    + this.renderApp()
    + }
    +
    + async printProgramStatsCommand(tabId) {
    + const tab = this._getTabByIdOrMountedTab(tabId)
    + const stats = new jtree.TreeNode(tab.getTabProgram().toRunTimeStats()).toString()
    + tab.logMessageText(stats)
    + this.renderApp()
    + }
    +
    + createProgramFromFileCommand(filename, data) {
    + // todo: how do we handle multi-table-csv?
    + // there are multiple types of CSVs.
    + const extension = jtree.Utils.getFileExtension(filename)
    + if (extension === StudioConstants.ohayoExtension) return this._createAndOpen(data, filename)
    +
    + const templateFn = OhayoTemplates[extension]
    + const program = templateFn ? templateFn(filename, data, this) : `html.h1 No visualization templates for ${filename}`
    + return this._createAndOpen(program, filename + StudioConstants.ohayoExtension)
    + }
    +
    + async toggleShadowByIdCommand(id) {
    + this.willowBrowser
    + .getBodyStumpNode()
    + .findStumpNodeByChild("id " + id)
    + .getShadow()
    + .toggleShadow()
    + }
    +
    + async fillShadowInputOrTextAreaByClassNameCommand(className, value) {
    + this.willowBrowser
    + .getBodyStumpNode()
    + .findStumpNodesWithClass(className)
    + .forEach((stumpNode) => {
    + stumpNode.getShadow().setInputOrTextAreaValue(value)
    + })
    + }
    +
    + async openDeleteAllTabsPromptCommand() {
    + const tabs = this.getTabs()
    +
    + const shouldProceed = await this.willowBrowser.confirmThen(`Are you sure you want to delete ${tabs.length} open files?`)
    +
    + return shouldProceed
    + ? Promise.all(
    + tabs.map((tab) => {
    + tab.unlinkTab()
    + this.closeTab(tab)
    + })
    + )
    + : false
    + }
    +
    + async closeAllDropDownMenusCommand() {
    + this.getTopDownArray().forEach((treeComponent) => {
    + if (treeComponent.getLine().includes(StudioConstants.DropDownMenuSubstring)) treeComponent.unmountAndDestroy()
    + })
    + }
    +
    + async appendTileAndSelectCommand(line, children) {
    + const tiles = this._appendTiles(line, children)
    + tiles.forEach((tile) => tile.execute())
    + this.mountedProgram.clearSelection()
    + await this.mountedProgram.getTab().autosaveAndRender()
    +
    + tiles.forEach((tile) => tile.selectTile())
    + }
    +
    + async insertChildPickerTileCommand() {
    + const program = this.getMountedTilesProgram()
    + const tiles = program.getTiles()
    + const target = tiles.length ? tiles[tiles.length - 1] : program
    + const newTile = target.appendLineAndChildren(OhayoConstants.pickerTile)
    + await this.getMountedTab().autosaveAndRender()
    + newTile.selectTile()
    + }
    +
    + async insertAdjacentTileCommand() {
    + // todo: remove?
    + // todo: it seems like we don't want to have that insert multiple behavior. removed it for now.
    + const newTiles = this.getNodeCursors()
    + .slice(0, 1)
    + .map((cursor) => cursor.appendLine(OhayoConstants.pickerTile))
    + const promise = await app.getMountedTab().autosaveAndRender()
    + this.mountedProgram.clearSelection()
    + newTiles.forEach((tile) => tile.selectTile())
    + return promise
    + }
    +
    + async appendTileCommand(line, children) {
    + // Todo: we just removed race condition. But does UI suffer?
    + await Promise.all(this._appendTiles(line, children).map((tile) => tile.execute()))
    + return this.mountedTab.autosaveAndRender()
    + }
    +
    + async deleteAllRowsInTargetTileCommand() {
    + const inputTable = this.getTargetTile().getParentOrDummyTable()
    + await Promise.all(inputTable.getRows().map((row) => row.destroyRow(this)))
    + this.renderApp() // todo: cleanup
    + }
    +
    + openOhayoProgramCommand(names) {
    + return Promise.all(names.split(" ").map((name) => this._openOhayoProgram(name)))
    + }
    +
    + deleteFileCommand(filepath) {
    + return this.unlinkFile(filepath)
    + }
    +
    + async moveFileCommand(existingFullDiskFilePath, newFullDiskFilePath) {
    + return this.moveFile(existingFullDiskFilePath, newFullDiskFilePath)
    + }
    +
    + getAutocompleteResultsAtDocEndDiagnostic() {
    + const lastLineIndex = this.mountedProgram.getNumberOfLines() - 1
    + const lastLineNode = this.mountedProgram.nodeAtLine(lastLineIndex)
    + const charIndex = lastLineNode.getIndentLevel() + lastLineNode.getLine().length - 1
    + return this.mountedProgram
    + .getAutocompleteResultsAt(lastLineIndex, charIndex)
    + .matches.map((match) => match.text)
    + .join(" ")
    + }
    +
    + async createNewBlankProgramCommand(filename = "untitled" + StudioConstants.ohayoExtension) {
    + const tab = await this._createAndOpen("", filename)
    + tab.addStumpCodeMessageToLog(`div Created '${tab.getFullTabFilePath()}'`)
    + }
    +
    + async copyTabDeepLinkCommand(tabId) {
    + this.getWillowBrowser().copyTextToClipboard(this._getTabByIdOrMountedTab(tabId).getDeepLink())
    + }
    +
    + _getTabByIdOrMountedTab(tabId) {
    + return tabId === undefined || tabId === "" ? this.mountedTab : this.getTabs().find((tab) => tab._getUid().toString() === tabId)
    + }
    +
    + async createAndOpenNewProgramFromDeepLinkCommand(deepLink) {
    + const uri = new URLSearchParams(new URL(deepLink).search)
    + const fileName = decodeURIComponent(uri.get(StudioConstants.deepLinks.filename))
    + let sourceCode = decodeURIComponent(uri.get(StudioConstants.deepLinks.data))
    + if (uri.get(StudioConstants.deepLinks.edgeSymbol)) sourceCode = sourceCode.replace(new RegExp(uri.get(StudioConstants.deepLinks.edgeSymbol), "g"), " ")
    + if (uri.get(StudioConstants.deepLinks.nodeBreakSymbol)) sourceCode = sourceCode.replace(new RegExp(uri.get(StudioConstants.deepLinks.nodeBreakSymbol), "g"), "\n")
    +
    + // todo: sec scan
    +
    + await this._createAndOpen(sourceCode, fileName)
    + // Now remove the current page from history.
    + // todo: cleanup by moving to willow
    + if (typeof window !== "undefined") window.history.replaceState({}, document.title, location.pathname)
    + }
    +
    + async openCreateNewProgramFromUrlDialogCommand() {
    + const url = await this.willowBrowser.promptThen(`Enter the url to clone and edit`, "")
    +
    + if (!url) return undefined
    +
    + const res = await this.willowBrowser.httpGetUrl(url)
    +
    + const tab = await this._createAndOpen(res.text, "untitled" + StudioConstants.ohayoExtension)
    + tab.addStumpCodeMessageToLog(`div Created '${tab.getFullTabFilePath()}'`)
    + }
    +
    + async openFolderPromptCommand() {
    + const folder = await this.willowBrowser.promptThen(`Enter a folder path to open multiple files`, this.getDefaultDisk().getPathBase())
    + return folder ? this.openFolderCommand(folder) : undefined
    + }
    +
    + async changeWorkingFolderPromptCommand() {
    + const current = this.getDefaultDisk().getPathBase()
    + const newWorkingFolder = await this.willowBrowser.promptThen(`Enter a folder path`, current)
    + if (!newWorkingFolder || current === newWorkingFolder) return undefined
    + return this.changeWorkingFolderCommand(newWorkingFolder)
    + }
    +
    + async changeWorkingFolderCommand(newWorkingFolder) {
    + newWorkingFolder = newWorkingFolder.replace(/\/$/, "") + "/"
    + this.setWorkingFolder(newWorkingFolder)
    + }
    +
    + async openFullDiskFilePathPromptCommand(suggestion) {
    + const fullPath = await this.willowBrowser.promptThen(`Enter a full path to open`, suggestion || this.getDefaultDisk().getPathBase())
    +
    + if (!fullPath) return undefined
    + new FullDiskPath(fullPath)
    + // Todo: what if it does not exist.
    + return this.openFullPathInNewTabAndFocus(fullPath)
    + }
    +
    + async openFolderCommand(fullFolderPath) {
    + fullFolderPath = new FullFolderPath(fullFolderPath, this)
    + const files = await fullFolderPath.getFiles()
    +
    + return Promise.all(files.map((file) => this._openFullDiskFilePathInNewTab(file.getFileLink())))
    + }
    +
    + async confirmAndResetAppStateCommand() {
    + const result = await this.willowBrowser.confirmThen(`Are you sure you want to reset the Ohayo Studio UI? Your files will not be lost.`)
    + if (!result) return undefined
    + this.resetAppState()
    + this.willowBrowser.reload()
    + }
    +
    + openUrlInNewTabCommand(url) {
    + return this._openFullDiskFilePathInNewTab(new FullDiskPath(url).toString())
    + }
    +
    + async mountTabCommand(tabId) {
    + const tab = this._getTabByIdOrMountedTab(tabId)
    + this.setMountedTab(tab)
    + this.renderApp()
    + }
    +
    + async mountTabByIndexCommand(index) {
    + this.setMountedTab(this.getTabs()[index])
    + this.renderApp()
    + }
    +
    + async closeTabCommand(tabId) {
    + this.closeTab(this._getTabByIdOrMountedTab(tabId))
    + this.renderApp()
    + }
    +
    + _mountTabByIndex(tabIndex) {
    + this.setMountedTab(this.getTabs()[tabIndex])
    + this.renderApp()
    + return this
    + }
    +
    + getMountedTab() {
    + return this._getMountedTab()
    + }
    +
    + _getMountedTab() {
    + return this._focusedTab
    + }
    +
    + _getTabsNode() {
    + return this.getNode("menu tabs")
    + }
    +
    + async toggleAutoSaveCommand() {
    + const newSetting = !this.isAutoSaveEnabled()
    + if (!newSetting) this.storeValue(StorageKeys.autoSave, "false")
    + else this.removeValue(StorageKeys.autoSave)
    + this.addStumpCodeMessageToLog(`div Autosave is ${newSetting}`)
    + }
    +
    + get willowBrowser() {
    + return this.getWillowBrowser()
    + }
    +
    + get mountedProgram() {
    + return this.getMountedTilesProgram()
    + }
    +
    + get mountedTab() {
    + return this.getMountedTab()
    + }
    +
    + async toggleThemeCommand() {
    + this._toggleTheme()
    + }
    +
    + openFullPathInNewTabAndFocusCommand(url) {
    + return this.openFullPathInNewTabAndFocus(url)
    + }
    +
    + async _showTabMoveFilePromptCommand(tabId, suggestedNewFilename, isRenameOp = false) {
    + const tab = this._getTabByIdOrMountedTab(tabId)
    +
    + const newName = await this.promptToMoveFile(tab.getFullTabFilePath(), suggestedNewFilename, isRenameOp)
    + if (!newName) return false
    + const tabIndex = tab.getIndex()
    + await this.closeTab(tab)
    + await this.openFullPathInNewTabAndFocus(newName, tabIndex)
    + this.renderApp()
    + }
    +
    + async showTabMoveFilePromptCommand(tabId, suggestedNewFilename) {
    + await this._showTabMoveFilePromptCommand(tabId, suggestedNewFilename)
    + }
    +
    + async showTabRenameFilePromptCommand(tabId, suggestedNewFilename) {
    + await this._showTabMoveFilePromptCommand(tabId, suggestedNewFilename, true)
    + }
    +
    + async toggleOfflineModeCommand() {
    + this.willowBrowser.toggleOfflineMode()
    + }
    +
    + async sleepCommand(ms = 1000) {
    + return new Promise((resolve) => setTimeout(resolve, ms))
    + }
    +
    + async toggleHelpCommand() {
    + this.toggleAndRender(StudioConstants.helpModal)
    + }
    +
    + async closeMountedProgramCommand() {
    + this.closeTab(this.mountedTab)
    + this.renderApp()
    + }
    +
    + fetchAndReloadFocusedTabCommand() {
    + return this.mountedTab.reloadFromDisk()
    + }
    +
    + async selectAllTilesCommand() {
    + // todo: bug. they are not showing selected state.
    + this.mountedProgram.getTiles().forEach((tile) => tile.selectTile())
    + }
    +
    + async clearSelectionCommand() {
    + this.addToCommandLog("app clearSelectionCommand") // todo: what is this?
    + this.mountedProgram.clearSelection()
    + }
    +
    + async deleteSelectionCommand() {
    + this._deleteSelection()
    + await this.mountedProgram.getTab().autosaveAndRender()
    + // Todo: need to reposition all tiles if not using a custom layout
    + // todo: makes me think we should put css top/left/width/height separately from css and stump (so mount 3 things)
    + }
    +
    + _deleteSelection() {
    + const tiles = this.mountedProgram.getSelectedNodes()
    + if (!tiles.length) return undefined
    + tiles.forEach((tile) => {
    + // New behavior is: shift children left 1. Dont delete them along with parent.
    + tile
    + .filter((tile) => tile.doesExtend(OhayoConstants.abstractTileTreeComponentNode) && !tile.isSelected())
    + .forEach((child) => {
    + child.unmount()
    + child.shiftLeft()
    + })
    + tile.unmountAndDestroy()
    + })
    + }
    +
    + async duplicateSelectionCommand() {
    + const newTiles = this.mountedProgram.getSelectedNodes().map((tile) => tile.duplicate())
    + await this.renderApp()
    + this.mountedProgram.clearSelection()
    + newTiles.forEach((tile) => tile.selectTile())
    + await this.mountedProgram.getTab().autosaveAndRender()
    + }
    +
    + async showDeleteFileConfirmDialogCommand(tabId) {
    + const tab = this._getTabByIdOrMountedTab(tabId)
    + const filename = tab.getFileName()
    + // todo: make this an undo operation. on web should be easyish. on desktop via move to trash.
    + const result = await this.willowBrowser.confirmThen(`Are you sure you want to delete ${filename}?`)
    + return result ? this.deleteFocusedTabCommand() : undefined
    + }
    +
    + async deleteFocusedTabCommand() {
    + const tab = this.mountedTab
    + await tab.unlinkTab()
    +
    + this.closeTab(tab)
    + this.renderApp()
    + }
    +
    + async mountPreviousTabCommand() {
    + this.mountPreviousTab()
    + }
    +
    + async mountNextTabCommand() {
    + this.mountNextTab()
    + }
    +
    + async closeAllTabsCommand() {
    + // todo: confirm before closing if unsaved changes?
    + this._getTabsNode()
    + .getOpenTabs()
    + .forEach((tab) => {
    + this.closeTab(tab)
    + })
    + this.renderApp()
    + }
    +
    + async closeAllTabsExceptThisOneCommand(tabId) {
    + const keepTabOpen = this._getTabByIdOrMountedTab(tabId)
    + // todo: confirm before closing if unsaved changes?
    + this._getTabsNode()
    + .getOpenTabs()
    + .forEach((tab) => {
    + if (tab !== keepTabOpen) this.closeTab(tab)
    + })
    + this.renderApp()
    + }
    +
    + async toggleFullScreenCommand() {
    + this.willowBrowser.toggleFullScreen()
    + }
    +
    + toggleMenuCommand() {
    + const menu = this.getMenuTreeComponent()
    + menu.toggleVisibility()
    + this.getPanel().setMenuHeight(menu.isVisible() ? 30 : 0)
    + this.renderApp()
    + }
    +
    + // TODO: make it slidable.?
    + async toggleGutterWidthCommand() {
    + this.getPanel().toggleGutterWidth()
    + this.renderApp()
    + }
    +
    + async toggleGutterCommand() {
    + this.getPanel().toggleGutter()
    + this.renderApp()
    + }
    +
    + async selectNextTileCommand() {
    + this._selectTileByDelta(1)
    + }
    +
    + _selectTileByDelta(delta) {
    + const program = this.mountedProgram
    + const arr = program.getTiles()
    + if (arr.length < 2) return true
    + let currentIndex = arr.indexOf(program.getSelectedNodes()[0])
    + const potentialNewIndex = currentIndex + delta
    + program.clearSelection()
    + arr[potentialNewIndex > arr.length - 1 ? 0 : potentialNewIndex === -1 ? arr.length - 1 : potentialNewIndex].selectTile()
    + }
    +
    + async selectFirstTileCommand() {
    + const firstTile = this.mountedProgram.getTiles()[0]
    + firstTile && firstTile.selectTile()
    + }
    +
    + async selectPreviousTileCommand() {
    + this._selectTileByDelta(-1)
    + }
    +
    + async createNewSourceCodeVisualizationProgramCommand() {
    + // todo: make this create in memory? but then a refresh will end it.
    + const sourceCode = this.mountedProgram.childrenToString()
    + const template = OhayoCodeEditorTemplate(sourceCode, this.mountedTab.getFileName(), StudioConstants.ohayoExtension.substr(1))
    + const tab = await this._createAndOpen(template, this.mountedTab.getFileName() + "-source-code-vis.ohayo")
    +
    + tab.addStumpCodeMessageToLog(`div Created '${tab.getFullTabFilePath()}'`)
    + }
    +
    + async createMiniMapCommand() {
    + // todo: make this create in memory? but then a refresh will end it.
    + const tab = await this._createAndOpen(MiniTemplate, "myPrograms" + StudioConstants.ohayoExtension)
    +
    + tab.addStumpCodeMessageToLog(`div Created '${tab.getFullTabFilePath()}'`)
    + }
    +
    + async clearTabMessagesCommand() {
    + await this.mountedTab.clearMessageBufferCommand()
    +
    + this.renderApp()
    + }
    +
    + async undoFocusedProgramCommand() {
    + return this._undoOrRedo()
    + }
    +
    + async redoFocusedProgramCommand() {
    + return this._undoOrRedo(false)
    + }
    +
    + async _undoOrRedo(undo = true) {
    + this.mountedTab.getTabWall().unmount()
    + undo ? this.mountedProgram.undo() : this.mountedProgram.redo()
    + await this.mountedProgram.loadAndIncrementalRender()
    + }
    +
    + async closeModalCommand() {
    + this.closeModal()
    + }
    +
    + async clearStoreCommand() {
    + // todo: only clear this app values?
    + return this.getStore().disabled ? undefined : this.getStore().clearAll()
    + }
    +
    + async copySelectionCommand(evt) {
    + if (!this.mountedProgram) return true
    +
    + const str = this._copySelection(evt)
    + if (!str) return undefined
    + this.mountedProgram.getRootNode().addStumpCodeMessageToLog(`div Items copied`)
    + return str
    + }
    +
    + async cutSelectionCommand(evt) {
    + const str = this._copySelection(evt)
    + if (!str) return undefined
    + this._deleteSelection()
    + this.mountedProgram.getRootNode().addStumpCodeMessageToLog(`div Items cut`)
    + await this.mountedProgram.getTab().autosaveAndRender()
    + }
    +
    + _copySelection(evt) {
    + const willowBrowser = this.getWillowBrowser()
    + if (this.terminalHasFocus() || willowBrowser.someInputHasFocus()) return ""
    + // copy selected tiles
    + const str = this.mountedProgram.selectionToString()
    + if (!str) return ""
    + willowBrowser.setCopyData(evt, str)
    + return str
    + }
    +
    + async echoCommand(...words) {
    + this.addStumpCodeMessageToLog(`div ${words.join(" ")}`)
    + }
    +
    + async saveTabAndNotifyCommand(tabId) {
    + const tab = this._getTabByIdOrMountedTab(tabId)
    + await tab.forceSaveToFile()
    + tab.addStumpCodeMessageToLog(`div Saved ${tab.getFileName()}
    - this.renderApp()
    - }
    -
    - cloneTabCommand(tabId) {
    - const tab = this._getTabByIdOrMountedTab(tabId)
    - return this._createAndOpen(tab.getTabProgram().childrenToString(), tab.getFileName(), tab.getIndex() + 1)
    - }
    -
    - async pasteCommand(pastedText) {
    - if (this.mountedTab) await this.mountedTab.appendFromPaste(pastedText)
    - else await this._createProgramFromPaste(pastedText)
    - }
    -
    - async executeCommandOnStumpWithIdCommand(commandName, stumpNodeId) {
    - await this._executeCommandByStumpNodeChild(commandName, "id " + stumpNodeId)
    - }
    -
    - async executeCommandOnStumpWithClassCommand(commandName, stumpNodeClass) {
    - await this._executeCommandByStumpNodeChild(commandName, "class " + stumpNodeClass)
    - }
    -
    - async executeCommandOnFirstSelectedTileCommand(command, valueParam, nameParam) {
    - const tile = this.mountedProgram.getSelectedNodes()[0]
    - return tile[command](valueParam, nameParam)
    - }
    -
    - async executeCommandOnLastSelectedTileCommand(command, valueParam, nameParam) {
    - const tile = this.mountedProgram.getSelectedNodes()[this.mountedProgram.getSelectedNodes().length - 1]
    - return tile[command](valueParam, nameParam)
    - }
    -
    - async _doTileQualityCheckCommand() {
    - // Note: currently required a mountedProgram
    - const handGrammarProgram = this.mountedProgram.getHandGrammarProgram()
    - const topNodeTypes = handGrammarProgram.getTopNodeTypeDefinitions().map(def => def.get("crux"))
    -
    - const sourceCode = topNodeTypes.join("\n")
    - const tab = await this._createAndOpen(sourceCode, "all-tiles" + StudioConstants.ohayoExtension)
    - const data = tab
    - .getTabProgram()
    - .getTiles()
    - .filter(tile => tile.getTileQualityCheck) // only check Ohayo tiles
    - .map(tile => tile.getTileQualityCheck())
    -
    - tab.addStumpCodeMessageToLog(`div Created '${tab.getFullTabFilePath()}'`)
    - const sourceCode2 = new jtree.TreeNode(`data.inline
    + this.renderApp()
    + }
    +
    + cloneTabCommand(tabId) {
    + const tab = this._getTabByIdOrMountedTab(tabId)
    + return this._createAndOpen(tab.getTabProgram().childrenToString(), tab.getFileName(), tab.getIndex() + 1)
    + }
    +
    + async pasteCommand(pastedText) {
    + if (this.mountedTab) await this.mountedTab.appendFromPaste(pastedText)
    + else await this._createProgramFromPaste(pastedText)
    + }
    +
    + async executeCommandOnStumpWithIdCommand(commandName, stumpNodeId) {
    + await this._executeCommandByStumpNodeChild(commandName, "id " + stumpNodeId)
    + }
    +
    + async executeCommandOnStumpWithClassCommand(commandName, stumpNodeClass) {
    + await this._executeCommandByStumpNodeChild(commandName, "class " + stumpNodeClass)
    + }
    +
    + async executeCommandOnFirstSelectedTileCommand(command, valueParam, nameParam) {
    + const tile = this.mountedProgram.getSelectedNodes()[0]
    + return tile[command](valueParam, nameParam)
    + }
    +
    + async executeCommandOnLastSelectedTileCommand(command, valueParam, nameParam) {
    + const tile = this.mountedProgram.getSelectedNodes()[this.mountedProgram.getSelectedNodes().length - 1]
    + return tile[command](valueParam, nameParam)
    + }
    +
    + async _doTileQualityCheckCommand() {
    + // Note: currently required a mountedProgram
    + const handGrammarProgram = this.mountedProgram.getHandGrammarProgram()
    + const topNodeTypes = handGrammarProgram.getTopNodeTypeDefinitions().map((def) => def.get("crux"))
    +
    + const sourceCode = topNodeTypes.join("\n")
    + const tab = await this._createAndOpen(sourceCode, "all-tiles" + StudioConstants.ohayoExtension)
    + const data = tab
    + .getTabProgram()
    + .getTiles()
    + .filter((tile) => tile.getTileQualityCheck) // only check Ohayo tiles
    + .map((tile) => tile.getTileQualityCheck())
    +
    + tab.addStumpCodeMessageToLog(`div Created '${tab.getFullTabFilePath()}'`)
    + const sourceCode2 = new jtree.TreeNode(`data.inline
    - sourceCode2.getNode("data.inline").appendLineAndChildren("content", new jtree.TreeNode(data).toCsv())
    - const tab2 = await this._createAndOpen(sourceCode2.toString(), "tiles-quality-check-results" + StudioConstants.ohayoExtension)
    -
    - tab2.addStumpCodeMessageToLog(`div Created '${tab2.getFullTabFilePath()}'`)
    - }
    -
    - getStandardTemplates() {
    - return typeof TemplatesStamp === "undefined"
    - ? jtree.TreeNode.fromDisk(this._getProjectRootDir() + "ohayo/packages/templates/Templates.stamp").trim()
    - : new jtree.TreeNode(TemplatesStamp).trim()
    - }
    -
    - async _openAllTemplatesCommand() {
    - return this._runTemplateSpeedTestCommand(false)
    - }
    -
    - async _runTemplateSpeedTestCommand(closeAfterLoading = true) {
    - const templates = this.getStandardTemplates()
    - const startTime = Date.now()
    -
    - const timePromises = templates.map(async template => {
    - const newTab = await this._createAndOpenInBackgroundTab(template.getNode("data").childrenToString(), template.getWord(1).split("/")[1])
    - const mountedTab = this.getMountedTab()
    - this.setMountedTab(newTab)
    - if (closeAfterLoading && mountedTab) this.closeTab(mountedTab)
    - this.renderApp()
    - return newTab.getTabProgram().toRunTimeStats()
    - })
    -
    - const times = await Promise.all(timePromises)
    - // todo: trigger shift+w shortcut instead of this if clause.
    - if (this.getMountedTab()) this.closeMountedProgramCommand()
    - const rowsAsCsv = new jtree.TreeNode(times)
    - const runTime = Date.now() - startTime
    - const title = `Program Load Times ${moment().format("MM/DD/YYYY")} version ${this.getVersion()}. Run time: ${runTime}`
    - return this._createAndOpen(SpeedTestTemplate(title, rowsAsCsv.toCsv()), "program-load-times" + StudioConstants.ohayoExtension)
    - }
    - }
    -
    - window.StudioApp
    - = StudioApp
    + sourceCode2.getNode("data.inline").appendLineAndChildren("content", new jtree.TreeNode(data).toCsv())
    + const tab2 = await this._createAndOpen(sourceCode2.toString(), "tiles-quality-check-results" + StudioConstants.ohayoExtension)
    +
    + tab2.addStumpCodeMessageToLog(`div Created '${tab2.getFullTabFilePath()}'`)
    + }
    +
    + getStandardTemplates() {
    + return typeof TemplatesStamp === "undefined"
    + ? jtree.TreeNode.fromDisk(this._getProjectRootDir() + "ohayo/packages/templates/Templates.stamp").trim()
    + : new jtree.TreeNode(TemplatesStamp).trim()
    + }
    +
    + async _openAllTemplatesCommand() {
    + return this._runTemplateSpeedTestCommand(false)
    + }
    +
    + async _runTemplateSpeedTestCommand(closeAfterLoading = true) {
    + const templates = this.getStandardTemplates()
    + const startTime = Date.now()
    +
    + const timePromises = templates.map(async (template) => {
    + const newTab = await this._createAndOpenInBackgroundTab(template.getNode("data").childrenToString(), template.getWord(1).split("/")[1])
    + const mountedTab = this.getMountedTab()
    + this.setMountedTab(newTab)
    + if (closeAfterLoading && mountedTab) this.closeTab(mountedTab)
    + this.renderApp()
    + return newTab.getTabProgram().toRunTimeStats()
    + })
    +
    + const times = await Promise.all(timePromises)
    + // todo: trigger shift+w shortcut instead of this if clause.
    + if (this.getMountedTab()) this.closeMountedProgramCommand()
    + const rowsAsCsv = new jtree.TreeNode(times)
    + const runTime = Date.now() - startTime
    + const title = `Program Load Times ${moment().format("MM/DD/YYYY")} version ${this.getVersion()}. Run time: ${runTime}`
    + return this._createAndOpen(SpeedTestTemplate(title, rowsAsCsv.toCsv()), "program-load-times" + StudioConstants.ohayoExtension)
    + }
    + }
    +
    + window.StudioApp = StudioApp
    ohayo/grams/doc.gram
    Changed around line 97: docSectionLinkNode
    - link http://ohayo.computer Ohayo
    + link http://ohayo.breckyunits.com Ohayo
    ohayo/packages/templates/templates/ohayo-product-stats.ohayo
    Changed around line 17: debug.ohayoGrammarTree
    - doc.comment show.static 2 Number of Datasets on Datasets.ohayo.computer
    + doc.comment show.static 2 Number of Datasets on ohayodatasets.breckyunits.com
    ohayo/packages/templates/templates/ohayo-reference.ohayo
    Changed around line 37: debug.ohayoGrammarTree
    - paragraph Words can be bolded[bold] or italicized[em] or monospacedono] or linked[link http://ohayo.computer] or footnoted[ref someRefId].
    + paragraph Words can be bolded[bold] or italicized[em] or monospacedono] or linked[link http://ohayo.breckyunits.com] or footnoted[ref someRefId].
    - link http://ohayo.computer A whole sentence can be linked
    + link http://ohayo.breckyunits.com A whole sentence can be linked
    package.json
    Changed around line 57
    - "homepage": "https://ohayo.computer"
    + "homepage": "https://ohayo.breckyunits.com"
    readme.scroll
    Changed around line 3: title Ohayo
    - * You can try ohayo at https://ohayo.computer, download Ohayo on GitHub, try Ohayo hosted on GitHub, or install it using `npm install ohayo`.
    - https://ohayo.computer https://ohayo.computer
    + * You can try ohayo at https://ohayo.breckyunits.com, download Ohayo on GitHub, try Ohayo hosted on GitHub, or install it using `npm install ohayo`.
    + https://ohayo.breckyunits.com https://ohayo.breckyunits.com
    - https://github.ohayo.computer GitHub
    + https://github.ohayo.breckyunits.com GitHub
    releaseNotes.scroll
    Changed around line 2: title Release Notes
    + # 20.1.1 2024-5-22
    + - 🧹 updated domain name to save a few bucks ;)
    +
    - 🎉 added roughjs.line tile
    Changed around line 466: list
    - - 🎉 all previous versions of Ohayo accessible at v1/v2/vN.ohayo.computer
    + - 🎉 all previous versions of Ohayo accessible at v1/v2/vN.ohayo.breckyunits.com
    - ⚠️ all tile names are new. This version implements namespacing.
    - 🎉 web get, post, and dump tiles.
    - 🎉 better didyoumean tiles
    settings.scroll
    Changed around line 4: siteDescription Ohayo is a data science studio at voicespeed. Ohayo is public do
    - email feedback@ohayo.computer
    - baseUrl https://ohayo.computer/
    + email feedback@ohayo.breckyunits.com
    + baseUrl https://ohayo.breckyunits.com/
    Breck Yunits
    Breck Yunits
    8 months ago
    Update CNAME
    CNAME
    Changed around line 1
    - ohayo.computer
    + ohayo.breckyunits.com
    Breck Yunits
    Breck Yunits
    1 year ago
    Update CNAME
    CNAME
    Changed around line 1
    - github.ohayo.computer
    + ohayo.computer
    Breck Yunits
    Breck Yunits
    2 years ago
    Update scroll
    readme.scroll
    Changed around line 1
    - skipIndexPage
    - aftertext
    - Ohayo is a fast and free tool for data science. Ohayo consists of a very high level programming language and a visual web studio for that language. The goal of Ohayo is to enable people to do data science at the speed of voice. You can see a short clip of Ohayo in action here.
    - link https://youtube.com/watch?v=qqyGHmUlKoc here
    + * Ohayo is a fast and free tool for data science. Ohayo consists of a very high level programming language and a visual web studio for that language. The goal of Ohayo is to enable people to do data science at the speed of voice. You can see a short clip of Ohayo in action here.
    + https://youtube.com/watch?v=qqyGHmUlKoc here
    - aftertext
    - You can try ohayo at https://ohayo.computer, download Ohayo on GitHub, try Ohayo hosted on GitHub, or install it using `npm install ohayo`.
    - link https://ohayo.computer https://ohayo.computer
    - link https://github.com/breck7/ohayo GitHub
    - link https://github.ohayo.computer GitHub
    - wrapsOn
    + * You can try ohayo at https://ohayo.computer, download Ohayo on GitHub, try Ohayo hosted on GitHub, or install it using `npm install ohayo`.
    + https://ohayo.computer https://ohayo.computer
    + https://github.com/breck7/ohayo GitHub
    + https://github.ohayo.computer GitHub
    - section Key Concepts
    + # Key Concepts
    - subsection OhayoLang
    + ## OhayoLang
    - aftertext
    - Ohayo the language is a Tree Language, built using TreeNotation. Ohayo is a dataflow language.
    - link https://github.com/breck7/ohayo/tree/main/ohayo language
    - link https://treenotation.org/ TreeNotation
    + * Ohayo the language is a Tree Language, built using TreeNotation. Ohayo is a dataflow language.
    + https://github.com/breck7/ohayo/tree/main/ohayo language
    + https://treenotation.org/ TreeNotation
    - subsection Scripts
    + ## Scripts
    - aftertext
    - OhayoLang is a scripting language like any other and you can write programs in it by hand or using the Ohayo Studio. OhayoLang scripts generally have the file extension `.ohayo`.
    - wrapsOn
    + * OhayoLang is a scripting language like any other and you can write programs in it by hand or using the Ohayo Studio. OhayoLang scripts generally have the file extension `.ohayo`.
    - subsection Tiles
    + ## Tiles
    - aftertext
    - An Ohayo program is composed of Tiles. Tiles can display UI to the user. Tiles are recursive and can be the parent of other tiles. Tiles are namespaced and all must contain at least one `.`.
    - wrapsOn
    + * An Ohayo program is composed of Tiles. Tiles can display UI to the user. Tiles are recursive and can be the parent of other tiles. Tiles are namespaced and all must contain at least one `.`.
    - subsection Tile Properties
    + ## Tile Properties
    - aftertext
    - Tiles can define and use their own Properties. The names of Tile Properties cannot contain a `.`.
    - wrapsOn
    + * Tiles can define and use their own Properties. The names of Tile Properties cannot contain a `.`.
    - subsection DataTables
    + ## DataTables
    - aftertext
    - All Tiles can access the tables of their ancestor tiles and also pass on a new table to their descendants. The data tables currently use the jTable library.
    - link https://github.com/breck7/jtree/tree/main/jtable jTable
    + * All Tiles can access the tables of their ancestor tiles and also pass on a new table to their descendants. The data tables currently use the jTable library.
    + https://github.com/breck7/jtree/tree/main/jtable jTable
    - subsection Common Tile Types
    + ## Common Tile Types
    - aftertext
    - All Tiles extend from a base class. The three most common core Tile Types are Provider, Transformer, and Chart. In data science you have 3 main kinds of things: datasets, data transformations, and visualizations. Datasets include everything from weather forecasts to emails to business transactions. There are millions of possible datasets. In Ohayo tiles that provide datasets generally extend the Provider base tile type. Transformations are things like filtering, grouping, and joining. In Ohayo tiles that transform data generally extend the Transformer tile type. Charts include bar charts, line charts, scatterplots and word clouds. In Ohayo charts generally extend the Chart base tile type.
    + * All Tiles extend from a base class. The three most common core Tile Types are Provider, Transformer, and Chart. In data science you have 3 main kinds of things: datasets, data transformations, and visualizations. Datasets include everything from weather forecasts to emails to business transactions. There are millions of possible datasets. In Ohayo tiles that provide datasets generally extend the Provider base tile type. Transformations are things like filtering, grouping, and joining. In Ohayo tiles that transform data generally extend the Transformer tile type. Charts include bar charts, line charts, scatterplots and word clouds. In Ohayo charts generally extend the Chart base tile type.
    - subsection Creating Tiles
    + ## Creating Tiles
    - aftertext
    - If you need a new tile—to add a new user friendly data source or visualization type, for example—you can implement it using TypeScript/Javascript/Grammar language. See the packages folder for examples. Documentation for this will come out later in 2020.
    - link https://github.com/breck7/ohayo/tree/main/ohayo/packages packages
    + * If you need a new tile—to add a new user friendly data source or visualization type, for example—you can implement it using TypeScript/Javascript/Grammar language. See the packages folder for examples. Documentation for this will come out later in 2020.
    + https://github.com/breck7/ohayo/tree/main/ohayo/packages packages
    - section BETA!
    + # BETA!
    - aftertext
    - Ohayo is still beta and iterating frequently. Post feedback here or on the TreeNotation subreddit. Ohayo hopefully will be stable by July 2023.
    - link https://www.reddit.com/r/treenotation/ subreddit
    + * Ohayo is still beta and iterating frequently. Post feedback here or on the TreeNotation subreddit. Ohayo hopefully will be stable by July 2023.
    + https://www.reddit.com/r/treenotation/ subreddit
    - section Marketing Jumbo
    + # Marketing Jumbo
    - aftertext
    - If you are looking for some marketing-speak, here you go:
    + * If you are looking for some marketing-speak, here you go:
    Changed around line 63: orderedList
    - section Other Tools For Data Scientists
    + # Other Tools For Data Scientists
    - aftertext
    - Ohayo is just one of my tools that are trying to make data science easier. Here's a list of related products:
    + * Ohayo is just one of my tools that are trying to make data science easier. Here's a list of related products:
    Changed around line 140: pipeTable
    - section How to Give Feedback
    + # How to Give Feedback
    - aftertext
    - Open an issue here, the Tree Notation subreddit or email ohayo@treenotation.org.
    - link https://www.reddit.com/r/treenotation/ subreddit
    + * Open an issue here, the Tree Notation subreddit or email ohayo@treenotation.org.
    + https://www.reddit.com/r/treenotation/ subreddit
    - section ❤️ Public Domain ❤️
    + # ❤️ Public Domain ❤️
    +
    + import settings.scroll
    releaseNotes.scroll
    Changed around line 1
    - skipIndexPage
    - aftertext
    - Here's a list of the notable changes in Ohayo.
    + * Here's a list of the notable changes in Ohayo.
    - section 20.1.0 2020-6-13
    + # 20.1.0 2020-6-13
    - 🎉 added roughjs.line tile
    - 🎉 added columns.keepNumerics tile
    - 🎉 added filter.withAny tile
    - section 20.0.0 2020-3-1
    + # 20.0.0 2020-3-1
    - 🎉 added insert between button to tiles
    - 🎉 roughjs.bar and roughjs.pie tiles
    Changed around line 24: list
    - 🧹 removed TileHeader, TileGrabbers
    - 🧹 removed duplicate TilePicker code
    - section 19.3.0 2020-2-7
    + # 19.3.0 2020-2-7
    - 🎉 owid.list tile
    - section 19.2.0 2020-2-7
    + # 19.2.0 2020-2-7
    - 🎉 text.template, row.sample, and asciichart.line tiles
    - section 19.1.0 2020-02-05
    + # 19.1.0 2020-02-05
    - 🎉 Text permalink, trim, and replace tiles
    - 🏥 Rename and Clone Tab now preserve tab order
    - 🏥 added test and fix for create program from tile example
    - section 19.0.0 2020-02-04
    + # 19.0.0 2020-02-04
    - 🎉 one click insert tile button
    - 🎉 one click new file button
    Changed around line 56: list
    - 🧹 refactored TCF components to better represent page state
    - 🧹 removed windowSize
    - section 18.0.0 2020-1-24
    + # 18.0.0 2020-1-24
    - ⚠️ Maia language is now simply named Ohayo. "maia" file extension is now "ohayo"
    - ⚠️ removed support for Fire, Hakon, Stump and all other Tree Languages
    Changed around line 65: list
    - 🧹 Renamed OhayoApp to StudioApp
    - 🏥 fixed css race condition in "New" drop down menu
    - section 17.4.0 2020-1-24
    + # 17.4.0 2020-1-24
    - 🏥 updated Jtree to fix windows return character bug
    - 🎉 cdc tiles
    - section 17.3.0 2020-1-23
    + # 17.3.0 2020-1-23
    - 🎉 gen tiles
    - 🎉 human population, tld, life expectancy templates
    Changed around line 80: list
    - 🧹 changed fab.html to dev.html
    - ⚠️ date.heatcal is now calendar.heat
    - section 17.2.0 2020-1-3
    + # 17.2.0 2020-1-3
    - 🎉 pca tile
    - 🏥 updated jtree to get clean columns name fix
    - section 17.1.0 2019-12-14
    + # 17.1.0 2019-12-14
    - 🎉 show.value tile
    - 🎉 text.matches tile
    Changed around line 97: list
    - 🧹 dataDomain property on web connected providers
    - 🧹 abstractUrls node
    - section 17.0.0 2019-12-12
    + # 17.0.0 2019-12-12
    - 🎉 data.synth tile
    - 🎉 schema.toSimple and schema.toTypescript tiles
    Changed around line 120: list
    - 🧹 updated Jtree to 49.4.0
    - 🧹 fabWithLocalStorage.html route
    - section 16.4.0 2019-12-9
    + # 16.4.0 2019-12-9
    - 🏥 column name autocomplete fixes and tests
    - 🎉 Print error count onsave in code editor
    Changed around line 128: list
    - 🎉 shell.typescript
    - 🧹 Tile requirement loading code cleanup.
    - section 16.3.0 2019-12-9
    + # 16.3.0 2019-12-9
    - 🏥 data.localStorage editing bug fix
    - 🎉 columns.cleanNames tile
    - section 16.2.0 2019-12-9
    + # 16.2.0 2019-12-9
    - 🏥 dropIfMissing fix
    - 🧹 updated jtree to get deterministic table parsing
    - section 16.1.0 2019-12-8
    + # 16.1.0 2019-12-8
    - 🎉 rows.dropIfMissing tile
    - 🧹 updated to Jtree 49
    - 🧹 examples are now type checked
    - 🧹 command line maia now doesn't print anything unless tiles do it
    - section 16.0.1 2019-12-6
    + # 16.0.1 2019-12-6
    - 🏥 whitespace in doc.code is now pre
    - 🏥 doc.code code is escaped for html and added test
    - 🏥 fixed uncaught error in code mirror editor on save
    - 🧹 moved theme code to one place
    - section 16.0.0 2019-12-6
    + # 16.0.0 2019-12-6
    - 🎉 columns.drop, columns.dropConstants and show.columnCount tiles
    - 🎉 samples.portals tile
    Changed around line 166: list
    - ⚠️ tiles.picker is now doc.picker
    - 🧹 transferred more JS to stump
    - section 15.5.1 2019-12-3
    + # 15.5.1 2019-12-3
    - 🏥 fixed autocomplete regression
    - section 15.5.0 2019-12-02
    + # 15.5.0 2019-12-02
    - 🧹 upgraded to Jtree 48
    - section 15.4.0 2019-11-30
    + # 15.4.0 2019-11-30
    - 🎉 more templates
    - 🎉 template tile now has categories
    Changed around line 183: list
    - 🏥 random tiles fix
    - 🧹 removed meyer css reset
    - section 15.3.0 2019-11-29
    + # 15.3.0 2019-11-29
    - 🎉 show.static tiles for issue #42.
    - 🎉 footer styling is now more minimal.
    Changed around line 191: list
    - 🧹 updated to JTree 47.1 for new stump and perf improvements from parser cacheing.
    - 🧹 moved off nest method in grams and toward typed stump templates.
    - section 15.2.0 2019-11-20
    + # 15.2.0 2019-11-20
    - 🧹 Updated to JTree 46. Removed Commander Classes
    - 🧹 switched some tests to use getTextContent
    - 🏥 inplace cellTypeTree bug
    - 🏥 for #36
    - section 15.1.0 2019-11-19
    + # 15.1.0 2019-11-19
    - 🎉 easier to create distributable copies via `jtree build buildDist destFolder`
    - 🎉 experimenting with using background textures from transparenttextures.com
    - section 15.0.0 2019-11-10
    + # 15.0.0 2019-11-10
    - ⚠️ Flow is now named Maia
    - ⚠️ in Flow acs.cases2019 is now cancer.cases
    - section 14.0.3 2019-11-2
    + # 14.0.3 2019-11-2
    - 🏥 hn fix
    - section 14.0.2 2019-11-2
    + # 14.0.2 2019-11-2
    - 🏥 deep link fixes and tests
    - 🏥 hn fix
    - section 14.0.1 2019-11-2
    + # 14.0.1 2019-11-2
    - 🏥 you can now use server side storage not on local host
    - 🧹 updated jtree
    - section 14.0.0 2019-11-01
    + # 14.0.0 2019-11-01
    - 🎉 Flow now works on the command line too
    - 🎉 full source code released
    Changed around line 232: list
    - 🧹 Updated to Jtree 44.0.0 from 25.2.0
    - 🧹 now compiled product is only 1 unminified js file
    - section 13.0.0 2019-6-09
    + # 13.0.0 2019-6-09
    - 🎉 bar tile now has colorColumn support
    - 🎉 scatter tile now has colorColumn and shapeColumn support
    Changed around line 251: list
    - 🏥 persisting of column types after transformations
    - 🧹 binder to JTable
    - section 12.2.0 2019-6-04
    + # 12.2.0 2019-6-04
    - 🎉 new tiles including rows.sortByReverse, text.length, text.toLowerCase
    - 🎉 new templates including word cloud, cancer, and amazon
    Changed around line 260: list
    - ⚠️ text.lc is now text.lineCount and text.wc is now text.wordCount
    - 🏥 wordcloud sizing fix
    - section 12.1.0 2019-6-03
    + # 12.1.0 2019-6-03
    - 🎉 when appending a snippet, new tile should scroll into view
    - 🎉 updated homepage title
    - 🏥 text in markdown and other text tiles now selectable
    - section 12.0.0 2019-6-03
    + # 12.0.0 2019-6-03
    - 🎉 new tiles including rows.sortBy, rows.reverse, rows.shuffle, samples.babyNames
    - 🎉 new condensed and more minimal style for provider and transformer tiles
    Changed around line 287: list
    - 🧹 updated jtree to 25.2 to fix flakey tests
    - 🧹 Added debugTile grammarTree tile
    - section 11.0.0 2019-5-30
    + # 11.0.0 2019-5-30
    - 🎉 flow now has comments
    - 🎉 codeeditor now some inline parameter hinting, inline error messages, inline error suggestion fixes
    Changed around line 304: list
    - 🧹 package.json dependencies cleanup
    - 🧹 updated jtree to 25.1.0
    - section 10.4.0 2019-5-26
    + # 10.4.0 2019-5-26
    - 🎉 improved scrolling behavior so only wall scrolls while editor and tabs stay
    - 🎉 instant loading of new tabs
    Changed around line 314: list
    - Fixes: web post, delete selection regression fix, date parsing fix, shift+selection regression, picker tile regression fix
    - 🧹 increased branch coverage
    - section 10.3.0 2019-5-24
    + # 10.3.0 2019-5-24
    - 🎉 loading messages will appear for long-loading tiles
    - 🎉 deleting a tile now shifts its children left instead of deleting them as well
    Changed around line 324: list
    - 🏥 lots of async fixes and more tests
    - 🧹 debug.tiles
    - section 10.2.0 2019-5-22
    + # 10.2.0 2019-5-22
    - 🎉 startup is ~75ms faster (due to grammar parsing speed up in Jtree)
    - 🎉 style improvements to html and show tiles
    Changed around line 342: list
    - 🧹 moved column predictions to binder and improvs is now columnPredictionHints
    - 🧹 updated swarm/trooper/gopher
    - section 10.1.0 2019-5-18
    + # 10.1.0 2019-5-18
    - 🎉 now works as an npm dependency
    - 🎉 now have rename and move file commands
    Changed around line 361: list
    - 🧹 HTTPResponse code cleanup
    - 🧹 added "es6" to compiled min file routes
    - section 10.0.0 2019-5-16
    + # 10.0.0 2019-5-16
    - 🎉 column autocomplete
    - 🎉 vega tiles
    Changed around line 403: list
    - 🧹 plugins folder for easier plugin development and support for TypeScript tiles
    - 🧹 updated to Jtree 22+
    - section 9.0.0 2019-4-26
    + # 9.0.0 2019-4-26
    - 🎉 sublime syntax highlighting for Flow
    - 🎉 autocomplete for more words
    Changed around line 445: list
    - 🧹 upgraded to jtree 19+ for new autocomplete and syntax highlighter
    - 🧹 many more tests, @examples, @descriptions and tile quality checking
    - section 8.1.0 2019-2-28
    + # 8.1.0 2019-2-28
    - 🎉 autocomplete now opens on keypress
    - 🎉 data.local> tile
    Changed around line 461: list
    - 🏥 editor color fixes across themes
    - 🏥 to advanced (HOT) table
    - section 8.0.0 2019-02-10
    + # 8.0.0 2019-02-10
    - 🎉 all previous versions of Ohayo accessible at v1/v2/vN.ohayo.computer
    - ⚠️ all tile names are new. This version implements namespacing.
    Changed around line 470: list
    - 🎉 added right click on tile and export to tree file option
    - 🧹 updated jtree for perf gains
    - section 7.1.0 2019-01-04
    + # 7.1.0 2019-01-04
    - 🏥 fixed selection, editor, presidents, and other bugs
    - 🎉 added iris, mtcars, and populations tiles
    - 🎉 display improvements to morph tile
    - 🎉 insert tile and reset ohayo keyboard shortcuts
    - section 7.0.0 2017-12-7
    + # 7.0.0 2017-12-7
    - 🎉 added npm install ohayo and ohayo cli command
    - section 6.0.1 2017-11-24
    + # 6.0.1 2017-11-24
    - 🎉 >img and >fuzz tiles
    - 🏥 morph and other fixes
    - section 6.0.0 2017-11-14
    + # 6.0.0 2017-11-14
    - 🎉 switched focus to only data dashboards now that Tree Languages moved to JTree project
    - section 5.4.1 2017-11-13
    + # 5.4.1 2017-11-13
    - 🏥 >morph tile regression fix
    - section 5.4.0 2017-11-13
    + # 5.4.0 2017-11-13
    - 🧹 updated to jtree
    - section 5.3.0 2017-11-8
    + # 5.3.0 2017-11-8
    - 🧹 Updated to otree
    - Changes: removed rusty and turtle support for now
    - section 5.2.1 2017-11-2
    + # 5.2.1 2017-11-2
    - 🧹 updated to Tree 9
    - section 5.2.0 2017-10-28
    + # 5.2.0 2017-10-28
    - 🧹 updated to Tree 8
    - section 5.1.4 2017-10-28
    + # 5.1.4 2017-10-28
    - 🧹 code cleanup for TP 8
    - section 5.1.3 2017-10-19
    + # 5.1.3 2017-10-19
    - 🏥 changed some dangling ETN references to Tree Languages
    - 🧹 some code cleanup to prepare for new TP library
    - section 5.1.2 2017-9-22
    + # 5.1.2 2017-9-22
    - 🧹 grammar file cleanup and prep work for v6.0 and more tests.
    - section 5.1.1 2017-9-17
    + # 5.1.1 2017-9-17
    - 🏥 some code mirror color highlighting fixes
    - 🧹 grammar type checking, swarm grammar, grammar grammar, upgrade language, other fixes
    - section 5.1.0 2017-9-16
    + # 5.1.0 2017-9-16
    - 🎉 improved autocomplete
    - 🎉 improved flow grammar highlighting
    - ⚠️ >tags keyword in flow is now >types
    - section 5.0.1 2017-9-15
    + # 5.0.1 2017-9-15
    - 🏥 fixed regression in loading of 3D vis
    - 🏥 parse subsettings correctly in flow
    - 🧹 updated Tree to 7.1
    - section 5.0.0 2017-9-14
    + # 5.0.0 2017-9-14
    - 🎉 color word type highlighting for all languages
    - 🎉 scoped autocomplete for all languages
    Changed around line 551: list
    - 🧹 Grammar CC, Blaze VM, sublime syntax, Tree 7, removed monad, auto to improvs, slot types, program errors
    - 🧹 gopher & swarm improvements, Inspect, Profile, async/await, tape to tap, remove details, settings
    - section 4.2.1 2017-9-6
    + # 4.2.1 2017-9-6
    - 🏥 fixed bug where deleting tiles other than newest was not updating source editor
    - section 4.2.0 2017-9-6
    + # 4.2.0 2017-9-6
    - 🎉 create turtle or rusty files
    - 🎉 ETNs now always in tree layout
    Changed around line 569: list
    - 🏥 tab change tiles not appearing render fix
    - 🧹 FlexWall, Files & Folders, Removed Diff & JSSHA, Tests & Diagnostics
    - section 4.1.1 2017-9-1
    + # 4.1.1 2017-9-1
    - 🎉 shift+c type checking command
    - 🧹 better support for typed ETNs
    - section 4.1.0 2017-8-31
    + # 4.1.0 2017-8-31
    - 🏥 heatcal and other flow tile fixes
    - ⚠️ changed "pin" to width/height/top/left
    - 🧹 82%
    - section 4.0.0 2017-8-30
    + # 4.0.0 2017-8-30
    - 🧹 SnapProgram Split, Wall, Tabs, Tiles, TileProcess, Dictionary improvements, Swarm Improvements, Details, App state storage, Commanders, Metrics, Gopher, 79%
    - section 3.2.2 2017-8-24
    + # 3.2.2 2017-8-24
    - 🎉 better typing output in flow
    - ⚠️ in flow ">slots" is now ">tags"
    - ⚠️ in fire "set$+" is now "join"
    - 🧹 Upgrade to Tree 6.0.0, dictionary improvements (frequency, compiled, parameters, variable arity), cli improvements, swarm static
    - section 3.2.1 2017-8-23
    + # 3.2.1 2017-8-23
    - 🎉 drag and drop CSV support
    - 🎉 program names cannot have spaces
    Changed around line 600: list
    - 🏥 fix to some google charts
    - 🧹 flows folder, line count & dashboard, ProgramRunner, dictionary compilation, more swarm files
    - section 3.1.6 2017-8-23
    + # 3.1.6 2017-8-23
    - 🎉 drag and drop files to create programs
    - ⚠️ flow removed >input cog
    - ⚠️ fire removed class and subclass
    - 🧹 merged wall into swarm, stumpprogram, willowprogram, removed WithChildren usage, collapsedNode, stump/bern/monad
    - section 3.1.5 2017-8-22
    + # 3.1.5 2017-8-22
    - 🏥 update to hello world demo fire program
    - section 3.1.4 2017-8-22
    + # 3.1.4 2017-8-22
    - 🎉 added "New from URL" command
    - 🎉 cork theme
    Changed around line 627: list
    - ⚠️ >editor cog in flow is now >coder
    - 🧹 blocks to cogs, slots, swarm, mash, dictionary improvements, corkboard, desktop routes
    - section 3.1.3 2017-8-20
    + # 3.1.3 2017-8-20
    - 🎉 changed "File" dropdown to "New" dropdown, removed open dropdown, and moved other "File" commands to program contextmenu
    - 🏥 fixed recursive "pin" bug reported by DZ.
    - 🧹 updated Tree Notation; switched to Tuples; removed structPath; dictionary instruction renaming; dictionary parsing work
    - section 3.1.1 2017-8-18
    + # 3.1.1 2017-8-18
    - 🏥 flow bugs in row parsing
    - 🏥 bugs in 3d vis
    Changed around line 641: list
    - 🎉 language detection
    - 🧹 modularization
    - section 3.1.0 2017-8-15
    + # 3.1.0 2017-8-15
    - 🎉 added categories to keyboard shortcuts
    - 🏥 row parsing bug fixes
    Changed around line 649: list
    - 🧹 Switched to Dictionary from Blueprints
    - 🧹 EOL Electron
    - section 3.0.0 2017-8-8
    + # 3.0.0 2017-8-8
    - 🎉 replaced textarea source editor with full fledged codemirror editor
    - 🎉 added console output to gutter and load on open
    Changed around line 661: list
    - 🏥 lots of rendering and other bug fixes
    - ⚠️ removed the search/open program input box
    - section 2.2.0 2017-8-04
    + # 2.2.0 2017-8-04
    - ⚠️ flow. removed ">output" block. Use ">dump"
    - ⚠️ flow. removed ">echo" block. Use ">text".
    - 🎉 flow. Added "replacer" block.
    - section 2.1.0 2017-7-31
    + # 2.1.0 2017-7-31
    - 🎉 added >settings block, which by default is hidden and includes program settings like layout
    - 🎉 shift+m shortcut to generate mini map
    Changed around line 676: list
    - 🏥 shift+v fix when you are analyzing a program that contains an unknown node type
    - 🧹 more tests and fixes.
    - section 2.0.0 2017-7-27
    + # 2.0.0 2017-7-27
    - 🎉 added "Hello World" fire example
    - 🎉 added shift+v keyboard shortcut to visualize a program
    Changed around line 689: list
    - 🧹 updated Tree Notation library to 5.0
    - 🧹 bug fixes and more tests
    - section 1.2.4 2017-7-02
    + # 1.2.4 2017-7-02
    - 🧹 bug fixes, tests, and speed improvements
    - section 1.2.3 2017-6-28
    + # 1.2.3 2017-6-28
    - 🧹 bug fixes and more tests
    - section 1.2.1 2017-6-26
    + # 1.2.1 2017-6-26
    - 🎉 Last mounted program is now restored when you refresh the page
    - 🎉 Blocks can now be moved from the top or the bottom
    Changed around line 711: list
    - 🧹 Fire block bug fixes and improvements
    - 🧹 More tests
    - section 1.1.0 2017-6-25
    + # 1.1.0 2017-6-25
    - ⚠️ Programs no longer have "etn" property. Instead, uses file extension. Defaults to Flow.
    - 🎉 Added create fire/flow program to reflect above change.
    Changed around line 719: list
    - 🧹 Improvements to Flow column guesser
    - 🧹 Bug fixes and more tests
    - section 1.0.3 2017-6-23
    + # 1.0.3 2017-6-23
    - 🎉 "If you're not embarrassed when you ship your first version, you waited too long"
    - ⚠️ "We don't believe in shipping a product before it's ready, and we need a little more time"
    - 🎉 This is somewhere in the middle. Ready for researchers, not ready for professionals
    +
    + import settings.scroll
    scroll.settings
    Changed around line 0
    - title Ohayo
    - description Ohayo is a data science studio at voicespeed. Ohayo is public domain software.
    - github https://github.com/breck7/ohayo
    - git https://github.com/breck7/ohayo/blob/main
    - twitter https://twitter.com/breckyunits
    - email feedback@ohayo.computer
    - baseUrl https://ohayo.computer/
    settings.scroll
    Changed around line 1
    + importOnly
    + title Ohayo
    + siteDescription Ohayo is a data science studio at voicespeed. Ohayo is public domain software.
    + github https://github.com/breck7/ohayo
    + viewSourceBaseUrl https://github.com/breck7/ohayo/blob/main
    + twitter https://twitter.com/breckyunits
    + email feedback@ohayo.computer
    + baseUrl https://ohayo.computer/
    Breck Yunits
    Breck Yunits
    2 years ago
    checkpoint
    package-lock.json
    Changed around line 0
    - {
    - "name": "ohayo",
    - "version": "20.1.0",
    - "lockfileVersion": 1,
    - "requires": true,
    - "dependencies": {
    - "@types/cookiejar": {
    - "version": "2.1.1",
    - "resolved": "https://registry.npmjs.org/@types/cookiejar/-/cookiejar-2.1.1.tgz",
    - "integrity": "sha512-aRnpPa7ysx3aNW60hTiCtLHlQaIFsXFCgQlpakNgDNVFzbtusSY8PwjAQgRWfSk0ekNoBjO51eQRB6upA9uuyw==",
    - "dev": true
    - },
    - "@types/d3-format": {
    - "version": "1.3.1",
    - "resolved": "https://registry.npmjs.org/@types/d3-format/-/d3-format-1.3.1.tgz",
    - "integrity": "sha512-KAWvReOKMDreaAwOjdfQMm0HjcUMlQG47GwqdVKgmm20vTd2pucj0a70c3gUSHrnsmo6H2AMrkBsZU2UhJLq8A=="
    - },
    - "@types/node": {
    - "version": "12.7.12",
    - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.12.tgz",
    - "integrity": "sha512-KPYGmfD0/b1eXurQ59fXD1GBzhSQfz6/lKBxkaHX9dKTzjXbK68Zt7yGUxUsCS1jeTy/8aL+d9JEr+S54mpkWQ=="
    - },
    - "@types/superagent": {
    - "version": "3.8.7",
    - "resolved": "https://registry.npmjs.org/@types/superagent/-/superagent-3.8.7.tgz",
    - "integrity": "sha512-9KhCkyXv268A2nZ1Wvu7rQWM+BmdYUVkycFeNnYrUL5Zwu7o8wPQ3wBfW59dDP+wuoxw0ww8YKgTNv8j/cgscA==",
    - "dev": true,
    - "requires": {
    - "@types/cookiejar": "*",
    - "@types/node": "*"
    - }
    - },
    - "accepts": {
    - "version": "1.3.5",
    - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz",
    - "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=",
    - "requires": {
    - "mime-types": "~2.1.18",
    - "negotiator": "0.6.1"
    - }
    - },
    - "any-promise": {
    - "version": "1.3.0",
    - "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
    - "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8="
    - },
    - "arg": {
    - "version": "4.1.1",
    - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.1.tgz",
    - "integrity": "sha512-SlmP3fEA88MBv0PypnXZ8ZfJhwmDeIE3SP71j37AiXQBXYosPV0x6uISAaHYSlSVhmHOVkomen0tbGk6Anlebw=="
    - },
    - "array-flatten": {
    - "version": "1.1.1",
    - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
    - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
    - },
    - "asynckit": {
    - "version": "0.4.0",
    - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
    - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
    - },
    - "balanced-match": {
    - "version": "1.0.0",
    - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
    - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
    - },
    - "body-parser": {
    - "version": "1.18.3",
    - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz",
    - "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=",
    - "requires": {
    - "bytes": "3.0.0",
    - "content-type": "~1.0.4",
    - "debug": "2.6.9",
    - "depd": "~1.1.2",
    - "http-errors": "~1.6.3",
    - "iconv-lite": "0.4.23",
    - "on-finished": "~2.3.0",
    - "qs": "6.5.2",
    - "raw-body": "2.3.3",
    - "type-is": "~1.6.16"
    - }
    - },
    - "brace-expansion": {
    - "version": "1.1.11",
    - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
    - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
    - "requires": {
    - "balanced-match": "^1.0.0",
    - "concat-map": "0.0.1"
    - }
    - },
    - "buffer-from": {
    - "version": "1.1.1",
    - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
    - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A=="
    - },
    - "bytes": {
    - "version": "3.0.0",
    - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
    - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg="
    - },
    - "codemirror": {
    - "version": "5.58.2",
    - "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.58.2.tgz",
    - "integrity": "sha512-K/hOh24cCwRutd1Mk3uLtjWzNISOkm4fvXiMO7LucCrqbh6aJDdtqUziim3MZUI6wOY0rvY1SlL1Ork01uMy6w==",
    - "dev": true
    - },
    - "combined-stream": {
    - "version": "1.0.8",
    - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
    - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
    - "requires": {
    - "delayed-stream": "~1.0.0"
    - }
    - },
    - "complex.js": {
    - "version": "2.0.12",
    - "resolved": "https://registry.npmjs.org/complex.js/-/complex.js-2.0.12.tgz",
    - "integrity": "sha512-oQX99fwL6LrTVg82gDY1dIWXy6qZRnRL35N+YhIX0N7tSwsa0KFy6IEMHTNuCW4mP7FS7MEqZ/2I/afzYwPldw=="
    - },
    - "component-emitter": {
    - "version": "1.3.0",
    - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
    - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg=="
    - },
    - "concat-map": {
    - "version": "0.0.1",
    - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
    - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
    - },
    - "content-disposition": {
    - "version": "0.5.2",
    - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz",
    - "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ="
    - },
    - "content-type": {
    - "version": "1.0.4",
    - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
    - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
    - },
    - "cookie": {
    - "version": "0.3.1",
    - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
    - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
    - },
    - "cookie-signature": {
    - "version": "1.0.6",
    - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
    - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
    - },
    - "cookiejar": {
    - "version": "2.1.2",
    - "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz",
    - "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA=="
    - },
    - "d3-format": {
    - "version": "1.4.1",
    - "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-1.4.1.tgz",
    - "integrity": "sha512-TUswGe6hfguUX1CtKxyG2nymO+1lyThbkS1ifLX0Sr+dOQtAD5gkrffpHnx+yHNKUZ0Bmg5T4AjUQwugPDrm0g=="
    - },
    - "debug": {
    - "version": "2.6.9",
    - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
    - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
    - "requires": {
    - "ms": "2.0.0"
    - }
    - },
    - "decimal.js": {
    - "version": "10.2.1",
    - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.1.tgz",
    - "integrity": "sha512-KaL7+6Fw6i5A2XSnsbhm/6B+NuEA7TZ4vqxnd5tXz9sbKtrN9Srj8ab4vKVdK8YAqZO9P1kg45Y6YLoduPf+kw=="
    - },
    - "delayed-stream": {
    - "version": "1.0.0",
    - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
    - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
    - },
    - "depd": {
    - "version": "1.1.2",
    - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
    - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
    - },
    - "destroy": {
    - "version": "1.0.4",
    - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
    - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
    - },
    - "diff": {
    - "version": "4.0.1",
    - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz",
    - "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q=="
    - },
    - "ee-first": {
    - "version": "1.1.1",
    - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
    - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
    - },
    - "encodeurl": {
    - "version": "1.0.2",
    - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
    - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
    - },
    - "escape-html": {
    - "version": "1.0.3",
    - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
    - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
    - },
    - "escape-latex": {
    - "version": "1.2.0",
    - "resolved": "https://registry.npmjs.org/escape-latex/-/escape-latex-1.2.0.tgz",
    - "integrity": "sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw=="
    - },
    - "etag": {
    - "version": "1.8.1",
    - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
    - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
    - },
    - "express": {
    - "version": "4.16.4",
    - "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz",
    - "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==",
    - "requires": {
    - "accepts": "~1.3.5",
    - "array-flatten": "1.1.1",
    - "body-parser": "1.18.3",
    - "content-disposition": "0.5.2",
    - "content-type": "~1.0.4",
    - "cookie": "0.3.1",
    - "cookie-signature": "1.0.6",
    - "debug": "2.6.9",
    - "depd": "~1.1.2",
    - "encodeurl": "~1.0.2",
    - "escape-html": "~1.0.3",
    - "etag": "~1.8.1",
    - "finalhandler": "1.1.1",
    - "fresh": "0.5.2",
    - "merge-descriptors": "1.0.1",
    - "methods": "~1.1.2",
    - "on-finished": "~2.3.0",
    - "parseurl": "~1.3.2",
    - "path-to-regexp": "0.1.7",
    - "proxy-addr": "~2.0.4",
    - "qs": "6.5.2",
    - "range-parser": "~1.2.0",
    - "safe-buffer": "5.1.2",
    - "send": "0.16.2",
    - "serve-static": "1.13.2",
    - "setprototypeof": "1.1.0",
    - "statuses": "~1.4.0",
    - "type-is": "~1.6.16",
    - "utils-merge": "1.0.1",
    - "vary": "~1.1.2"
    - }
    - },
    - "fast-safe-stringify": {
    - "version": "2.0.7",
    - "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz",
    - "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA=="
    - },
    - "finalhandler": {
    - "version": "1.1.1",
    - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
    - "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==",
    - "requires": {
    - "debug": "2.6.9",
    - "encodeurl": "~1.0.2",
    - "escape-html": "~1.0.3",
    - "on-finished": "~2.3.0",
    - "parseurl": "~1.3.2",
    - "statuses": "~1.4.0",
    - "unpipe": "~1.0.0"
    - }
    - },
    - "form-data": {
    - "version": "2.3.3",
    - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
    - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
    - "requires": {
    - "asynckit": "^0.4.0",
    - "combined-stream": "^1.0.6",
    - "mime-types": "^2.1.12"
    - }
    - },
    - "formidable": {
    - "version": "1.2.1",
    - "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.1.tgz",
    - "integrity": "sha512-Fs9VRguL0gqGHkXS5GQiMCr1VhZBxz0JnJs4JmMp/2jL18Fmbzvv7vOFRU+U8TBkHEE/CX1qDXzJplVULgsLeg=="
    - },
    - "forwarded": {
    - "version": "0.1.2",
    - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
    - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
    - },
    - "fraction.js": {
    - "version": "4.0.13",
    - "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.0.13.tgz",
    - "integrity": "sha512-E1fz2Xs9ltlUp+qbiyx9wmt2n9dRzPsS11Jtdb8D2o+cC7wr9xkkKsVKJuBX0ST+LVS+LhLO+SbLJNtfWcJvXA=="
    - },
    - "fresh": {
    - "version": "0.5.2",
    - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
    - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
    - },
    - "fs.realpath": {
    - "version": "1.0.0",
    - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
    - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
    - },
    - "fuse.js": {
    - "version": "3.4.5",
    - "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-3.4.5.tgz",
    - "integrity": "sha512-s9PGTaQIkT69HaeoTVjwGsLfb8V8ScJLx5XGFcKHg0MqLUH/UZ4EKOtqtXX9k7AFqCGxD1aJmYb8Q5VYDibVRQ=="
    - },
    - "glob": {
    - "version": "7.1.4",
    - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
    - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
    - "requires": {
    - "fs.realpath": "^1.0.0",
    - "inflight": "^1.0.4",
    - "inherits": "2",
    - "minimatch": "^3.0.4",
    - "once": "^1.3.0",
    - "path-is-absolute": "^1.0.0"
    - }
    - },
    - "http-errors": {
    - "version": "1.6.3",
    - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
    - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
    - "requires": {
    - "depd": "~1.1.2",
    - "inherits": "2.0.3",
    - "setprototypeof": "1.1.0",
    - "statuses": ">= 1.4.0 < 2"
    - }
    - },
    - "iconv-lite": {
    - "version": "0.4.23",
    - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
    - "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
    - "requires": {
    - "safer-buffer": ">= 2.1.2 < 3"
    - }
    - },
    - "inflight": {
    - "version": "1.0.6",
    - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
    - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
    - "requires": {
    - "once": "^1.3.0",
    - "wrappy": "1"
    - }
    - },
    - "inherits": {
    - "version": "2.0.3",
    - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
    - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
    - },
    - "ipaddr.js": {
    - "version": "1.8.0",
    - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz",
    - "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4="
    - },
    - "javascript-natural-sort": {
    - "version": "0.7.1",
    - "resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz",
    - "integrity": "sha1-+eIwPUUH9tdDVac2ZNFED7Wg71k="
    - },
    - "jquery": {
    - "version": "3.4.1",
    - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz",
    - "integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==",
    - "dev": true
    - },
    - "jtree": {
    - "version": "49.8.0",
    - "resolved": "https://registry.npmjs.org/jtree/-/jtree-49.8.0.tgz",
    - "integrity": "sha512-SXMttVwy7ti5BTPXDCYU8RCDVd/6zCNa5ZiSqJ2xaNJzwaotTGZkJqA4LAc/41Lfhsr3/RblMaWrlDFEDCj34Q==",
    - "requires": {
    - "@types/d3-format": "^1.3.1",
    - "d3-format": "^1.3.2",
    - "express": "*",
    - "glob": "^7.1.4",
    - "mkdirp": "^0.5.1",
    - "moment": "^2.24.0",
    - "moment-parseformat": "^3.0.0",
    - "prettier": "^1.18.2",
    - "recursive-readdir-sync": "^1.0.6",
    - "semver": "^6.1.1",
    - "superagent": "^5.1.0"
    - },
    - "dependencies": {
    - "moment-parseformat": {
    - "version": "3.0.0",
    - "resolved": "https://registry.npmjs.org/moment-parseformat/-/moment-parseformat-3.0.0.tgz",
    - "integrity": "sha512-dVgXe6b6DLnv4CHG7a1zUe5mSXaIZ3c6lSHm/EKeVeQI2/4pwe0VRde8OyoCE1Ro2lKT5P6uT9JElF7KDLV+jw=="
    - }
    - }
    - },
    - "lodash": {
    - "version": "4.17.21",
    - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
    - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
    - },
    - "make-error": {
    - "version": "1.3.5",
    - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz",
    - "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g=="
    - },
    - "marked": {
    - "version": "4.0.10",
    - "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.10.tgz",
    - "integrity": "sha512-+QvuFj0nGgO970fySghXGmuw+Fd0gD2x3+MqCWLIPf5oxdv1Ka6b2q+z9RP01P/IaKPMEramy+7cNy/Lw8c3hw=="
    - },
    - "mathjs": {
    - "version": "7.5.1",
    - "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-7.5.1.tgz",
    - "integrity": "sha512-H2q/Dq0qxBLMw+G84SSXmGqo/znihuxviGgAQwAcyeFLwK2HksvSGNx4f3dllZF51bWOnu2op60VZxH2Sb51Pw==",
    - "requires": {
    - "complex.js": "^2.0.11",
    - "decimal.js": "^10.2.1",
    - "escape-latex": "^1.2.0",
    - "fraction.js": "^4.0.12",
    - "javascript-natural-sort": "^0.7.1",
    - "seed-random": "^2.2.0",
    - "tiny-emitter": "^2.1.0",
    - "typed-function": "^2.0.0"
    - }
    - },
    - "media-typer": {
    - "version": "0.3.0",
    - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
    - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
    - },
    - "merge-descriptors": {
    - "version": "1.0.1",
    - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
    - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
    - },
    - "methods": {
    - "version": "1.1.2",
    - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
    - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
    - },
    - "mime": {
    - "version": "1.4.1",
    - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz",
    - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ=="
    - },
    - "mime-db": {
    - "version": "1.37.0",
    - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz",
    - "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg=="
    - },
    - "mime-types": {
    - "version": "2.1.21",
    - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz",
    - "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==",
    - "requires": {
    - "mime-db": "~1.37.0"
    - }
    - },
    - "minimatch": {
    - "version": "3.0.4",
    - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
    - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
    - "requires": {
    - "brace-expansion": "^1.1.7"
    - }
    - },
    - "minimist": {
    - "version": "0.0.8",
    - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
    - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
    - },
    - "mkdirp": {
    - "version": "0.5.1",
    - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
    - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
    - "requires": {
    - "minimist": "0.0.8"
    - }
    - },
    - "moment": {
    - "version": "2.29.4",
    - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
    - "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
    - },
    - "moment-parseformat": {
    - "version": "2.2.1",
    - "resolved": "https://registry.npmjs.org/moment-parseformat/-/moment-parseformat-2.2.1.tgz",
    - "integrity": "sha1-FFqXrfTDB0x0xTVcRbFaKQFzIJM="
    - },
    - "mousetrap": {
    - "version": "1.6.3",
    - "resolved": "https://registry.npmjs.org/mousetrap/-/mousetrap-1.6.3.tgz",
    - "integrity": "sha512-bd+nzwhhs9ifsUrC2tWaSgm24/oo2c83zaRyZQF06hYA6sANfsXHtnZ19AbbbDXCDzeH5nZBSQ4NvCjgD62tJA==",
    - "dev": true
    - },
    - "ms": {
    - "version": "2.0.0",
    - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
    - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
    - },
    - "mz": {
    - "version": "2.7.0",
    - "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz",
    - "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==",
    - "requires": {
    - "any-promise": "^1.0.0",
    - "object-assign": "^4.0.1",
    - "thenify-all": "^1.0.0"
    - }
    - },
    - "negotiator": {
    - "version": "0.6.1",
    - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz",
    - "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk="
    - },
    - "numeral": {
    - "version": "2.0.6",
    - "resolved": "https://registry.npmjs.org/numeral/-/numeral-2.0.6.tgz",
    - "integrity": "sha1-StCAk21EPCVhrtnyGX7//iX05QY="
    - },
    - "object-assign": {
    - "version": "4.1.1",
    - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
    - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
    - },
    - "on-finished": {
    - "version": "2.3.0",
    - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
    - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
    - "requires": {
    - "ee-first": "1.1.1"
    - }
    - },
    - "once": {
    - "version": "1.4.0",
    - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
    - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
    - "requires": {
    - "wrappy": "1"
    - }
    - },
    - "parseurl": {
    - "version": "1.3.2",
    - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz",
    - "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M="
    - },
    - "path-is-absolute": {
    - "version": "1.0.1",
    - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
    - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
    - },
    - "path-to-regexp": {
    - "version": "0.1.7",
    - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
    - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
    - },
    - "pca-js": {
    - "version": "1.0.2",
    - "resolved": "https://registry.npmjs.org/pca-js/-/pca-js-1.0.2.tgz",
    - "integrity": "sha512-Y6a1RQ/pdNJnJq7ya9PHBW2RUXZCXDbbRpmpwclvuhOo7mttx1f80OKIQ0nPF6kCZ4a98G5TqIfRrIblk7R6Jg=="
    - },
    - "prettier": {
    - "version": "1.18.2",
    - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz",
    - "integrity": "sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw=="
    - },
    - "proxy-addr": {
    - "version": "2.0.4",
    - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz",
    - "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==",
    - "requires": {
    - "forwarded": "~0.1.2",
    - "ipaddr.js": "1.8.0"
    - }
    - },
    - "qs": {
    - "version": "6.5.2",
    - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
    - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
    - },
    - "range-parser": {
    - "version": "1.2.0",
    - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
    - "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4="
    - },
    - "raw-body": {
    - "version": "2.3.3",
    - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz",
    - "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==",
    - "requires": {
    - "bytes": "3.0.0",
    - "http-errors": "1.6.3",
    - "iconv-lite": "0.4.23",
    - "unpipe": "1.0.0"
    - }
    - },
    - "recursive-readdir": {
    - "version": "2.2.2",
    - "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.2.tgz",
    - "integrity": "sha512-nRCcW9Sj7NuZwa2XvH9co8NPeXUBhZP7CRKJtU+cS6PW9FpCIFoI5ib0NT1ZrbNuPoRy0ylyCaUL8Gih4LSyFg==",
    - "requires": {
    - "minimatch": "3.0.4"
    - }
    - },
    - "recursive-readdir-sync": {
    - "version": "1.0.6",
    - "resolved": "https://registry.npmjs.org/recursive-readdir-sync/-/recursive-readdir-sync-1.0.6.tgz",
    - "integrity": "sha1-Hb9tMvPFu4083pemxYjVR6nhPVY="
    - },
    - "safe-buffer": {
    - "version": "5.1.2",
    - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
    - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
    - },
    - "safer-buffer": {
    - "version": "2.1.2",
    - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
    - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
    - },
    - "seed-random": {
    - "version": "2.2.0",
    - "resolved": "https://registry.npmjs.org/seed-random/-/seed-random-2.2.0.tgz",
    - "integrity": "sha1-KpsZ4lCoFwmSMaW5mk2vgLf77VQ="
    - },
    - "semver": {
    - "version": "6.3.0",
    - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
    - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
    - },
    - "send": {
    - "version": "0.16.2",
    - "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz",
    - "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==",
    - "requires": {
    - "debug": "2.6.9",
    - "depd": "~1.1.2",
    - "destroy": "~1.0.4",
    - "encodeurl": "~1.0.2",
    - "escape-html": "~1.0.3",
    - "etag": "~1.8.1",
    - "fresh": "0.5.2",
    - "http-errors": "~1.6.2",
    - "mime": "1.4.1",
    - "ms": "2.0.0",
    - "on-finished": "~2.3.0",
    - "range-parser": "~1.2.0",
    - "statuses": "~1.4.0"
    - }
    - },
    - "serve-static": {
    - "version": "1.13.2",
    - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz",
    - "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==",
    - "requires": {
    - "encodeurl": "~1.0.2",
    - "escape-html": "~1.0.3",
    - "parseurl": "~1.3.2",
    - "send": "0.16.2"
    - }
    - },
    - "setprototypeof": {
    - "version": "1.1.0",
    - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
    - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
    - },
    - "source-map": {
    - "version": "0.6.1",
    - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
    - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
    - },
    - "source-map-support": {
    - "version": "0.5.16",
    - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz",
    - "integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==",
    - "requires": {
    - "buffer-from": "^1.0.0",
    - "source-map": "^0.6.0"
    - }
    - },
    - "statuses": {
    - "version": "1.4.0",
    - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
    - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew=="
    - },
    - "store": {
    - "version": "2.0.12",
    - "resolved": "https://registry.npmjs.org/store/-/store-2.0.12.tgz",
    - "integrity": "sha1-jFNOKguDH3K3X8XxEZhXxE711ZM=",
    - "dev": true
    - },
    - "string_decoder": {
    - "version": "1.1.1",
    - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
    - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
    - "requires": {
    - "safe-buffer": "~5.1.0"
    - }
    - },
    - "superagent": {
    - "version": "5.1.0",
    - "resolved": "https://registry.npmjs.org/superagent/-/superagent-5.1.0.tgz",
    - "integrity": "sha512-7V6JVx5N+eTL1MMqRBX0v0bG04UjrjAvvZJTF/VDH/SH2GjSLqlrcYepFlpTrXpm37aSY6h3GGVWGxXl/98TKA==",
    - "requires": {
    - "component-emitter": "^1.3.0",
    - "cookiejar": "^2.1.2",
    - "debug": "^4.1.1",
    - "fast-safe-stringify": "^2.0.6",
    - "form-data": "^2.3.3",
    - "formidable": "^1.2.1",
    - "methods": "^1.1.2",
    - "mime": "^2.4.4",
    - "qs": "^6.7.0",
    - "readable-stream": "^3.4.0",
    - "semver": "^6.1.1"
    - },
    - "dependencies": {
    - "debug": {
    - "version": "4.1.1",
    - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
    - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
    - "requires": {
    - "ms": "^2.1.1"
    - }
    - },
    - "mime": {
    - "version": "2.4.4",
    - "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz",
    - "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA=="
    - },
    - "ms": {
    - "version": "2.1.2",
    - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
    - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
    - },
    - "qs": {
    - "version": "6.9.0",
    - "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.0.tgz",
    - "integrity": "sha512-27RP4UotQORTpmNQDX8BHPukOnBP3p1uUJY5UnDhaJB+rMt9iMsok724XL+UHU23bEFOHRMQ2ZhI99qOWUMGFA=="
    - },
    - "readable-stream": {
    - "version": "3.4.0",
    - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz",
    - "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==",
    - "requires": {
    - "inherits": "^2.0.3",
    - "string_decoder": "^1.1.1",
    - "util-deprecate": "^1.0.1"
    - }
    - }
    - }
    - },
    - "thenify": {
    - "version": "3.3.1",
    - "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz",
    - "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==",
    - "requires": {
    - "any-promise": "^1.0.0"
    - }
    - },
    - "thenify-all": {
    - "version": "1.6.0",
    - "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz",
    - "integrity": "sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY=",
    - "requires": {
    - "thenify": ">= 3.1.0 < 4"
    - }
    - },
    - "tiny-emitter": {
    - "version": "2.1.0",
    - "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
    - "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
    - },
    - "tinycolor2": {
    - "version": "1.4.1",
    - "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.1.tgz",
    - "integrity": "sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g="
    - },
    - "ts-node": {
    - "version": "8.4.1",
    - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.4.1.tgz",
    - "integrity": "sha512-5LpRN+mTiCs7lI5EtbXmF/HfMeCjzt7DH9CZwtkr6SywStrNQC723wG+aOWFiLNn7zT3kD/RnFqi3ZUfr4l5Qw==",
    - "requires": {
    - "arg": "^4.1.0",
    - "diff": "^4.0.1",
    - "make-error": "^1.1.1",
    - "source-map-support": "^0.5.6",
    - "yn": "^3.0.0"
    - }
    - },
    - "type-is": {
    - "version": "1.6.16",
    - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz",
    - "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==",
    - "requires": {
    - "media-typer": "0.3.0",
    - "mime-types": "~2.1.18"
    - }
    - },
    - "typed-function": {
    - "version": "2.0.0",
    - "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-2.0.0.tgz",
    - "integrity": "sha512-Hhy1Iwo/e4AtLZNK10ewVVcP2UEs408DS35ubP825w/YgSBK1KVLwALvvIG4yX75QJrxjCpcWkzkVRB0BwwYlA=="
    - },
    - "typescript": {
    - "version": "3.6.4",
    - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.4.tgz",
    - "integrity": "sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg=="
    - },
    - "unpipe": {
    - "version": "1.0.0",
    - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
    - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
    - },
    - "util-deprecate": {
    - "version": "1.0.2",
    - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
    - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
    - },
    - "utils-merge": {
    - "version": "1.0.1",
    - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
    - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
    - },
    - "vary": {
    - "version": "1.1.2",
    - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
    - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
    - },
    - "wrappy": {
    - "version": "1.0.2",
    - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
    - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
    - },
    - "yn": {
    - "version": "3.1.1",
    - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
    - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q=="
    - }
    - }
    - }
    dependabot[bot]
    dependabot[bot]
    2 years ago
    Bump thenify from 3.3.0 to 3.3.1 Bumps [thenify](https://github.com/thenables/thenify) from 3.3.0 to 3.3.1. - [Release notes](https://github.com/thenables/thenify/releases) - [Changelog](https://github.com/thenables/thenify/blob/master/History.md) - [Commits](https://github.com/thenables/thenify/compare/3.3.0...3.3.1) --- updated-dependencies: - dependency-name: thenify dependency-type: indirect ... Signed-off-by: dependabot[bot]
    package-lock.json
    Changed around line 757
    - "version": "3.3.0",
    - "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.0.tgz",
    - "integrity": "sha1-5p44obq+lpsBCCB5eLn2K4hgSDk=",
    + "version": "3.3.1",
    + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz",
    + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==",
    dependabot[bot]
    dependabot[bot]
    2 years ago
    Bump moment from 2.24.0 to 2.29.4 Bumps [moment](https://github.com/moment/moment) from 2.24.0 to 2.29.4. - [Release notes](https://github.com/moment/moment/releases) - [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md) - [Commits](https://github.com/moment/moment/compare/2.24.0...2.29.4) --- updated-dependencies: - dependency-name: moment dependency-type: direct:production ... Signed-off-by: dependabot[bot]
    package-lock.json
    Changed around line 485
    - "version": "2.24.0",
    - "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
    - "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
    + "version": "2.29.4",
    + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
    + "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
    dependabot[bot]
    dependabot[bot]
    3 years ago
    Bump marked from 0.6.3 to 4.0.10 Bumps [marked](https://github.com/markedjs/marked) from 0.6.3 to 4.0.10. - [Release notes](https://github.com/markedjs/marked/releases) - [Changelog](https://github.com/markedjs/marked/blob/master/.releaserc.json) - [Commits](https://github.com/markedjs/marked/compare/v0.6.3...v4.0.10) --- updated-dependencies: - dependency-name: marked dependency-type: direct:production ... Signed-off-by: dependabot[bot]
    package-lock.json
    Changed around line 411
    - "version": "0.6.3",
    - "resolved": "https://registry.npmjs.org/marked/-/marked-0.6.3.tgz",
    - "integrity": "sha512-Fqa7eq+UaxfMriqzYLayfqAE40WN03jf+zHjT18/uXNuzjq3TY0XTbrAoPeqSJrAmPz11VuUA+kBPYOhHt9oOQ=="
    + "version": "4.0.10",
    + "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.10.tgz",
    + "integrity": "sha512-+QvuFj0nGgO970fySghXGmuw+Fd0gD2x3+MqCWLIPf5oxdv1Ka6b2q+z9RP01P/IaKPMEramy+7cNy/Lw8c3hw=="
    package.json
    Changed around line 21
    - "marked": "^0.6.3",
    + "marked": "^4.0.10",
    Breck Yunits
    Breck Yunits
    2 years ago
    Merge pull request #87 from celtic-coder/patch-1 Ohayo in beta, will be stable by 2023